Completed
Push — master ( 17af13...acdc2b )
by Andrzej
02:44
created
src/Entities/PatientPOR.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @return multitype:string
271 271
 	 */
272 272
 	public static function getFields() {
273
-		$superFields = parent::getFields ();
274
-		$fields = array_merge ( $superFields, array (
273
+		$superFields = parent::getFields();
274
+		$fields = array_merge($superFields, array(
275 275
 				"iCiaza",
276 276
 				"iWywiad",
277 277
 				"iPozycja",
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				"iVPomiarParametrowZyciowych",
314 314
 				"iVKarmienie",
315 315
 				"iVEdukacjaZdrowotnaIWsparciePsychiczne" 
316
-		) );
316
+		));
317 317
 		return $fields;
318 318
 	}
319 319
 	public function getICiaza() {
Please login to merge, or discard this patch.
src/Entities/PatientRaportOptimized.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 	 * @param unknown $date        	
15 15
 	 */
16 16
 	public static function getRaport($wardId, $date) {
17
-		$startDate = $date . '-01';
18
-		$endDate = date ( "Y-m-t 23:59:59", strtotime ( $startDate ) );
17
+		$startDate = $date.'-01';
18
+		$endDate = date("Y-m-t 23:59:59", strtotime($startDate));
19 19
 		
20
-		return PatientRaportOptimized::getRaportBetweenDatesNative ( $wardId, $startDate, $endDate );
20
+		return PatientRaportOptimized::getRaportBetweenDatesNative($wardId, $startDate, $endDate);
21 21
 	}
22 22
 	private static function updateNativeRaport() {
23
-		$em = DoctrineBootstrap::getEntityManager ();
24
-		$conn = $em->getConnection ();
23
+		$em = DoctrineBootstrap::getEntityManager();
24
+		$conn = $em->getConnection();
25 25
 		// create report table
26 26
 		$sql1 = "CREATE TABLE IF NOT EXISTS kategoria_view 
27 27
 					(data DATETIME, oddzialId INT, kategoria INT, suma INT,
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 					kategoriaPacjenta";
51 51
 		// select
52 52
 		try {
53
-			$conn->query ( $sql1 );
54
-			$conn->query ( $sql2 );
55
-		} catch ( Exception $e ) {
53
+			$conn->query($sql1);
54
+			$conn->query($sql2);
55
+		} catch (Exception $e) {
56 56
 			// echo 'Caught exception: ', $e->getMessage(), "\n";
57 57
 		}
58 58
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 	 * @param unknown $endDate
64 64
 	 */
65 65
 	public static function getRaportBetweenDatesNative($wardId, $startDate, $endDate) {
66
-		$em = DoctrineBootstrap::getEntityManager ();
66
+		$em = DoctrineBootstrap::getEntityManager();
67 67
 		PatientRaportOptimized::updateNativeRaport();
68
-		$conn = $em->getConnection ();
68
+		$conn = $em->getConnection();
69 69
 		$sql3 = "SELECT kategoria, date(data) as data, suma FROM kategoria_view WHERE data between :data1 AND :data2 and oddzialId = :oddzialId";
70
-		$stmt = $conn->prepare ( $sql3 );
71
-		$stmt->execute ( array (
70
+		$stmt = $conn->prepare($sql3);
71
+		$stmt->execute(array(
72 72
 				'data1' => $startDate,
73 73
 				'data2' => $endDate,
74 74
 				'oddzialId' => $wardId 
75
-		) );
75
+		));
76 76
 		$result = $stmt->fetchAll();
77
-		$table = array ();
78
-		foreach ( $result as $row ) {
77
+		$table = array();
78
+		foreach ($result as $row) {
79 79
 			$table [$row ['data']] [$row ['kategoria']] = $row ['suma'];
80 80
 		}
81 81
 		return $table;
Please login to merge, or discard this patch.
src/Entities/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 		return $this;
83 83
 	}
84 84
 	public function toString() {
85
-		return $this->getId() . $this->getName() . $this->getWard();
85
+		return $this->getId().$this->getName().$this->getWard();
86 86
 	}
87 87
 }
88 88
 
Please login to merge, or discard this patch.
src/Entities/Ward.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	private $users;
115 115
 	public function __construct() {
116
-		$this->users = new ArrayCollection ();
116
+		$this->users = new ArrayCollection();
117 117
 	}
118 118
 	
119 119
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @return string
123 123
 	 */
124 124
 	public function __toString() {
125
-		return $this->getName ();
125
+		return $this->getName();
126 126
 	}
127 127
 	public function getId() {
128 128
 		return $this->id;
Please login to merge, or discard this patch.
src/Twig/GetPropertiesExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
             return array();
26 26
         }
27 27
         $class = new \ReflectionClass($class);
28
-        $properties = array_filter($class->getProperties(), function ($prop) use($class)
28
+        $properties = array_filter($class->getProperties(), function($prop) use($class)
29 29
         {
30 30
             return $prop->getDeclaringClass()->name == $class->name;
31 31
         });
Please login to merge, or discard this patch.
src/Twig/PLTwig.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@
 block discarded – undo
12 12
 	 * @return void|\Twig_Environment
13 13
 	 */
14 14
 	public static function load($viewsDir) {
15
-		if (! class_exists ( 'Twig_Loader_Filesystem' )) {
15
+		if (!class_exists('Twig_Loader_Filesystem')) {
16 16
 			echo 'Twig not activated. Make sure you activate the plugin in
17 17
     <a href="/wp-admin/plugins.php#timber">/wp-admin/plugins.php</a>';
18 18
 			return;
19 19
 		}
20
-		\Twig_Autoloader::register ();
20
+		\Twig_Autoloader::register();
21 21
 		try {
22
-			$loader = new \Twig_Loader_Filesystem ( $viewsDir );
23
-			$twig = new \Twig_Environment ( $loader, array () );
22
+			$loader = new \Twig_Loader_Filesystem($viewsDir);
23
+			$twig = new \Twig_Environment($loader, array());
24 24
 			// 'debug' => true
25 25
 			// 'cache' => '/tmp/'
26
-			$twig->getExtension ( 'core' )->setTimezone ( 'Europe/Warsaw' ); //
27
-			$twig->addExtension ( new EscapePLCharsExtension () );
26
+			$twig->getExtension('core')->setTimezone('Europe/Warsaw'); //
27
+			$twig->addExtension(new EscapePLCharsExtension());
28 28
 			return $twig;
29
-		} catch ( Exception $e ) {
30
-			echo "ERR: " . $e;
29
+		} catch (Exception $e) {
30
+			echo "ERR: ".$e;
31 31
 		}
32 32
 	}
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
src/utils/ExcelExport.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -10,60 +10,60 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 */
12 12
 	public static function init() {
13
-		add_action ( 'admin_init', array (
13
+		add_action('admin_init', array(
14 14
 				'Hospitalplugin\utils\ExcelExport',
15 15
 				'excel_export' 
16
-		), 1 );
16
+		), 1);
17 17
 	}
18 18
 	/**
19 19
 	 * 
20 20
 	 */
21 21
 	public static function getColumnLetter($num) {
22
-		return chr ( 65 + $num );
22
+		return chr(65 + $num);
23 23
 	}
24 24
 	/**
25 25
 	 */
26 26
 	static function excel_export() {
27
-		if (! isset ( $_POST ['excel'] )) {
27
+		if (!isset ($_POST ['excel'])) {
28 28
 			return;
29 29
 		} else {
30 30
 			// dataSetName: Infections, Punction
31 31
 			$dataSetName = $_POST ['dataSetName'];
32
-			$classname = '\Hospitalplugin\utils\ExcelExport' . $dataSetName;
32
+			$classname = '\Hospitalplugin\utils\ExcelExport'.$dataSetName;
33 33
 		}
34 34
 		
35
-		$objPHPExcel = new \PHPExcel ();
36
-		$classname::fillData ( $objPHPExcel );
35
+		$objPHPExcel = new \PHPExcel();
36
+		$classname::fillData($objPHPExcel);
37 37
 		
38
-		ExcelExport::downloadExcel ( $objPHPExcel, $dataSetName . '.xlsx' );
38
+		ExcelExport::downloadExcel($objPHPExcel, $dataSetName.'.xlsx');
39 39
 	}
40 40
 	/**
41 41
 	 */
42 42
 	static function cellColor($objPHPExcel, $cells, $color) {
43
-		$objPHPExcel->getActiveSheet ()->getStyle ( $cells )->getFill ()->applyFromArray ( array (
43
+		$objPHPExcel->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
44 44
 				'type' => \PHPExcel_Style_Fill::FILL_SOLID,
45
-				'startcolor' => array (
45
+				'startcolor' => array(
46 46
 						'rgb' => $color 
47 47
 				) 
48
-		) );
48
+		));
49 49
 	}
50 50
 	/**
51 51
 	 */
52 52
 	static function styleActiveSheet($objPHPExcel) {
53
-		$objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getFont ()->setName ( 'Arial' )->setSize ( 8 )->setBold ( false );
54
-		$objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getNumberFormat ()->setFormatCode ( \PHPExcel_Style_NumberFormat::FORMAT_TEXT );
55
-		$objPHPExcel->getActiveSheet ()->freezePane ( 'A3' );
56
-		$style = array (
57
-				'alignment' => array (
53
+		$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Arial')->setSize(8)->setBold(false);
54
+		$objPHPExcel->getActiveSheet()->getDefaultStyle()->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
55
+		$objPHPExcel->getActiveSheet()->freezePane('A3');
56
+		$style = array(
57
+				'alignment' => array(
58 58
 						'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
59 59
 						'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER 
60 60
 				) 
61 61
 		);
62
-		$objWorksheet = $objPHPExcel->getActiveSheet ();
63
-		$objWorksheet->getDefaultStyle ()->applyFromArray ( $style );
64
-		$objWorksheet->getStyle ( 'A1:AA2' )->getFont ()->setBold ( true );
65
-		for($col = ord ( 'a' ); $col <= ord ( 'z' ); $col ++) {
66
-			$objWorksheet->getColumnDimension ( chr ( $col ) )->setAutoSize ( true );
62
+		$objWorksheet = $objPHPExcel->getActiveSheet();
63
+		$objWorksheet->getDefaultStyle()->applyFromArray($style);
64
+		$objWorksheet->getStyle('A1:AA2')->getFont()->setBold(true);
65
+		for ($col = ord('a'); $col <= ord('z'); $col ++) {
66
+			$objWorksheet->getColumnDimension(chr($col))->setAutoSize(true);
67 67
 		}
68 68
 		return $objPHPExcel;
69 69
 	}
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 * @param unknown $objPHPExcel        	
73 73
 	 */
74 74
 	private static function downloadExcel($objPHPExcel, $filename) {
75
-		ob_end_clean ();
76
-		ob_start ();
77
-		header ( "Content-type: application/vnd.ms-excel; charset=utf-8" );
78
-		header ( "Content-Transfer-Encoding: binary" );
79
-		header ( "Content-Description: File Transfer" );
80
-		header ( "Content-Disposition: attachment; filename=\"" . $filename . "\"" );
81
-		header ( "Cache-Control: max-age=0" );
82
-		header ( "Expires: 0" );
83
-		header ( "Pragma: no-cache" );
75
+		ob_end_clean();
76
+		ob_start();
77
+		header("Content-type: application/vnd.ms-excel; charset=utf-8");
78
+		header("Content-Transfer-Encoding: binary");
79
+		header("Content-Description: File Transfer");
80
+		header("Content-Disposition: attachment; filename=\"".$filename."\"");
81
+		header("Cache-Control: max-age=0");
82
+		header("Expires: 0");
83
+		header("Pragma: no-cache");
84 84
 		
85
-		$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel2007' );
86
-		$objWriter->setPreCalculateFormulas ( true );
87
-		$objWriter->save ( 'php://output' );
85
+		$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
86
+		$objWriter->setPreCalculateFormulas(true);
87
+		$objWriter->save('php://output');
88 88
 		exit ();
89 89
 	}
90 90
 	/**
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 	 * @param unknown $string        	
93 93
 	 */
94 94
 	private static function clearName($string, $removeWords) {
95
-		$string = str_replace ( ' ', '-', $string );
96
-		$string = preg_replace ( '/[^A-Za-z0-9\-]/', '', $string );
97
-		foreach ( $removeWords as $word ) {
98
-			$string = str_replace ( $word, '', $string );
95
+		$string = str_replace(' ', '-', $string);
96
+		$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string);
97
+		foreach ($removeWords as $word) {
98
+			$string = str_replace($word, '', $string);
99 99
 		}
100
-		$string = substr ( $string, 0, 29 );
100
+		$string = substr($string, 0, 29);
101 101
 		return $string;
102 102
 	}
103 103
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param unknown $title        	
106 106
 	 */
107 107
 	static function printTitle($objPHPExcel, $title) {
108
-		$objPHPExcel->getActiveSheet ()->setTitle ( ExcelExport::clearName ( $title, array('ddzia') ), true );
109
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
108
+		$objPHPExcel->getActiveSheet()->setTitle(ExcelExport::clearName($title, array('ddzia')), true);
109
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, $title);
110 110
 	}
111 111
 	/**
112 112
 	 *
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	static function newSheet($objPHPExcel, $index = -1) {
116 116
 		if ($index < 0) {
117
-			$index = $objPHPExcel->getSheetCount ();
117
+			$index = $objPHPExcel->getSheetCount();
118 118
 		}
119
-		$objPHPExcel->createSheet ( $index );
120
-		$objPHPExcel->setActiveSheetIndex ( $index );
121
-		$sheet = $objPHPExcel->getActiveSheet ();
119
+		$objPHPExcel->createSheet($index);
120
+		$objPHPExcel->setActiveSheetIndex($index);
121
+		$sheet = $objPHPExcel->getActiveSheet();
122 122
 		return $sheet;
123 123
 	}
124 124
 	
Please login to merge, or discard this patch.
src/utils/ExcelExportInfections.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@
 block discarded – undo
7 7
 
8 8
 class ExcelExportInfections {
9 9
 	private static function getData() {
10
-		$wardId = (! empty ( $_POST ['wardId'] ) ? $_POST ['wardId'] : 0);
11
-		$date = (! empty ( $_POST ['date'] ) ? $_POST ['date'] : (new \DateTime ())->format ( "Y-m" ));
12
-		$from = new \DateTime ( $date . '-01' );
13
-		$fromStr = $from->format ( 'Y-m-01' );
14
-		$toStr = $from->format ( 'Y-m-t' );
15
-		$infections = InfectionsCRUD::getInfections ( $fromStr, $toStr, $wardId, 'Infections' );
10
+		$wardId = (!empty ($_POST ['wardId']) ? $_POST ['wardId'] : 0);
11
+		$date = (!empty ($_POST ['date']) ? $_POST ['date'] : (new \DateTime())->format("Y-m"));
12
+		$from = new \DateTime($date.'-01');
13
+		$fromStr = $from->format('Y-m-01');
14
+		$toStr = $from->format('Y-m-t');
15
+		$infections = InfectionsCRUD::getInfections($fromStr, $toStr, $wardId, 'Infections');
16 16
 		return $infections;
17 17
 	}
18 18
 	private static function getColumns() {
19
-		return Infections::getFields ();
19
+		return Infections::getFields();
20 20
 	}
21 21
 	private static function printHeaders($objPHPExcel, $cols) {
22 22
 		$count = 0;
23
-		foreach ( $cols as $col => $sym ) {
24
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
23
+		foreach ($cols as $col => $sym) {
24
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, 2, sprintf("%7s", $col));
25 25
 		}
26 26
 	}
27 27
 	/**
28 28
 	 */
29 29
 	private static function printData($objPHPExcel, $data, $cols) {
30 30
 		$row = 3;
31
-		foreach ( $data as $rowValue ) {
31
+		foreach ($data as $rowValue) {
32 32
 			$count = 0;
33
-			foreach ( $cols as $col => $sym ) {
33
+			foreach ($cols as $col => $sym) {
34 34
 				$value = $rowValue->$sym;
35
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
35
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, $value);
36 36
 			}
37 37
 			$row ++;
38 38
 		}
39 39
 		return $row;
40 40
 	}
41 41
 	private static function printTitle($objPHPExcel, $title) {
42
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
42
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, $title);
43 43
 	}
44 44
 	/**
45 45
 	 *
46 46
 	 * @param PHPExcel $objPHPExcel        	
47 47
 	 */
48 48
 	private static function printFooter($objPHPExcel, $cols, $row) {
49
-		$objPHPExcel->getActiveSheet ()->getStyle ( 'A' . $row . ':AA' . ($row + 1) )->getFont ()->setBold ( true );
49
+		$objPHPExcel->getActiveSheet()->getStyle('A'.$row.':AA'.($row + 1))->getFont()->setBold(true);
50 50
 		// SUM
51
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, $row, "SUMA" );
52
-		for($i = 2; $i < count ( $cols ); $i ++) {
53
-			$colLetter = chr ( 65 + $i );
54
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $i, $row, "=sum(" . $colLetter . "3" . ":" . $colLetter . ($row - 1) . ")" );
51
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, "SUMA");
52
+		for ($i = 2; $i < count($cols); $i ++) {
53
+			$colLetter = chr(65 + $i);
54
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, $row, "=sum(".$colLetter."3".":".$colLetter.($row - 1).")");
55 55
 		}
56
-		ExcelExport::cellColor ( $objPHPExcel, 'A' . $row . ':AA' . ($row + 1), 'DDDDDD' );
56
+		ExcelExport::cellColor($objPHPExcel, 'A'.$row.':AA'.($row + 1), 'DDDDDD');
57 57
 	}
58 58
 	static function fillData($objPHPExcel) {
59
-		$data = ExcelExportInfections::getData ();
60
-		$cols = ExcelExportInfections::getColumns ();
59
+		$data = ExcelExportInfections::getData();
60
+		$cols = ExcelExportInfections::getColumns();
61 61
 		
62
-		ExcelExportInfections::printTitle ( $objPHPExcel, "Raport" );
63
-		ExcelExportInfections::printHeaders ( $objPHPExcel, $cols );
64
-		$lastRow = ExcelExportInfections::printData ( $objPHPExcel, $data, $cols );
65
-		ExcelExportInfections::printFooter ( $objPHPExcel, $cols, $lastRow );
62
+		ExcelExportInfections::printTitle($objPHPExcel, "Raport");
63
+		ExcelExportInfections::printHeaders($objPHPExcel, $cols);
64
+		$lastRow = ExcelExportInfections::printData($objPHPExcel, $data, $cols);
65
+		ExcelExportInfections::printFooter($objPHPExcel, $cols, $lastRow);
66 66
 	}
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/utils/ExcelExportPunction.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 * @param unknown $id        	
15 15
 	 */
16 16
 	private static function getData($id, $type) {
17
-		$raport = PatientRaport::getRaportBetweenDates ( $id, $type, '2014-06-01', (new \DateTime ())->format ( "Y-m-d" ) );
17
+		$raport = PatientRaport::getRaportBetweenDates($id, $type, '2014-06-01', (new \DateTime())->format("Y-m-d"));
18 18
 		return $raport;
19 19
 	}
20 20
 	/**
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	private static function printHeaders($objPHPExcel, $cols) {
26 26
 		$count = 1;
27
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 2, "Data" );
28
-		foreach ( $cols as $col ) {
29
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
27
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 2, "Data");
28
+		foreach ($cols as $col) {
29
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, 2, sprintf("%7s", $col));
30 30
 		}
31 31
 	}
32 32
 	/**
@@ -34,45 +34,45 @@  discard block
 block discarded – undo
34 34
 	private static function printData($objPHPExcel, $data, $type) {
35 35
 		$row = 3;
36 36
 		$lastColumn = 1;
37
-		$colNumberOfPatients = ExcelExport::getColumnLetter ( 1 );
38
-		$indexes = PatientRaport::getIndexes ( $type );
39
-		foreach ( $data as $rowKey => $rowValue ) {
37
+		$colNumberOfPatients = ExcelExport::getColumnLetter(1);
38
+		$indexes = PatientRaport::getIndexes($type);
39
+		foreach ($data as $rowKey => $rowValue) {
40 40
 			// 1 col: date
41
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row, json_encode ( $rowKey ) );
41
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, json_encode($rowKey));
42 42
 			$count = 1;
43 43
 			// 2-5 cols: N1 N2 N3 N0
44
-			foreach ( $indexes as $index ) {
45
-				$value = isset ( $rowValue [$index] ) ? $rowValue [$index] : "0";
46
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
44
+			foreach ($indexes as $index) {
45
+				$value = isset ($rowValue [$index]) ? $rowValue [$index] : "0";
46
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, $value);
47 47
 			}
48 48
 			// 6 col: num of categorized (N = N1+N2+N3)
49
-			$colHighestCategory = ExcelExport::getColumnLetter ( $count - 2 );
50
-			$colNumberOfPatients = ExcelExport::getColumnLetter ( $count );
51
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(B' . $row . ':' . $colHighestCategory . $row . ')' );
52
-			$tpb = PatientRaport::getTpb ( $type );
49
+			$colHighestCategory = ExcelExport::getColumnLetter($count - 2);
50
+			$colNumberOfPatients = ExcelExport::getColumnLetter($count);
51
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, '=SUM(B'.$row.':'.$colHighestCategory.$row.')');
52
+			$tpb = PatientRaport::getTpb($type);
53 53
 			// 7-11 tpb1, tpb2, tpb3, 0 (no-cat), 2 (add)
54
-			foreach ( $tpb as $tpbn ) {
55
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $tpbn );
54
+			foreach ($tpb as $tpbn) {
55
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, $tpbn);
56 56
 			}
57 57
 			// 9-11: Tpb1*N1,Tpb2*N2,Tpb3*N3+2xN
58
-			$tpbSize = count ( $tpb );
59
-			foreach ( $tpb as $tpbn ) {
60
-				$col1Letter = ExcelExport::getColumnLetter ( $count - 2 * $tpbSize );
61
-				$col2Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
62
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=' . $col1Letter . $row . "*" . $col2Letter . $row );
58
+			$tpbSize = count($tpb);
59
+			foreach ($tpb as $tpbn) {
60
+				$col1Letter = ExcelExport::getColumnLetter($count - 2 * $tpbSize);
61
+				$col2Letter = ExcelExport::getColumnLetter($count - $tpbSize);
62
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, '='.$col1Letter.$row."*".$col2Letter.$row);
63 63
 			}
64 64
 			// SUM Tpb
65
-			$col3Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
66
-			$col4Letter = ExcelExport::getColumnLetter ( $count - 1 );
67
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(' . $col3Letter . $row . ":" . $col4Letter . $row . ")" );
65
+			$col3Letter = ExcelExport::getColumnLetter($count - $tpbSize);
66
+			$col4Letter = ExcelExport::getColumnLetter($count - 1);
67
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count ++, $row, '=SUM('.$col3Letter.$row.":".$col4Letter.$row.")");
68 68
 			$row ++;
69 69
 			$lastColumn = $count - 1;
70 70
 		}
71 71
 		// number of categorization days
72
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, 1, '=COUNTIFS(' . $colNumberOfPatients . '3:' . $colNumberOfPatients . ($row - 1) . ',">0")' );
72
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, '=COUNTIFS('.$colNumberOfPatients.'3:'.$colNumberOfPatients.($row - 1).',">0")');
73 73
 		// sum
74
-		$col5Letter = ExcelExport::getColumnLetter ( $lastColumn );
75
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 2, 1, '=SUM(' . $col5Letter . '3:' . $col5Letter . ($row - 1) . ')/60' );
74
+		$col5Letter = ExcelExport::getColumnLetter($lastColumn);
75
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, '=SUM('.$col5Letter.'3:'.$col5Letter.($row - 1).')/60');
76 76
 		return $row;
77 77
 	}
78 78
 	
@@ -81,61 +81,61 @@  discard block
 block discarded – undo
81 81
 	 * @param unknown $objPHPExcel        	
82 82
 	 */
83 83
 	static function fillSummary($objPHPExcel) {
84
-		ExcelExport::newSheet ( $objPHPExcel, 0 );
85
-		ExcelExport::printTitle ( $objPHPExcel, "Raport" );
86
-		$sheetCount = $objPHPExcel->getSheetCount ();
87
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'A2', 'Oddz.' );
88
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'B2', 'Dni' );
89
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'C2', 'Tpb' );
90
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'D2', 'Tśpb' );
91
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'E2', 'Tśpc*' );
92
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'F2', 'Tśpc**' );
93
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'G2', 'Td***' );
94
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'H2', 'Le*' );
95
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'I2', 'Le**' );
96
-		for($i = 1; $i < $sheetCount; $i ++) {
97
-			$loadedSheetNames = $objPHPExcel->getSheetNames ();
98
-			foreach ( $loadedSheetNames as $sheetIndex => $loadedSheetName ) {
84
+		ExcelExport::newSheet($objPHPExcel, 0);
85
+		ExcelExport::printTitle($objPHPExcel, "Raport");
86
+		$sheetCount = $objPHPExcel->getSheetCount();
87
+		$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Oddz.');
88
+		$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Dni');
89
+		$objPHPExcel->getActiveSheet()->setCellValue('C2', 'Tpb');
90
+		$objPHPExcel->getActiveSheet()->setCellValue('D2', 'Tśpb');
91
+		$objPHPExcel->getActiveSheet()->setCellValue('E2', 'Tśpc*');
92
+		$objPHPExcel->getActiveSheet()->setCellValue('F2', 'Tśpc**');
93
+		$objPHPExcel->getActiveSheet()->setCellValue('G2', 'Td***');
94
+		$objPHPExcel->getActiveSheet()->setCellValue('H2', 'Le*');
95
+		$objPHPExcel->getActiveSheet()->setCellValue('I2', 'Le**');
96
+		for ($i = 1; $i < $sheetCount; $i ++) {
97
+			$loadedSheetNames = $objPHPExcel->getSheetNames();
98
+			foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
99 99
 				if ($sheetIndex == 0) {
100 100
 					continue;
101 101
 				}
102 102
 				$row = $sheetIndex + 2;
103
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, "='" . $loadedSheetName . "'!A1" );
104
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, "='" . $loadedSheetName . "'!B1" );
105
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, "='" . $loadedSheetName . "'!C1" );
106
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 3, $row, "=IF(C" . $row . ">0,C" . $row . "/B" . $row . ",0)" );
107
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 4, $row, "=D" . $row . "*110%" );
108
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 5, $row, "=D" . $row . "*125%" );
109
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 6, $row, "1531" );
110
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 7, $row, "=IF(E" . $row . ">0,E" . $row . "*365/G" . $row . ",\"-\")" );
111
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 8, $row, "=IF(F" . $row . ">0,F" . $row . "*365/G" . $row . ",\"-\")" );
103
+				$objPHPExcel->getActiveSheet()->setCellValue('A'.$row, "='".$loadedSheetName."'!A1");
104
+				$objPHPExcel->getActiveSheet()->setCellValue('B'.$row, "='".$loadedSheetName."'!B1");
105
+				$objPHPExcel->getActiveSheet()->setCellValue('C'.$row, "='".$loadedSheetName."'!C1");
106
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, "=IF(C".$row.">0,C".$row."/B".$row.",0)");
107
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, "=D".$row."*110%");
108
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, "=D".$row."*125%");
109
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, "1531");
110
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, "=IF(E".$row.">0,E".$row."*365/G".$row.",\"-\")");
111
+				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, "=IF(F".$row.">0,F".$row."*365/G".$row.",\"-\")");
112 112
 			}
113
-			$objPHPExcel->getActiveSheet ()->getStyle ( 'C3:I100' )->getNumberFormat ()->setFormatCode ( '#,##0.0' );
114
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej" );
115
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej" );
116
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h" );
117
-			ExcelExport::styleActiveSheet ( $objPHPExcel );
113
+			$objPHPExcel->getActiveSheet()->getStyle('C3:I100')->getNumberFormat()->setFormatCode('#,##0.0');
114
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej");
115
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej");
116
+			$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h");
117
+			ExcelExport::styleActiveSheet($objPHPExcel);
118 118
 		}
119 119
 	}
120 120
 	static function fillData($objPHPExcel) {
121 121
 		// no time limit for this script
122
-		set_time_limit ( 0 );
123
-		$time_start = microtime ( true );
122
+		set_time_limit(0);
123
+		$time_start = microtime(true);
124 124
 		// remove first default sheet
125
-		$objPHPExcel->removeSheetByIndex ( 0 );
125
+		$objPHPExcel->removeSheetByIndex(0);
126 126
 		// get wards
127
-		$wards = WardCRUD::getWardsArray ();
128
-		foreach ( $wards as $ward ) {
129
-			ExcelExport::newSheet ( $objPHPExcel );
130
-			$wardName = $ward->name . " (" . $ward->getTypOddzialu () . ")";
131
-			ExcelExport::printTitle ( $objPHPExcel, $wardName );
132
-			$data = ExcelExportPunction::getData ( $ward->id, $ward->getTypOddzialu () );
133
-			$cols = PatientRaport::getColumns ( $ward->getTypOddzialu () );
134
-			ExcelExportPunction::printHeaders ( $objPHPExcel, $cols );
135
-			ExcelExportPunction::printData ( $objPHPExcel, $data, $ward->getTypOddzialu () );
136
-			ExcelExport::styleActiveSheet ( $objPHPExcel );
127
+		$wards = WardCRUD::getWardsArray();
128
+		foreach ($wards as $ward) {
129
+			ExcelExport::newSheet($objPHPExcel);
130
+			$wardName = $ward->name." (".$ward->getTypOddzialu().")";
131
+			ExcelExport::printTitle($objPHPExcel, $wardName);
132
+			$data = ExcelExportPunction::getData($ward->id, $ward->getTypOddzialu());
133
+			$cols = PatientRaport::getColumns($ward->getTypOddzialu());
134
+			ExcelExportPunction::printHeaders($objPHPExcel, $cols);
135
+			ExcelExportPunction::printData($objPHPExcel, $data, $ward->getTypOddzialu());
136
+			ExcelExport::styleActiveSheet($objPHPExcel);
137 137
 		}
138
-		ExcelExportPunction::fillSummary ( $objPHPExcel );
139
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 100, "summary " . ($time_start - microtime ( true )) . " s" );
138
+		ExcelExportPunction::fillSummary($objPHPExcel);
139
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 100, "summary ".($time_start - microtime(true))." s");
140 140
 	}
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.