@@ -47,7 +47,8 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @return \Doctrine\ORM\QueryBuilder |
| 49 | 49 | */ |
| 50 | - public function findOrders() { |
|
| 50 | + public function findOrders() |
|
| 51 | + { |
|
| 51 | 52 | $query = $this->findActive() |
| 52 | 53 | ->andWhere('o.delivdate > :date') |
| 53 | 54 | ->setParameter('date', date('Y-m-d')); |
@@ -60,7 +61,8 @@ discard block |
||
| 60 | 61 | * |
| 61 | 62 | * @return \Doctrine\ORM\QueryBuilder |
| 62 | 63 | */ |
| 63 | - public function findDeliveries() { |
|
| 64 | + public function findDeliveries() |
|
| 65 | + { |
|
| 64 | 66 | $query = $this->findActive() |
| 65 | 67 | ->andWhere('o.delivdate <= :date') |
| 66 | 68 | ->setParameter('date', date('Y-m-d')); |
@@ -68,7 +70,8 @@ discard block |
||
| 68 | 70 | return $query; |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | - private function findActive() { |
|
| 73 | + private function findActive() |
|
| 74 | + { |
|
| 72 | 75 | $query = $this->createQueryBuilder('o') |
| 73 | 76 | ->orderBy('o.id', 'DESC') |
| 74 | 77 | ->where('o.status = 1'); |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | private function getEaster ($pYear = null) |
| 31 | 31 | { |
| 32 | - if (is_null ($pYear)) { |
|
| 32 | + if (is_null ($pYear)) { |
|
| 33 | 33 | $pYear = (int)date ('Y'); |
| 34 | - } |
|
| 35 | - $nDate = $pYear - 1900; |
|
| 36 | - $pAa = $nDate%19; |
|
| 37 | - $pBb = floor (((7*$pAa)+1)/19); |
|
| 38 | - $pCc = ((11*$pAa)-$pBb+4)%29; |
|
| 39 | - $pDd = floor ($nDate/4); |
|
| 40 | - $pEe = ($nDate-$pCc+$pDd+31)%7; |
|
| 41 | - $pResult = 25-$pCc-$pEe; |
|
| 42 | - if ($pResult > 0) { |
|
| 34 | + } |
|
| 35 | + $nDate = $pYear - 1900; |
|
| 36 | + $pAa = $nDate%19; |
|
| 37 | + $pBb = floor (((7*$pAa)+1)/19); |
|
| 38 | + $pCc = ((11*$pAa)-$pBb+4)%29; |
|
| 39 | + $pDd = floor ($nDate/4); |
|
| 40 | + $pEe = ($nDate-$pCc+$pDd+31)%7; |
|
| 41 | + $pResult = 25-$pCc-$pEe; |
|
| 42 | + if ($pResult > 0) { |
|
| 43 | 43 | $pEaster = strtotime ($pYear.'/04/'.$pResult); |
| 44 | - } else { |
|
| 44 | + } else { |
|
| 45 | 45 | $pEaster = strtotime ($pYear.'/03/'.(31+$pResult)); |
| 46 | - } |
|
| 47 | - return $pEaster; |
|
| 46 | + } |
|
| 47 | + return $pEaster; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -58,25 +58,25 @@ discard block |
||
| 58 | 58 | * @return integer Delta next business day |
| 59 | 59 | */ |
| 60 | 60 | function getNextOpenDay ($pDate, $pDays) { |
| 61 | - $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
| 62 | - if (function_exists ('easter_date')) { |
|
| 61 | + $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
| 62 | + if (function_exists ('easter_date')) { |
|
| 63 | 63 | $pEaster = easter_date ((int)date('Y'), $pDate); |
| 64 | - } else { |
|
| 64 | + } else { |
|
| 65 | 65 | $pEaster = $this->getEaster ((int)date('Y'), $pDate); |
| 66 | - } |
|
| 67 | - $aBankHolidays[] = date ('j_n',$pEaster); |
|
| 68 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
| 69 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
| 66 | + } |
|
| 67 | + $aBankHolidays[] = date ('j_n',$pEaster); |
|
| 68 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
| 69 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
| 70 | 70 | |
| 71 | 71 | $pEnd = $pDays * 86400; |
| 72 | - $idn = 0; |
|
| 73 | - while ($idn < $pEnd) { |
|
| 74 | - $idn = strtotime ('+1 day', $idn); |
|
| 75 | - if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
| 76 | - $pEnd = strtotime ('+1 day', $pEnd); |
|
| 77 | - $pDays ++; |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - return $pDays; |
|
| 72 | + $idn = 0; |
|
| 73 | + while ($idn < $pEnd) { |
|
| 74 | + $idn = strtotime ('+1 day', $idn); |
|
| 75 | + if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
| 76 | + $pEnd = strtotime ('+1 day', $pEnd); |
|
| 77 | + $pDays ++; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + return $pDays; |
|
| 81 | 81 | } |
| 82 | 82 | } |
@@ -57,7 +57,8 @@ |
||
| 57 | 57 | * @param integer $pDays Delta for the day of delivery |
| 58 | 58 | * @return integer Delta next business day |
| 59 | 59 | */ |
| 60 | - function getNextOpenDay ($pDate, $pDays) { |
|
| 60 | + function getNextOpenDay ($pDate, $pDays) |
|
| 61 | + { |
|
| 61 | 62 | $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
| 62 | 63 | if (function_exists ('easter_date')) { |
| 63 | 64 | $pEaster = easter_date ((int)date('Y'), $pDate); |