| @@ 40-66 (lines=27) @@ | ||
| 37 | * @param Filter\FilterDateRange $filter |
|
| 38 | * @return void |
|
| 39 | */ |
|
| 40 | public function applyFilterDateRange(Filter\FilterDateRange $filter) |
|
| 41 | { |
|
| 42 | $conditions = $filter->getCondition(); |
|
| 43 | ||
| 44 | $value_from = $conditions[$filter->getColumn()]['from']; |
|
| 45 | $value_to = $conditions[$filter->getColumn()]['to']; |
|
| 46 | ||
| 47 | if ($value_from) { |
|
| 48 | $date_from = \DateTime::createFromFormat($filter->getPhpFormat(), $value_from); |
|
| 49 | $date_from->setTime(0, 0, 0); |
|
| 50 | ||
| 51 | $this->data_source->where( |
|
| 52 | "CONVERT(varchar(10), {$filter->getColumn()}, 112) >= ?", |
|
| 53 | $date_from->format('Ymd') |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | ||
| 57 | if ($value_to) { |
|
| 58 | $date_to = \DateTime::createFromFormat($filter->getPhpFormat(), $value_to); |
|
| 59 | $date_to->setTime(23, 59, 59); |
|
| 60 | ||
| 61 | $this->data_source->where( |
|
| 62 | "CONVERT(varchar(10), {$filter->getColumn()}, 112) <= ?", |
|
| 63 | $date_to->format('Ymd') |
|
| 64 | ); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| 68 | } |
|
| 69 | ||
| @@ 117-137 (lines=21) @@ | ||
| 114 | * @param Filter\FilterDateRange $filter |
|
| 115 | * @return void |
|
| 116 | */ |
|
| 117 | public function applyFilterDateRange(Filter\FilterDateRange $filter) |
|
| 118 | { |
|
| 119 | $conditions = $filter->getCondition(); |
|
| 120 | ||
| 121 | $value_from = $conditions[$filter->getColumn()]['from']; |
|
| 122 | $value_to = $conditions[$filter->getColumn()]['to']; |
|
| 123 | ||
| 124 | if ($value_from) { |
|
| 125 | $date_from = \DateTime::createFromFormat($filter->getPhpFormat(), $value_from); |
|
| 126 | $date_from->setTime(0, 0, 0); |
|
| 127 | ||
| 128 | $this->data_source->where("DATE({$filter->getColumn()}) >= ?", $date_from->format('Y-m-d')); |
|
| 129 | } |
|
| 130 | ||
| 131 | if ($value_to) { |
|
| 132 | $date_to = \DateTime::createFromFormat($filter->getPhpFormat(), $value_to); |
|
| 133 | $date_to->setTime(23, 59, 59); |
|
| 134 | ||
| 135 | $this->data_source->where("DATE({$filter->getColumn()}) <= ?", $date_to->format('Y-m-d')); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | ||
| 140 | /** |
|
| @@ 112-132 (lines=21) @@ | ||
| 109 | * @param Filter\FilterDateRange $filter |
|
| 110 | * @return void |
|
| 111 | */ |
|
| 112 | public function applyFilterDateRange(Filter\FilterDateRange $filter) |
|
| 113 | { |
|
| 114 | $conditions = $filter->getCondition(); |
|
| 115 | ||
| 116 | $value_from = $conditions[$filter->getColumn()]['from']; |
|
| 117 | $value_to = $conditions[$filter->getColumn()]['to']; |
|
| 118 | ||
| 119 | if ($value_from) { |
|
| 120 | $date_from = \DateTime::createFromFormat($filter->getPhpFormat(), $value_from); |
|
| 121 | $date_from->setTime(0, 0, 0); |
|
| 122 | ||
| 123 | $this->data_source->where('DATE(%n) >= ?', $filter->getColumn(), $date_from); |
|
| 124 | } |
|
| 125 | ||
| 126 | if ($value_to) { |
|
| 127 | $date_to = \DateTime::createFromFormat($filter->getPhpFormat(), $value_to); |
|
| 128 | $date_to->setTime(23, 59, 59); |
|
| 129 | ||
| 130 | $this->data_source->where('DATE(%n) <= ?', $filter->getColumn(), $date_to); |
|
| 131 | } |
|
| 132 | } |
|
| 133 | ||
| 134 | ||
| 135 | /** |
|