Skip to content

Commit d242ad8

Browse files
authored
Merge branch 'master' into feature/64086-reminders-for-not-billed-times
2 parents be10fdb + d1b0bf9 commit d242ad8

File tree

22 files changed

+837
-14
lines changed

22 files changed

+837
-14
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Naming/MemoizedInstanceVariableName:
149149
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
150150
Naming/MethodParameterName:
151151
Exclude:
152+
- 'app/domain/billing/report/csv.rb'
152153
- 'app/domain/invoicing/small_invoice/invoice_sync.rb'
153154
- 'app/domain/invoice/report/csv.rb'
154155
- 'app/domain/order/controlling.rb'

app/assets/javascripts/application.js.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#= require accounting_posts
4444
#= require reports_orders
4545
#= require reports_invoices
46+
#= require reports_billing
4647
#= require expenses
4748
#= require expense_reviews
4849
#= require meal_compensations
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of
2+
# PuzzleTime and licensed under the Affero General Public License version 3
3+
# or later. See the COPYING file at the top-level directory or at
4+
# https://github.com/puzzle/puzzletime.
5+
6+
7+
app = window.App ||= {}
8+
9+
app.reportsBilling = new class
10+
init: ->
11+
@dateFilterChanged()
12+
13+
dateFilterChanged: ->
14+
$('.billing_reports form[role="filter"]').find('#start_date,#end_date')
15+
.datepicker('option', 'disabled', $('#period_shortcut').val())
16+
if $('#period_shortcut').val()
17+
$('.billing_reports form[role="filter"]').find('#start_date,#end_date').val("")
18+
19+
$(document).on('ajax:success', '.billing_reports form[role="filter"]', ->
20+
app.reportsBilling.init()
21+
)
22+
23+
$(document).on 'turbolinks:load', ->
24+
app.reportsBilling.init()

app/assets/stylesheets/_orders.scss

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// or later. See the COPYING file at the top-level directory or at
44
// https://github.com/puzzle/puzzletime.
55

6-
76
.orders-header {
87
padding: 15px $grid-gutter-width 0 $grid-gutter-width;
98
background-color: $gray-lighter;
@@ -53,7 +52,6 @@ h1.top {
5352
}
5453

5554
.orders-cockpit {
56-
5755
.cockpit-header {
5856
@include clearfix;
5957
margin: 0 auto;
@@ -87,7 +85,9 @@ h1.top {
8785
}
8886
}
8987

90-
.title, .figure, .unit {
88+
.title,
89+
.figure,
90+
.unit {
9191
color: $gray-darker;
9292
}
9393

@@ -111,7 +111,8 @@ h1.top {
111111
}
112112
}
113113

114-
.figure-label, .unit {
114+
.figure-label,
115+
.unit {
115116
font-size: 12px;
116117
font-weight: 400;
117118
}
@@ -138,19 +139,21 @@ h1.top {
138139
border-bottom: 1px solid $gray-light;
139140
}
140141

141-
[class^="icon-"], [class*=" icon-"] {
142+
[class^='icon-'],
143+
[class*=' icon-'] {
142144
color: $brand-primary;
143145
}
144146
}
145-
td, th {
147+
td,
148+
th {
146149
width: 170px;
147150
min-width: 170px;
148151
padding: $cell-padding;
149152
@include ellipsis(true);
150153
}
151154

152155
td {
153-
height: ($row-line-height*3) + ($cell-padding*3);
156+
height: ($row-line-height * 3) + ($cell-padding * 3);
154157
vertical-align: top;
155158
}
156159

@@ -173,7 +176,8 @@ h1.top {
173176
width: $static-width;
174177
@include box-shadow(10px 0 5px -2px rgba(208, 208, 208, 0.4));
175178

176-
.title, .subtitle {
179+
.title,
180+
.subtitle {
177181
height: $row-line-height;
178182

179183
.small {
@@ -196,7 +200,9 @@ h1.top {
196200

197201
table {
198202
width: 100%;
199-
th, td, td .data-item {
203+
th,
204+
td,
205+
td .data-item {
200206
text-align: right;
201207
}
202208

@@ -218,7 +224,8 @@ h1.top {
218224
}
219225
}
220226

221-
.orders-report {
227+
.orders-report,
228+
.billing-report {
222229
> thead {
223230
position: sticky;
224231
top: 0;
@@ -244,10 +251,10 @@ h1.top {
244251
font-weight: 400;
245252
}
246253

247-
.figure, .unit {
254+
.figure,
255+
.unit {
248256
color: $gray-darker;
249257
}
250-
251258
}
252259
}
253260

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright (c) 2006-2025, Puzzle ITC GmbH. This file is part of
4+
# PuzzleTime and licensed under the Affero General Public License version 3
5+
# or later. See the COPYING file at the top-level directory or at
6+
# https://github.com/puzzle/puzzletime.
7+
8+
class BillingReportsController < ApplicationController
9+
include DryCrud::Rememberable
10+
include WithPeriod
11+
12+
self.remember_params = %w[start_date end_date period_shortcut department_id
13+
client_work_item_id category_work_item_id kind_id
14+
status_id responsible_id]
15+
16+
before_action :authorize_class
17+
18+
def index
19+
respond_to do |format|
20+
set_period
21+
@report = Billing::Report.new(@period, params)
22+
format.html do
23+
set_filter_values
24+
unless @report.filters_defined?
25+
params[:department_id] ||= @user.department_id
26+
params[:responsible_id] ||= @user.id
27+
params.reverse_merge!(period_shortcut: '0m')
28+
set_period
29+
@report = Billing::Report.new(@period, params)
30+
end
31+
end
32+
format.js do
33+
set_filter_values
34+
end
35+
format.csv do
36+
send_data(Billing::Report::Csv.new(@report).generate,
37+
type: 'text/csv; charset=utf-8; header=present')
38+
end
39+
end
40+
end
41+
42+
private
43+
44+
def set_filter_values
45+
@departments = Department.list
46+
@clients = WorkItem.joins(:client).list
47+
@categories = params[:client_work_item_id].present? ? WorkItem.find(params[:client_work_item_id]).categories.list : []
48+
@order_kinds = OrderKind.list
49+
@order_status = OrderStatus.list
50+
@order_responsibles = Employee.joins(:managed_orders).distinct.list
51+
@target_scopes = TargetScope.list
52+
end
53+
54+
def authorize_class
55+
authorize!(:reports, Order)
56+
end
57+
end

app/controllers/order_reports_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def index
2424
set_filter_values
2525
unless @report.filters_defined?
2626
params[:department_id] ||= @user.department_id
27+
params[:responsible_id] ||= @user.id
2728
case params[:status_preselection]
2829
when nil, ''
2930
params.reverse_merge!(period_shortcut: '0m')

0 commit comments

Comments
 (0)