����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 PersonData { public static $tablename = "person"; public function PersonData(){ $this->name = ""; $this->lastname = ""; $this->email = ""; $this->image = ""; $this->password = ""; $this->created_at = "NOW()"; $this->credit_limit = "NULL"; } public function add_client(){ $sql = "insert into customer (name,address1,colonia,country,city,cp,email1,phone,is_active_access,credit_limit,gender) "; $sql .= "value (\"$this->name\",\"$this->address1\",\"$this->colonia\",\"$this->localidad\",\"$this->city\"$this->cp,\"$this->email1\",\"$this->phone1\",\"$this->is_active_access\",\"$this->credit_limit,\"$this->has_credit)"; Executor::doit($sql); } public function add_provider(){ $sql = "insert into person (no,name,lastname,address1,email1,phone1,kind,created_at) "; $sql .= "value (\"$this->no\",\"$this->name\",\"$this->lastname\",\"$this->address1\",\"$this->email1\",\"$this->phone1\",2,$this->created_at)"; Executor::doit($sql); } public function add_contact(){ $sql = "insert into person (name,lastname,address1,email1,phone1,kind,created_at) "; $sql .= "value (\"$this->name\",\"$this->lastname\",\"$this->address1\",\"$this->email1\",\"$this->phone1\",3,$this->created_at)"; 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 PersonData previamente utilizamos el contexto public function update(){ $sql = "update ".self::$tablename." set name=\"$this->name\",email1=\"$this->email1\",address1=\"$this->address1\",lastname=\"$this->lastname\",phone1=\"$this->phone1\" where id=$this->id"; Executor::doit($sql); } public function update_client(){ $sql = "update ".self::$tablename." set no=\"$this->no\",name=\"$this->name\",email1=\"$this->email1\",address1=\"$this->address1\",no_int=\"$this->no_int\",no_ext=\"$this->no_ext\",colonia=\"$this->colonia\",localidad=\"$this->localidad\",city=\"$this->city\",state=\"$this->state\",cp=\"$this->cp\",lastname=\"$this->lastname\",phone1=\"$this->phone1\",is_active_access=\"$this->is_active_access\",password=\"$this->password\",has_credit=\"$this->has_credit\",credit_limit=\"$this->credit_limit\" where id=$this->id"; Executor::doit($sql); } public function update_provider($rfc,$contacto,$regimen,$CP,$address1,$id){ try { $sql = "UPDATE `person` SET rfc= \"$rfc\",lastname=\"$contacto\",regimen=\"$regimen\",CP = \"$CP\" , address1 = \"$address1\" WHERE `person`.`id` = $id"; Executor::doit($sql); $stat[0] = true; $stat[1] = "Success Edit!"; return $stat; } catch(PDOException $ex) { $stat[0] = false; $stat[1] = $ex->getMessage(); return $stat; } } public function update_contact(){ $sql = "update ".self::$tablename." set name=\"$this->name\",email1=\"$this->email1\",address1=\"$this->address1\",lastname=\"$this->lastname\",phone1=\"$this->phone1\" where id=$this->id"; Executor::doit($sql); } public function update_passwd(){ $sql = "update ".self::$tablename." set password=\"$this->password\" where id=$this->id"; Executor::doit($sql); } public static function getById($id){ $sql = "select * from customer where id_cust='$id'"; $query = Executor::doit($sql); return Model::one($query[0],new PersonData()); } //clientes buscar por rfc public static function getByRfc($id){ $sql = "select * from customer where rfc='$id'"; $query = Executor::doit($sql); return Model::one($query[0],new PersonData()); } public static function getByIdCredit($id){ $sql = "select * from ".self::$tablename." where id=$id and has_credit=1 and kind=1"; $query = Executor::doit($sql); return Model::one($query[0],new PersonData()); } public static function getProvidersId($id){ $sql = "select * from ".self::$tablename." where id=$id and kind=2 order by name,lastname"; $query = Executor::doit($sql); return Model::one($query[0],new PersonData()); } public static function getAll(){ $sql = "select * from ".self::$tablename." where kind=1 orde by asc"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getClients(){ $sql = "select * from customer order by name "; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getClientsWithCredit(){ $sql = "select * from ".self::$tablename." where kind=1 and has_credit=1 order by name,lastname"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getClientsWithCredit2($id){ $sql = "select * from customer where gender='$id' order by name"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } /*AGREGAR CLIENTE CON CREDITO 24 DE JUNIO 2017*/ public static function gettoClientWithCredit(){ $sql = "select * from ".self::$tablename." where kind=1 and has_credit=1 order by name,lastname"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getContacts(){ $sql = "select * from ".self::$tablename." where kind=3 order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getProviders(){ $sql = "select * from ".self::$tablename." where kind=2 order by name,lastname"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } public static function getLike($q){ $sql = "select * from ".self::$tablename." where name like '%$q%'"; $query = Executor::doit($sql); return Model::many($query[0],new PersonData()); } } ?>