public function store()
 {
     $validator = Validator::make(Input::all(), Iterations::$rules, Iterations::$messages);
     $inicio = Input::get('start');
     $end = Input::get('end');
     $projectid = Input::get('projectid');
     $valido = $this->validateDate($inicio, $end);
     if (!$valido) {
         return Redirect::to('iterations/create?projectid=' . Input::get('projectid'))->with('error', 'La fecha inicial es mayor que la final')->withErrors($validator)->withInput();
     } else {
         $valido = $this->validateDateWithProjectDate($projectid, $inicio, $end);
         if (!$valido) {
             return Redirect::to('iterations/create?projectid=' . Input::get('projectid'))->with('error', 'La fecha de inicio o fin estan fuera de las fechas de ejecución del projecto.')->withErrors($validator)->withInput();
         }
     }
     if ($validator->passes() && $valido) {
         //if($validator->passes()){
         $iterations = new Iterations();
         $iterations->name = Input::get('name');
         $iterations->start = Input::get('start');
         $iterations->end = Input::get('end');
         $iterations->estimatedBudget = Input::get('estimatedBudget');
         $iterations->projectid = $projectid;
         $iterations->save();
         $organization = app('organization');
         return Redirect::to('/iterations/' . $iterations->id)->with('message', 'Iteracion creada con exito');
     } else {
         return Redirect::to('iterations/create?projectid=' . Input::get('projectid'))->with('error', 'Ocurrieron los siguientes errores')->withErrors($validator)->withInput();
     }
 }
 /**
  *
  */
 public function summary($id)
 {
     $iterationAux;
     //try {
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     //foreach($iterations as $var){
     //  $iterationAux = $iterationAux . var_dump($var);
     //}
     //}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
     //}
     //die;
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(20, 30, 50, 80);
     $datay2 = array(30, 95, 70, 40);
     $datazero = array(0, 0, 0, 0);
     // Create the graph.
     $graph = new Graph(800, 500);
     $graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
     // Setup Y and Y2 scales with some "grace"
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     //$graph->yaxis->scale->SetGrace(30);
     //$graph->y2axis->scale->SetGrace(30);
     //$graph->ygrid->Show(true,true);
     $graph->ygrid->SetColor('gray', 'lightgray@0.5');
     // Setup graph colors
     $graph->SetMarginColor('white');
     $graph->y2axis->SetColor('darkred');
     // Create the "dummy" 0 bplot
     $bplotzero = new BarPlot($datazero);
     // Create the "Y" axis group
     $ybplot1 = new BarPlot($datay);
     $ybplot1->value->Show();
     $ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
     // Create the "Y2" axis group
     $ybplot2 = new BarPlot($datay2);
     $ybplot2->value->Show();
     $ybplot2->value->SetColor('darkred');
     $ybplot2->SetFillColor('darkred');
     $y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
     // Add the grouped bar plots to the graph
     $graph->Add($ybplot);
     $graph->AddY2($y2bplot);
     $datax = array('A', 'B', 'C', 'D');
     $graph->xaxis->SetTickLabels($datax);
     // .. and finally stroke the image back to browser
     $graph->Stroke();
 }
Пример #3
0
                 $totalPersonal += $total;
                 $task->typePersonal()->attach([$id => ['quantity' => $cantidad, 'hours' => $hours, 'total' => $total]]);
             }
         }
         //obtener los gastos adicionales de la tarea
         $gastos = AdditionalCost::where('taskid', '=', $id)->get();
         $totalSpent = 0;
         if (count($gastos) > 0) {
             foreach ($gastos as $gasto) {
                 $totalSpent += $gasto->total;
             }
         }
         //actualizar la iteracion y el proyecto
         $totalTask = $totalMaterial + $totalPersonal + $totalSpent;
         $issue = Issue::findOrFail($task->issueid);
         $iteration = Iterations::findOrFail($issue->iterationid);
         $project = Project::findOrFail($iteration->projectid);
         //iteracion
         $iteration->realBudget = $iteration->realBudget + $totalTask;
         $iteration->save();
         //proyecto
         $project->budgetReal = $project->budgetReal + $totalTask;
         $project->save();
         $final = "yes";
         //actualizar a finalizado la tarea
         $task->closed = 'SI';
         $task->save();
     }
     $user = User::findOrFail($task->userid);
     return Response::json(array('succes' => '1', 'task' => $task, 'user' => $user, 'final' => $final));
 }
Пример #4
0
 public function searchIssues($id)
 {
     $iteration = Iterations::findOrFail($id);
     $aux = Issue::where('iterationid', '=', $id)->get();
     return $aux;
 }
Пример #5
0
 /**
  * Get home after logged in
  **/
 public function getDashboard()
 {
     $organization = app('organization');
     $projectsCount = sizeof($organization->projects);
     $idProjects = array();
     foreach ($organization->projects as $project) {
         $idProjects[] = $project->id;
     }
     $iterations = Iterations::whereIn('projectid', $idProjects)->get();
     $idIterations = array();
     foreach ($iterations as $iteration) {
         $idIterations[] = $iteration->id;
     }
     $issues = Issue::whereIn('iterationid', $idIterations)->get();
     $idStories = array();
     foreach ($issues as $issue) {
         $idStories[] = $issue->id;
     }
     $tasks = Task::whereIn('issueid', $idStories)->get();
     $this->layout->content = View::make('layouts.users.dashboard')->with('organization', $organization)->with('projectsCount', $projectsCount)->with('iterationsCount', count($iterations))->with('taskCount', count($tasks));
 }
 public function line_budget($id)
 {
     $iterationAux;
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     $string_iterations;
     $dataBudgetEstimated = array();
     $dataBudgetReal = array();
     $dataIterationName = array();
     $dataBudgetEstimated[] = 0;
     $dataBudgetReal[] = 0;
     $dataIterationName[] = '';
     foreach ($iterations as $var) {
         $dataBudgetEstimated[] = $var->estimatedBudget;
         $dataBudgetReal[] = $var->realBudget;
         $dataIterationName[] = $var->name;
     }
     //$string_iterations = implode(";", $iterations);
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     // Some (random) data
     $ydata = array(0, 11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
     $ydata2 = array(0, 1, 19, 15, 7, 22, 14, 5, 9, 21, 13);
     // Size of the overall graph
     $width = 800;
     $height = 400;
     // Create the graph and set a scale.
     // These two calls are always required
     $graph = new Graph($width, $height);
     $graph->SetScale('intlin');
     $graph->SetShadow();
     // Setup margin and titles
     //$graph->img->SetMargin(40,30,40,40);
     $graph->SetMargin(40, 50, 40, 40);
     $graph->title->Set('GRAFICO LINEAL');
     $graph->subtitle->Set('(Presupuesto)');
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     //$graph->xaxis->title->Set('Operator');
     //$graph->yaxis->title->Set('# of calls');
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->SetTickLabels($dataIterationName);
     // Create the first data series
     $lineplot = new LinePlot($dataBudgetEstimated);
     $lineplot->SetWeight(2);
     // Two pixel wide
     $lineplot->mark->SetType(MARK_SQUARE);
     $lineplot->mark->SetWidth(7);
     $lineplot->mark->SetColor('orange');
     //$lineplot->mark->SetColor('#A519B5');
     $lineplot->mark->SetFillColor('orange');
     //$lineplot->mark->SetFillColor('#A519B5');
     // Add the plot to the graph
     $graph->Add($lineplot);
     $lineplot->value->Show();
     //$lineplot->value->SetColor("#A519B5");
     $lineplot->value->SetColor("orange");
     $lineplot->SetLegend('Presupuesto estimado');
     // Create the second data series
     $lineplot2 = new LinePlot($dataBudgetReal);
     /*
         MARK_SQUARE, A filled square
         MARK_UTRIANGLE, A triangle pointed upwards
         MARK_DTRIANGLE, A triangle pointed downwards
         MARK_DIAMOND, A diamond
         MARK_CIRCLE, A circle
         MARK_FILLEDCIRCLE, A filled circle
         MARK_CROSS, A cross
         MARK_STAR, A star
         MARK_X, An 'X'
         MARK_LEFTTRIANGLE, A half triangle, vertical line to left (used as group markers for Gantt charts)
         MARK_RIGHTTRIANGLE, A half triangle, vertical line to right (used as group markers for Gantt charts)
         MARK_FLASH, A Zig-Z
     */
     //$lineplot2->SetWeight( 2 );   // Two pixel wide
     //$lineplot2->mark->SetType(MARK_DIAMOND);
     //$lineplot2->mark->SetColor('#A519B5');
     //$lineplot2->mark->SetFillColor('#A519B5');
     $lineplot2->mark->SetType(MARK_DIAMOND);
     $lineplot2->mark->SetWidth(10);
     $lineplot2->mark->SetColor('#A519B5');
     //$lineplot2->mark->SetColor('orange');
     $lineplot2->mark->SetFillColor('#A519B5');
     //$lineplot2->mark->SetFillColor('orange');
     // Add the second plot to the graph
     $graph->Add($lineplot2);
     $lineplot2->SetColor("#00D053");
     $lineplot2->SetLegend('Presupuesto real');
     $lineplot2->value->Show();
     //        $lineplot2->value->SetColor("orange");
     $lineplot2->value->SetColor("#A519B5");
     $graph->legend->SetFrameWeight(2);
     $graph->legend->SetFont(FF_FONT1, FS_BOLD);
     // Display the graph
     $graph->Stroke();
 }
 public function iterationSummary2($id)
 {
     $iteration = Iterations::findOrFail($id);
     $issues = Issue::where('iterationid', '=', $iteration->id)->get();
     $tasksId = array();
     foreach ($issues as $issue) {
         $tasksId[] = $issue->id;
     }
     $tasks = Task::whereIn('issueid', $tasksId)->get();
     $countTODO = 0;
     $countDOING = 0;
     $countDONE = 0;
     foreach ($tasks as $task) {
         switch ($task->scrumid) {
             case 1:
                 $countTODO++;
                 break;
             case 2:
                 $countDOING++;
                 break;
             case 3:
                 $countDONE++;
                 break;
         }
     }
 }