Cambio en cuenta de bonos de transporte #27
					 1 changed files with 12 additions and 12 deletions
				
			
		|  | @ -18,17 +18,6 @@ class Subpedido extends Model | |||
|     return $this->belongsToMany('App\Producto')->withPivot(["cantidad","total"]); | ||||
|   } | ||||
| 
 | ||||
|   //Bonos del MPS, Sororo, etc. NO devuelve bonos de transporte
 | ||||
|   private function bonos() | ||||
|   { | ||||
|     return $this->productos()->where('bono',1); | ||||
|   } | ||||
| 
 | ||||
|   public function productosSinBonos() | ||||
|   { | ||||
|     return $this->productos()->where('bono',false); | ||||
|   } | ||||
| 
 | ||||
|   public function grupoDeCompra() | ||||
|   { | ||||
|     return $this->belongsTo('App\GrupoDeCompra'); | ||||
|  | @ -40,6 +29,17 @@ class Subpedido extends Model | |||
|       return $filtros->aplicar($query); | ||||
|   } | ||||
| 
 | ||||
|   //Bonos del MPS, Sororo, etc. NO devuelve bonos de transporte
 | ||||
|   private function bonos() | ||||
|   { | ||||
|     return $this->productos()->where('bono',1); | ||||
|   } | ||||
| 
 | ||||
|   public function productosSinBonos() | ||||
|   { | ||||
|     return $this->productos()->where('bono',false); | ||||
|   } | ||||
| 
 | ||||
|   //Subtotal de dinero de productos del pedido, sin bonos ni transporte
 | ||||
|   public function totalSinBonos() | ||||
|   { | ||||
|  | @ -49,7 +49,7 @@ class Subpedido extends Model | |||
|   //Cantidad de bonos de transporte
 | ||||
|   public function cantidadBDT() | ||||
|   { | ||||
|     return ceil($this->totalSinBonos() / 500); | ||||
|     return ceil(($this->totalSinBonos()+1) / 500); | ||||
|   } | ||||
| 
 | ||||
|   //Subtotal de dinero de bonos de transporte
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue