<?php require_once "../core_nufarm/libs.php"; $pn = new PlanDeNegocios(); $duplicados = $pn->query("SELECT * FROM facturacion ORDER BY id ASC")->fetchAll(); $collection1 = array(); $collection2 = array(); $collection3 = array(); foreach ($duplicados as $kdupl => $vdupl) { if (!in_array($vdupl->id_vendedor, $collection1)) { $collection1[$vdupl->id_vendedor] = array(); } } foreach ($duplicados as $kdupl => $vdupl) { $collection1[$vdupl->id_vendedor][$vdupl->id_user] = $vdupl; } /* foreach ($collection1 as $kdupl => $vdupl) { echo "<pre>"; print_r($vdupl); echo "<pre>"; die; } */ echo "<pre>"; print_r($collection1); echo "<pre>"; /* echo "<pre>"; print_r($duplicados); echo "<pre>";
<?php @session_start(); require_once '../core_nufarm/libs.php'; error_reporting(0); Auth::check(); $user = Auth::User(); $pn = new PlanDeNegocios(); if (!$pn->hasFacturacion()) { $pn->initFactUser($user->idUsuario, $user->vendedor); } $facturacion = $pn->getFacturacion($user->idUsuario, false); $facturacion_decode = json_decode($facturacion->data); $currentPeriod = PlanDeNegocios::formatCurrentPeriod($facturacion->periodo_inicial, $facturacion->periodo_final); $percentage_total = PlanDeNegocios::percentageTotal($facturacion->obj_fact_clave, $facturacion->fact_total); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Nufarm Maxx</title> <!-- librerías opcionales que activan el soporte de HTML5 para IE8 --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]-->
private static function filterPN() { $filter = self::post('params'); $user = self::post('user'); $pn = new PlanDeNegocios(); $pn->role = $user['role']; $collection = $pn->getResults($filter); echo json_encode($collection); // $ve->getResults($filter); // print_r($collection); }