Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/accounting/YearGateway.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     function findById($id, $load_active = true)
30 30
     {
31 31
         require_once dirname(__FILE__) . '/Year.php';
32
-    	return new Year($this->kernel, $id, $load_active);
32
+        return new Year($this->kernel, $id, $load_active);
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Account.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                     $this->value['vat_account_id'] = 0;
198 198
                 }
199 199
                 $this->value['vat_shorthand'] = $this->value['vat'];
200
-             }
200
+                }
201 201
         }
202 202
 
203 203
         return $this->get('id');
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             $this->error->set('Ikke en tilladt type');
237 237
         }
238 238
 
239
-         $validator->isNumeric($var['use_key'], 'Det kan en konto ikke bruges til');
239
+            $validator->isNumeric($var['use_key'], 'Det kan en konto ikke bruges til');
240 240
 
241 241
         if (!array_key_exists($var['use_key'], $this->use)) {
242 242
             $this->error->set('Ikke en tilladt brug af kontoen');
@@ -642,6 +642,6 @@  discard block
 block discarded – undo
642 642
 
643 643
     public function getNumber()
644 644
     {
645
-    	return $this->get('number');
645
+        return $this->get('number');
646 646
     }
647 647
 }
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Year.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     public function isDateInYear($date)
312 312
     {
313 313
         if ($this->getId() == 0) {
314
-        	throw new Exception('Year has not been loaded yet - maybe not saved');
314
+            throw new Exception('Year has not been loaded yet - maybe not saved');
315 315
         }
316 316
 
317 317
         $date = safeToDb($date);
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
         $db = new Db_Sql;
320 320
         $db->query("SELECT from_date, to_date FROM accounting_year WHERE id= " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id') . " LIMIT 1");
321 321
         if ($db->nextRecord()) {
322
-          if ($db->f('from_date') <= $date AND $date <= $db->f('to_date')) {
323
-              return true;
324
-          }
322
+            if ($db->f('from_date') <= $date AND $date <= $db->f('to_date')) {
323
+                return true;
324
+            }
325 325
         }
326 326
         return false;
327 327
     }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         $balance_accounts = unserialize($this->getSetting('balance_accounts'));
398 398
 
399 399
         if (!is_array($balance_accounts)) {
400
-        	throw new Exception('Balance accounts are not an array');
400
+            throw new Exception('Balance accounts are not an array');
401 401
         }
402 402
 
403 403
         $sql_where = "";
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     function createAccounts($type, $last_year_id = 0)
449 449
     {
450 450
         if ($this->getId() == 0) {
451
-        	throw new Exception('Year has no id');
451
+            throw new Exception('Year has no id');
452 452
         }
453 453
 
454 454
         $last_year_id = (int)$last_year_id;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                     $this->setSetting('buy_abroad_accounts', serialize($buy_abroad));
526 526
                     $this->setSetting('buy_eu_accounts', serialize($buy_eu));
527 527
 
528
-                  break;
528
+                    break;
529 529
             case 'transfer_from_last_year':
530 530
                     // oprette konti
531 531
                     if ($last_year_id == 0) {
@@ -844,6 +844,6 @@  discard block
 block discarded – undo
844 844
 
845 845
     public function getId()
846 846
     {
847
-    	return $this->get('id');
847
+        return $this->get('id');
848 848
     }
849 849
 }
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/VatPeriodGateway.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
 
132 132
     function findFromId($id = 0)
133 133
     {
134
-    	require_once dirname(__FILE__) . '/VatPeriod.php';
134
+        require_once dirname(__FILE__) . '/VatPeriod.php';
135 135
         return new VatPeriod($this->year);
136 136
     }
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/VoucherFile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,5 +104,5 @@
 block discarded – undo
104 104
     {
105 105
         $gateway = new Intraface_modules_accounting_VoucherFileGateway($this->voucher);
106 106
         return $gateway->getList();
107
-   }
107
+    }
108 108
 }
109 109
\ No newline at end of file
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Controller/Vat/Show.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,22 +26,22 @@
 block discarded – undo
26 26
 
27 27
     function renderHtml()
28 28
     {
29
-     	$vat_period = $this->getVatPeriod();
30
-       	$vat_period->loadAmounts();
31
-       	$account_vat_in = $vat_period->get('account_vat_in');
32
-       	$account_vat_out = $vat_period->get('account_vat_out');
33
-       	$account_vat_abroad = $vat_period->get('account_vat_abroad');
34
-       	$saldo_rubrik_a = $vat_period->get('saldo_rubrik_a');
35
-       	$saldo_total = $vat_period->get('saldo_total');
29
+            $vat_period = $this->getVatPeriod();
30
+            $vat_period->loadAmounts();
31
+            $account_vat_in = $vat_period->get('account_vat_in');
32
+            $account_vat_out = $vat_period->get('account_vat_out');
33
+            $account_vat_abroad = $vat_period->get('account_vat_abroad');
34
+            $saldo_rubrik_a = $vat_period->get('saldo_rubrik_a');
35
+            $saldo_total = $vat_period->get('saldo_total');
36 36
 
37
-       	$data = array(
38
-       	    'vat_period' => $vat_period,
39
-       	    'account_vat_in' => $account_vat_in,
40
-       	    'account_vat_out' => $account_vat_out,
41
-       	    'account_vat_abroad' => $account_vat_abroad,
42
-       	    'saldo_rubrik_a' => $saldo_rubrik_a,
43
-       	    'saldo_total' => $saldo_total
44
-       	);
37
+            $data = array(
38
+                'vat_period' => $vat_period,
39
+                'account_vat_in' => $account_vat_in,
40
+                'account_vat_out' => $account_vat_out,
41
+                'account_vat_abroad' => $account_vat_abroad,
42
+                'saldo_rubrik_a' => $saldo_rubrik_a,
43
+                'saldo_total' => $saldo_total
44
+            );
45 45
 
46 46
         $smarty = $this->template->create(dirname(__FILE__) . '/../templates/vat/show');
47 47
         return $smarty->render($this, $data);
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Controller/Vat/Index.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@
 block discarded – undo
47 47
 
48 48
     function postForm()
49 49
     {
50
-    	if (isset($_POST['vat_period_key'])) {
51
-    		$this->getYear()->setSetting('vat_period', $_POST['vat_period_key']);
52
-    	}
53
-    	$vat_period = new VatPeriod($this->getYear());
54
-    	$vat_period->createPeriods();
50
+        if (isset($_POST['vat_period_key'])) {
51
+            $this->getYear()->setSetting('vat_period', $_POST['vat_period_key']);
52
+        }
53
+        $vat_period = new VatPeriod($this->getYear());
54
+        $vat_period->createPeriods();
55 55
 
56
-    	return new k_SeeOther($this->url(null));
56
+        return new k_SeeOther($this->url(null));
57 57
     }
58 58
     
59 59
     function getPeriods()
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Controller/Year/End.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@  discard block
 block discarded – undo
8 8
         $this->template = $template;
9 9
     }
10 10
 
11
-	function renderHtml()
12
-	{
11
+    function renderHtml()
12
+    {
13 13
         $smarty = $this->template->create(dirname(__FILE__) . '/../templates/year/end');
14 14
         return $smarty->render($this);
15
-	}
15
+    }
16 16
 
17 17
     function renderXls()
18 18
     {
19
-    	$module = $this->getKernel()->module('accounting');
19
+        $module = $this->getKernel()->module('accounting');
20 20
         $module->includeFile('YearEnd.php');
21 21
 
22 22
         $kernel = $this->getKernel();
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 
56 56
         $i += 2;
57 57
         if (count($accounts) > 0) {
58
-        	foreach ($accounts AS $account) {
59
-        		$style = '';
60
-        		if ($account['type'] == 'headline') {
61
-        			$style = $format_bold;
62
-        		}
63
-        		elseif ($account['type'] == 'sum') {
64
-        			$style = $format_italic;
65
-        		}
66
-        		else {
67
-        			$style = $format;
68
-        		}
69
-
70
-        		$worksheet->write($i, 0, $account['number'], $style);
71
-        		$worksheet->write($i, 1, $account['name'], $style);
72
-        		if ($account['type'] != 'headline') {
73
-        			$worksheet->write($i, 2, abs(round($account['saldo'])), $style);
74
-        		}
75
-        		$i++;
76
-        	}
58
+            foreach ($accounts AS $account) {
59
+                $style = '';
60
+                if ($account['type'] == 'headline') {
61
+                    $style = $format_bold;
62
+                }
63
+                elseif ($account['type'] == 'sum') {
64
+                    $style = $format_italic;
65
+                }
66
+                else {
67
+                    $style = $format;
68
+                }
69
+
70
+                $worksheet->write($i, 0, $account['number'], $style);
71
+                $worksheet->write($i, 1, $account['name'], $style);
72
+                if ($account['type'] != 'headline') {
73
+                    $worksheet->write($i, 2, abs(round($account['saldo'])), $style);
74
+                }
75
+                $i++;
76
+            }
77 77
         }
78 78
 
79 79
         $accounts = $year_end->getStatement('balance');
@@ -82,25 +82,25 @@  discard block
 block discarded – undo
82 82
 
83 83
         $i += 2;
84 84
         if (count($accounts) > 0) {
85
-        	foreach ($accounts AS $account) {
86
-        		$style = '';
87
-        		if ($account['type'] == 'headline') {
88
-        			$style = $format_bold;
89
-        		}
90
-        		elseif ($account['type'] == 'sum') {
91
-        			$style = $format_italic;
92
-        		}
93
-        		else {
94
-        			$style = $format;
95
-        		}
96
-
97
-        		$worksheet->write($i, 0, $account['number'], $style);
98
-        		$worksheet->write($i, 1, $account['name'], $style);
99
-        		if ($account['type'] != 'headline') {
100
-        			$worksheet->write($i, 2, abs(round($account['saldo'])), $style);
101
-        		}
102
-        		$i++;
103
-        	}
85
+            foreach ($accounts AS $account) {
86
+                $style = '';
87
+                if ($account['type'] == 'headline') {
88
+                    $style = $format_bold;
89
+                }
90
+                elseif ($account['type'] == 'sum') {
91
+                    $style = $format_italic;
92
+                }
93
+                else {
94
+                    $style = $format;
95
+                }
96
+
97
+                $worksheet->write($i, 0, $account['number'], $style);
98
+                $worksheet->write($i, 1, $account['name'], $style);
99
+                if ($account['type'] != 'headline') {
100
+                    $worksheet->write($i, 2, abs(round($account['saldo'])), $style);
101
+                }
102
+                $i++;
103
+            }
104 104
 
105 105
 
106 106
         }
@@ -109,95 +109,95 @@  discard block
 block discarded – undo
109 109
         $workbook->close();
110 110
     }
111 111
     
112
-	function postForm()
113
-	{
112
+    function postForm()
113
+    {
114 114
         $year = $this->getYear();
115 115
         $account = new Account($year);
116 116
         $year_end = new YearEnd($year);
117 117
         $post = new Post(new Voucher($year));
118 118
         $vat_period = new VatPeriod($year);
119 119
 
120
-	    // These makes it possible to switch between steps
120
+        // These makes it possible to switch between steps
121 121
         if (!empty($_POST['previous'])) {
122
-        	$year_end = new YearEnd($year);
123
-        	$year_end->setStep($_POST['step'] - 2);
122
+            $year_end = new YearEnd($year);
123
+            $year_end->setStep($_POST['step'] - 2);
124 124
 
125 125
         }
126 126
         elseif (!empty($_POST['next'])) {
127
-        	$year_end = new YearEnd($year);
128
-        	$year_end->setStep($_POST['step']);
127
+            $year_end = new YearEnd($year);
128
+            $year_end->setStep($_POST['step']);
129 129
         }
130 130
 
131 131
         // reacts to the different steps
132 132
         if (!empty($_POST['step_save_result'])) {
133
-        	$year_end = new YearEnd($year);
133
+            $year_end = new YearEnd($year);
134 134
 
135
-        	if (!$year_end->saveStatement('operating')) {
136
-        		throw new Exception('Kunne ikke gemme resultatopgørelsen');
137
-        	}
138
-        	// @todo save "resultatopgørelsen"
135
+            if (!$year_end->saveStatement('operating')) {
136
+                throw new Exception('Kunne ikke gemme resultatopgørelsen');
137
+            }
138
+            // @todo save "resultatopgørelsen"
139 139
 
140
-        	$year_end->setStep($_POST['step']);
140
+            $year_end->setStep($_POST['step']);
141 141
         }
142 142
 
143 143
         elseif (!empty($_POST['step_save_balance'])) {
144
-        	$year_end = new YearEnd($year);
144
+            $year_end = new YearEnd($year);
145 145
 
146
-        	if (!$year_end->saveStatement('balance')) {
147
-        		throw new Exception('Kunne ikke gemme balancen');
148
-        	}
146
+            if (!$year_end->saveStatement('balance')) {
147
+                throw new Exception('Kunne ikke gemme balancen');
148
+            }
149 149
 
150
-        	$year_end->setStep($_POST['step']);
150
+            $year_end->setStep($_POST['step']);
151 151
         }
152 152
         elseif (!empty($_POST['step_transfer_result'])) {
153
-        	$year_end = new YearEnd($year);
153
+            $year_end = new YearEnd($year);
154 154
 
155
-        	if (!$year_end->resetYearResult()) {
156
-        		throw new Exception('Kunne ikke nulstille årets resultat');
157
-        	}
155
+            if (!$year_end->resetYearResult()) {
156
+                throw new Exception('Kunne ikke nulstille årets resultat');
157
+            }
158 158
 
159
-        	$year_end->setStep($_POST['step']);
159
+            $year_end->setStep($_POST['step']);
160 160
         }
161 161
         elseif (!empty($_POST['step_reverse_result_account_reset'])) {
162
-        	$year_end = new YearEnd($year);
163
-        	if (!$year_end->resetYearResult('reverse')) {
164
-        		echo $year_end->error->view();
165
-        		throw new Exception('Kunne ikke tilbageføre årets resultat');
166
-        	}
167
-        	$year_end->setStep($_POST['step'] - 1);
162
+            $year_end = new YearEnd($year);
163
+            if (!$year_end->resetYearResult('reverse')) {
164
+                echo $year_end->error->view();
165
+                throw new Exception('Kunne ikke tilbageføre årets resultat');
166
+            }
167
+            $year_end->setStep($_POST['step'] - 1);
168 168
         }
169 169
 
170 170
         // step 1
171 171
         elseif (!empty($_POST['step_things_stated'])) {
172
-        	$year_end = new YearEnd($year);
173
-        	$year_end->setStep($_POST['step']);
172
+            $year_end = new YearEnd($year);
173
+            $year_end->setStep($_POST['step']);
174 174
         }
175 175
 
176 176
         // transfer "resultatopgørelsen"
177 177
         elseif (!empty($_POST['step_result'])) {
178
-        	$year_end = new YearEnd($year);
179
-        	$account = new Account($year);
180
-        	$year->setSetting('result_account_id', $_POST['result_account_id']);
181
-
182
-        	if ($year_end->resetOperatingAccounts()) {
183
-        		$year_end->setStep($_POST['step']);
184
-        	} else {
185
-        		echo $year_end->error->view();
186
-        	}
178
+            $year_end = new YearEnd($year);
179
+            $account = new Account($year);
180
+            $year->setSetting('result_account_id', $_POST['result_account_id']);
181
+
182
+            if ($year_end->resetOperatingAccounts()) {
183
+                $year_end->setStep($_POST['step']);
184
+            } else {
185
+                echo $year_end->error->view();
186
+            }
187 187
         } elseif (!empty($_POST['step_lock_year'])) {
188
-        	if (!empty($_POST['lock']) AND $_POST['lock'] == '1') {
189
-        		$year->lock();
190
-        	}
191
-        	$year_end = new YearEnd($year);
192
-        	$year_end->setStep($_POST['step']);
188
+            if (!empty($_POST['lock']) AND $_POST['lock'] == '1') {
189
+                $year->lock();
190
+            }
191
+            $year_end = new YearEnd($year);
192
+            $year_end->setStep($_POST['step']);
193 193
         } elseif (!empty($_POST['step_reverse_result_reset'])) {
194
-        	$year_end = new YearEnd($year);
195
-        	$year_end->resetOperatingAccounts('reverse');
196
-        	$year_end->setStep($_POST['step'] - 1);
194
+            $year_end = new YearEnd($year);
195
+            $year_end->resetOperatingAccounts('reverse');
196
+            $year_end->setStep($_POST['step'] - 1);
197 197
         }
198 198
 
199 199
         return $this->render();
200
-	}
200
+    }
201 201
 
202 202
     function getAccount()
203 203
     {
@@ -205,28 +205,28 @@  discard block
 block discarded – undo
205 205
         return $account = new Account($year);
206 206
     }
207 207
 
208
-	function getPost()
209
-	{
208
+    function getPost()
209
+    {
210 210
         return $post = new Post(new Voucher($this->getYear()));
211
-	}
211
+    }
212 212
 
213
-	function getVatPeriod()
214
-	{
213
+    function getVatPeriod()
214
+    {
215 215
         return $vat_period = new VatPeriod($this->getYear());
216
-	}
216
+    }
217 217
 
218
-	function getYearEnd()
219
-	{
218
+    function getYearEnd()
219
+    {
220 220
         return $year_end = new YearEnd($this->getYear());
221
-	}
221
+    }
222 222
 
223
-	function getYear()
224
-	{
225
-	    return $this->context->getYear();
226
-	}
223
+    function getYear()
224
+    {
225
+        return $this->context->getYear();
226
+    }
227 227
 
228
-	function getKernel()
229
-	{
230
-	    return $this->context->getKernel();
231
-	}
228
+    function getKernel()
229
+    {
230
+        return $this->context->getKernel();
231
+    }
232 232
 }
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Controller/Year/Show.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,17 +95,17 @@
 block discarded – undo
95 95
 
96 96
     function getYears()
97 97
     {
98
-    	return $this->getYear()->getList();
98
+        return $this->getYear()->getList();
99 99
     }
100 100
 
101 101
     function getAccount()
102 102
     {
103
-    	return new Account($this->getYear());
103
+        return new Account($this->getYear());
104 104
     }
105 105
 
106 106
     function getVatPeriod()
107 107
     {
108
-    	return new VatPeriod($this->getYear());
108
+        return new VatPeriod($this->getYear());
109 109
     }
110 110
 
111 111
     function getYearGateway()
Please login to merge, or discard this patch.