1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MÓDULO DE EMISIÓN ELECTRÓNICA F72X |
5
|
|
|
* UBL 2.1 |
6
|
|
|
* Version 1.1 |
7
|
|
|
* |
8
|
|
|
* Copyright 2018, Jaime Cruz |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace F72X\Sunat; |
12
|
|
|
|
13
|
|
|
class Operations { |
14
|
|
|
|
15
|
|
|
public static function formatAmount($amount, $decimals = 2) { |
16
|
|
|
return number_format($amount, $decimals, '.', ''); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* |
21
|
|
|
* @param float $amount |
22
|
|
|
* @param array $allowances |
23
|
|
|
* @param array $charges |
24
|
|
|
* @return float |
25
|
|
|
*/ |
26
|
|
|
public static function applyAllowancesAndCharges($amount, $allowances = [], $charges = []) { |
27
|
|
|
if (!$amount) { |
28
|
|
|
return 0; |
29
|
|
|
} |
30
|
|
|
$totalAllowances = 0; |
31
|
|
|
$totalCharges = 0; |
32
|
|
|
foreach ($allowances as $allowanceItem) { |
33
|
|
|
$k = $allowanceItem['multiplierFactor']; |
34
|
|
|
$totalAllowances += $amount * $k; |
35
|
|
|
} |
36
|
|
|
foreach ($charges as $chargeItem) { |
37
|
|
|
$k = $chargeItem['multiplierFactor']; |
38
|
|
|
$totalCharges += $amount * $k; |
39
|
|
|
} |
40
|
|
|
return $amount - $totalAllowances + $totalCharges; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public static function getTotalAllowanceCharge($amount, $items = []) { |
44
|
|
|
$total = 0; |
45
|
|
|
foreach ($items as $item) { |
46
|
|
|
$k = $item['multiplierFactor']; |
47
|
|
|
$total += $amount * $k; |
48
|
|
|
} |
49
|
|
|
return $total; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Calcular IGV |
54
|
|
|
* @param float $baseAmount |
55
|
|
|
* @return float |
56
|
|
|
*/ |
57
|
|
|
public static function calcIGV($baseAmount) { |
58
|
|
|
return $baseAmount * SunatVars::IGV; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Calcular ISC |
63
|
|
|
* @IMP |
64
|
|
|
* @return float |
65
|
|
|
*/ |
66
|
|
|
public static function calcISC() { |
67
|
|
|
return 0; |
68
|
|
|
} |
69
|
|
|
/** |
70
|
|
|
* Calcular IVAP |
71
|
|
|
* @IMP |
72
|
|
|
* @return float |
73
|
|
|
*/ |
74
|
|
|
public static function calcIVAP() { |
75
|
|
|
return 0; |
76
|
|
|
} |
77
|
|
|
/** |
78
|
|
|
* Aplica IGV? |
79
|
|
|
* |
80
|
|
|
* @param type $igvAffectCode @CAT7 |
|
|
|
|
81
|
|
|
* @return boolean |
82
|
|
|
*/ |
83
|
|
|
public static function isIGVAffected($igvAffectCode) { |
84
|
|
|
return ($igvAffectCode === Catalogo::CAT7_GRA_IGV); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths