Rev 16766 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpnamespace LeadersLinked\Library;use Fpdf\Fpdf;class PlanningPdfOne extends FPDF {protected $titleObjective='';protected $descriptionObjective='';protected $swit=true;protected $descriptionGoals='';protected $titleGoals="";protected $titleTask="";public $continueTask=1;function setP($p){$this->continueTask=$p;}function getP(){return $this->continueTask;}/*** Header PDF*/function Header() {if ($this->header != '') {$this->Image($this->header, -120, 1, 450);$this->SetY(55);}$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Ln();if($this->swit==false){$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->Cell(188, 6, Functions::utf8_decode('Meta: '. $this->titleGoals), 1, 1, 'C', true);$this->Ln();if($this->getP()==5){$this->SetFont('Arial', '', 9);$this->Cell(188, 6, Functions::utf8_decode('Tareas: '. $this->titleTask.' ( Continuacion )'), 1, 1, 'C', true);}}}/*** Footer PDF*/function Footer() {if ($this->footer != '') {$this->SetY(-40);$this->Image($this->footer, -70,$this->getY() , 350);}}function borderTable($title, $items) {$this->AddPage();// Header Table$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 12);$this->Cell(188, 12, Functions::utf8_decode($title), 0, 1, 'C', false);$this->Ln(5);// Body Table$this->SetFillColor(225, 255, 255);$this->SetTextColor(0);$addPageObjective=false;foreach ($items as $objective) {$this->titleObjective=$objective['title'];$this->descriptionObjective=$objective['description'];if ($objective['status']=='a') {if($addPageObjective){$this->AddPage();}$addPageObjective=true;$this->SetFont('Arial', 'B', 9);$costObjective=0;$timeObjective=0;$contObjetive=0;$indicatorObjective=0;foreach($objective['goals'] as $record){$indicatorGoals=0;if($record->status=='a'){foreach($record->task as $record2){if($record2->status=='a'){$costObjective=$costObjective+$record2->cost;$timeObjective=$timeObjective+$record2->time;$indicatorGoals= $indicatorGoals+$record2->indicator;}}}if(count($record->task)>0){$indicatorObjective=$indicatorObjective+($indicatorGoals/count($record->task));$contObjetive++;}}if($contObjetive!=0){$indicatorObjective=round($indicatorObjective/$contObjetive,2);}if(count($objective['goals'])<=0){$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$this->descriptionObjective), 1, 'L', false);$this->Cell(20, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(25, 6, Functions::utf8_decode($objective['date']), 1, 0, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Horas Totales: '), 1, 0, 'L', false);$this->Cell(43, 6, Functions::utf8_decode($timeObjective), 1, 0, 'C', false);$this->Cell(50, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($indicatorObjective.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costObjective), 1, 1, 'R', false);$this->Ln();$this->swit=false;}$addPageGoals=false;foreach($objective['goals'] as $record){if($record->status=='a'){if($addPageGoals){$this->AddPage();}$addPageGoals=true;if($this->swit){$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$this->descriptionObjective), 1, 'L', false);$this->Cell(20, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(25, 6, Functions::utf8_decode($objective['date']), 1, 0, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Horas Totales: '), 1, 0, 'L', false);$this->Cell(43, 6, Functions::utf8_decode($timeObjective), 1, 0, 'C', false);$this->Cell(50, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($indicatorObjective.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costObjective), 1, 1, 'R', false);$this->Ln();$this->swit=false;}$indicatorGoals=0;$timeGoals=0;$costGoals=0;foreach($record->task as $record2){if($record2->status=='a'){$costGoals=$costGoals+$record2->cost;$timeGoals=$timeGoals+$record2->time;$indicatorGoals= $indicatorGoals+$record2->indicator;}}if(count($record->task)>0){$indicatorGoals=round($indicatorGoals/count($record->task),2);}$this->titleGoals=$record->title;$this->descriptionGoals=$record->description;$this->Cell(188, 6, Functions::utf8_decode('Meta: '.$record->title), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$record->description), 1, 'L', false);$this->Cell(40, 6, Functions::utf8_decode('Horas Totalesa: '), 1, 0, 'L', false);$this->Cell(54, 6, Functions::utf8_decode($timeGoals), 1, 0, 'C', false);$this->Cell(54, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(40, 6, Functions::utf8_decode($indicatorGoals.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costGoals), 1, 1, 'R', false);$this->Ln();foreach ($record->task as $record2) {if($record2->status=='a'){$this->SetFont('Arial', '', 9);$this->titleTask=$record2->title;$this->Cell(188, 6, Functions::utf8_decode('Tarea: '.$record2->title), 1, 1, 'C', true);$this->setP(5);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$record2->description), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Implementacion: '.$record2->how), 1, 'L', false);$whoUser='';$toggleWho=true;foreach($record2->who as $record3){if($toggleWho){$whoUser=$whoUser.$record3;$toggleWho=false;}else{$whoUser=$whoUser.', '.$record3;}}$this->MultiCell(188, 6, Functions::utf8_decode('Participantes: '.$whoUser), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Lugar: '.$record2->place), 1, 'L', false);$this->Cell(16, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($record2->date), 1, 0, 'C', false);$this->Cell(16, 6, Functions::utf8_decode('Horas: '), 1, 0, 'L', false);$this->Cell(35, 6, Functions::utf8_decode($record2->time), 1, 0, 'C', false);$this->Cell(40, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(16, 6, Functions::utf8_decode($record2->indicator.'%'), 1, 0, 'C', false);$this->Cell(20, 6, Functions::utf8_decode('Prioridad: '), 1, 0, 'L', false);if($record2->priority=='i'){$this->Cell(25, 6, Functions::utf8_decode('Importante'), 1, 1, 'C', false);}else if($record2->priority=='ni'){$this->Cell(25, 6, Functions::utf8_decode('No importante'), 1, 1, 'C', false);}else if($record2->priority=='nu'){$this->Cell(25, 6, Functions::utf8_decode('No urgente'), 1, 1, 'C', false);}else if($record2->priority=='u'){$this->Cell(25, 6, Functions::utf8_decode('Urgente'), 1, 1, 'C', false);}if($record2->indicator==100){$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion evaluacion: '.$record2->evaluation), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion desvio: '.$record2->detour), 1, 'L', false);}$this->SetFont('Arial', 'B', 11);$this->Cell(20, 8, Functions::utf8_decode('Costo: '), 1, 0, 'L', false);$this->Cell(168, 8, Functions::utf8_decode('$'.$record2->cost), 1, 1, 'R', false);$this->setP(1);$this->Ln(7);}}$this->swit=true;}}}}}function borderTableAll($title, $items) {$this->AddPage();// Header Table$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 12);$this->Cell(188, 12, Functions::utf8_decode($title), 0, 1, 'C', false);$this->Ln(5);// Body Table$this->SetFillColor(225, 255, 255);$this->SetTextColor(0);$addPageObjective=false;foreach ($items as $objective) {$this->titleObjective=$objective->title;$this->descriptionObjective=$objective->description;if ($objective->status=='a') {if($addPageObjective){$this->AddPage();}$addPageObjective=true;$this->SetFont('Arial', 'B', 9);$costObjective=0;$timeObjective=0;$contObjetive=0;$indicatorObjective=0;foreach($objective->goals as $record){$indicatorGoals=0;if($record->status=='a'){foreach($record->task as $record2){if($record2->status=='a'){$costObjective=$costObjective+$record2->cost;$timeObjective=$timeObjective+$record2->time;$indicatorGoals= $indicatorGoals+$record2->indicator;}}}if(count($record->task)>0){$indicatorObjective=$indicatorObjective+($indicatorGoals/count($record->task));$contObjetive++;}$this->descriptionGoals=$record->description;}if($contObjetive!=0){$indicatorObjective=round($indicatorObjective/$contObjetive,2);}if(count($objective->goals)<=0){$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$this->descriptionObjective), 1, 'L', false);$this->Cell(20, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(25, 6, Functions::utf8_decode($objective->date), 1, 0, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Horas Totales: '), 1, 0, 'L', false);$this->Cell(43, 6, Functions::utf8_decode($timeObjective), 1, 0, 'C', false);$this->Cell(50, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($indicatorObjective.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costObjective), 1, 1, 'R', false);$this->Ln();$this->swit=false;}$addPageGoals=false;foreach($objective->goals as $record){$this->titleGoals=$record->title;if($record->status=='a'){if($addPageGoals){$this->AddPage();}$addPageGoals=true;if($this->swit){$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$this->descriptionObjective), 1, 'L', false);$this->Cell(20, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(25, 6, Functions::utf8_decode($objective->date), 1, 0, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Horas Totales: '), 1, 0, 'L', false);$this->Cell(43, 6, Functions::utf8_decode($timeObjective), 1, 0, 'C', false);$this->Cell(50, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($indicatorObjective.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costObjective), 1, 1, 'R', false);$this->Ln();$this->swit=false;}$indicatorGoals=0;$timeGoals=0;$costGoals=0;foreach($record->task as $record2){if($record2->status=='a'){$costGoals=$costGoals+$record2->cost;$timeGoals=$timeGoals+$record2->time;$indicatorGoals= $indicatorGoals+$record2->indicator;}}if(count($record->task)>0){$indicatorGoals=round($indicatorGoals/count($record->task),2);}$this->Cell(188, 6, Functions::utf8_decode('Meta: '.$record->title), 1, 1, 'C', true);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$record->description), 1, 'L', false);$this->Cell(40, 6, Functions::utf8_decode('Horas Totalesa: '), 1, 0, 'L', false);$this->Cell(54, 6, Functions::utf8_decode($timeGoals), 1, 0, 'C', false);$this->Cell(54, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(40, 6, Functions::utf8_decode($indicatorGoals.'%'), 1, 1, 'C', false);$this->Cell(30, 6, Functions::utf8_decode('Costo total: '), 1, 0, 'L', false);$this->Cell(158, 6, Functions::utf8_decode('$'.$costGoals), 1, 1, 'R', false);$this->Ln();foreach ($record->task as $record2) {if($record2->status=='a'){$this->SetFont('Arial', '', 9);$this->titleTask=$record2->title;$this->Cell(188, 6, Functions::utf8_decode('Tarea: '.$record2->title), 1, 1, 'C', true);$this->setP(5);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion: '.$record2->description), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Implementacion: '.$record2->how), 1, 'L', false);$whoUser='';$toggleWho=true;foreach($record2->who as $record3){if($toggleWho){$whoUser=$whoUser.$record3;$toggleWho=false;}else{$whoUser=$whoUser.', '.$record3;}}$this->MultiCell(188, 6, Functions::utf8_decode('Participantes: '.$whoUser), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Lugar: '.$record2->place), 1, 'L', false);$this->Cell(16, 6, Functions::utf8_decode('Fecha: '), 1, 0, 'L', false);$this->Cell(20, 6, Functions::utf8_decode($record2->date), 1, 0, 'C', false);$this->Cell(16, 6, Functions::utf8_decode('Horas: '), 1, 0, 'L', false);$this->Cell(35, 6, Functions::utf8_decode($record2->time), 1, 0, 'C', false);$this->Cell(40, 6, Functions::utf8_decode('Indicador de progreso: '), 1, 0, 'L', false);$this->Cell(16, 6, Functions::utf8_decode($record2->indicator.'%'), 1, 0, 'C', false);$this->Cell(20, 6, Functions::utf8_decode('Prioridad: '), 1, 0, 'L', false);if($record2->priority=='i'){$this->Cell(25, 6, Functions::utf8_decode('Importante'), 1, 1, 'C', false);}else if($record2->priority=='ni'){$this->Cell(25, 6, Functions::utf8_decode('No importante'), 1, 1, 'C', false);}else if($record2->priority=='nu'){$this->Cell(25, 6, Functions::utf8_decode('No urgente'), 1, 1, 'C', false);}else if($record2->priority=='u'){$this->Cell(25, 6, Functions::utf8_decode('Urgente'), 1, 1, 'C', false);}if($record2->indicator==100){$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion evaluacion: '.$record2->evaluation), 1, 'L', false);$this->MultiCell(188, 6, Functions::utf8_decode('Descripcion desvio: '.$record2->detour), 1, 'L', false);}$this->SetFont('Arial', 'B', 11);$this->Cell(20, 8, Functions::utf8_decode('Costo: '), 1, 0, 'L', false);$this->Cell(168, 8, Functions::utf8_decode('$'.$record2->cost), 1, 1, 'R', false);$this->setP(1);$this->Ln(7);}}$this->swit=true;}}}$this->swit=true;}}function borderTableMatriz($title,$items){$this->AddPage();// Header Table$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 12);$this->Cell(188, 12, Functions::utf8_decode($title), 0, 1, 'C', false);$this->Ln(5);$titleswitch=true;// Body Table$this->SetFillColor(225, 255, 255);$this->SetTextColor(0);$addPageObjective=false;$addPageGoals=false;foreach ($items as $objective) {if ($objective->status=='a'&&count($objective->goals)>0) {$this->titleObjective=$objective->title;$this->descriptionObjective=$objective->description;/*if($addPageObjective){$this->AddPage();}$addPageObjective=true;*/foreach($objective->goals as $record){if($record->status=='a'&&count($record->task)>0){$this->titleGoals=$record->title;if($addPageGoals){$this->AddPage();}$addPageGoals=true;if($this->swit){$this->SetFillColor(204, 204, 204);$this->SetDrawColor(0, 0, 0);$this->SetLineWidth(0);$this->SetFont('Arial', 'B', 9);$this->Cell(188, 6, Functions::utf8_decode('Objectivo: '.$this->titleObjective), 1, 1, 'C', true);$this->swit=false;}$this->Cell(188, 6, Functions::utf8_decode('Meta: '.$record->title), 1, 1, 'C', true);$this->Ln();$iu=[];$niu=[];$inu=[];$ninu=[];$matriz= array(array());foreach($record->task as $record2){if($record2->priority=='i'&&$record2->urgent=='u'){array_push($iu, $record2->title);}if($record2->priority=='i'&&$record2->urgent=='nu'){array_push($inu, $record2->title);}if($record2->priority=='ni'&&$record2->urgent=='u'){array_push($niu, $record2->title);}if($record2->priority=='ni'&&$record2->urgent=='nu'){array_push($ninu, $record2->title);}}foreach ($iu as $index=>$record2) {$matriz[$index][0]=$record2;}foreach ($inu as $index=>$record2) {$matriz[$index][1]=$record2;}foreach ($niu as $index=>$record2) {$matriz[$index][2]=$record2;}foreach ($ninu as $index=>$record2) {$matriz[$index][3]=$record2;}$countMatriz=count($matriz);$countMatriz=ceil($countMatriz/10);$pageSwitch=false;for($h=1;$h<=$countMatriz;$h++){if($pageSwitch){$this->titleGoals=$record->title.' (Continuacion)';$this->AddPage();}$this->SetFont('Arial', 'B', 12);$this->Cell(32, 12, '', 0, 0, 'C', false);$this->Cell(78, 12, Functions::utf8_decode('Urgente'), 1, 0, 'C', true);$this->Cell(78, 12, Functions::utf8_decode('No urgente'), 1, 1, 'C', true);$this->Cell(32, 70, Functions::utf8_decode('Importante'), 1, 0, 'C', true);$this->Cell(156,70,'',1,1,'',false);$this->Cell(32, 70, Functions::utf8_decode('No Importante'), 1, 0, 'C', true);$this->Cell(156,70,'',1,1,'',false);if($titleswitch){$this->Line(120, 102,120,242);$this->SetXY(10,108);}else{$this->Line(120, 89,120,231);$this->SetXY(10,96);}$this->SetFont('Arial', '', 10);for($i=($h-1)*10;$i<($h*10);$i++) {$this->Cell(32, 12, '', 0, 0, 'C', false);if(isset($matriz[$i][0])){$this->Cell(78, 6, Functions::utf8_decode($matriz[$i][0]), 0, 0, 'C', false);}else{$this->Cell(78, 6, Functions::utf8_decode(''), 0, 0, 'l', false);}if(isset($matriz[$i][1])){$this->Cell(78, 6, Functions::utf8_decode($matriz[$i][1]), 0, 1, 'C', false);}else{$this->Cell(78, 6, Functions::utf8_decode(''), 0, 1, 'l', false);}}if($titleswitch){$this->SetXY(10,178);$titleswitch=false;}else{$this->SetXY(10,166);}for($i=($h-1)*10;$i<($h*10);$i++) {$this->Cell(32, 12, '', 0, 0, 'C', false);if(isset($matriz[$i][2])){$this->Cell(78, 6, Functions::utf8_decode($matriz[$i][2]), 0, 0, 'C', false);}else{$this->Cell(78, 6, Functions::utf8_decode(''), 0, 0, 'l', false);}if(isset($matriz[$i][3])){$this->Cell(78, 6, Functions::utf8_decode($matriz[$i][3]), 0, 1, 'C', false);}else{$this->Cell(78, 6, Functions::utf8_decode(''), 0, 1, 'l', false);}}$pageSwitch=true;}$this->swit=true;}}}$this->swit=true;}}}