public function actionReporteVentasDiario() { $lista_pedidos = []; $total = 0; $mod = true; if (isset($_POST['fecha'])) { $fecha = $_POST['fecha']; $fechai = new \DateTime($fecha); $lista_pedidos = Pedido::consultarRegistroVentas($fechai->format('Y-m-d'), null); foreach ($lista_pedidos as $pedido) { $total += $pedido['numero_pedidos']; } $mod = false; } return $this->render('reporte-ventas-diario', ['rows' => $lista_pedidos, 'total' => $total, 'mod' => $mod]); }
public static function consultarRegistrosVentasMes($mes) { $now = new \DateTime(); $year = $now->format('Y'); $day = "1"; $fechai = new \DateTime($year . '-' . $mes . '-' . $day); $fechaf = new \DateTime($year . '-' . (intval($mes) + 1) . '-' . $day); $fechaf = $fechaf->sub(new \DateInterval('P0Y0M1D')); return Pedido::consultarRegistroVentas($fechai->format('Y-m-d'), $fechaf->format('Y-m-d')); }