Skip to content

Commit

Permalink
accounting minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlebl committed Jul 29, 2024
1 parent d8855e6 commit a224ec7
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 21 deletions.
53 changes: 32 additions & 21 deletions nomad-front-end/src/components/AccountsComponents/AccountsForm.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect } from 'react'
import { Form, DatePicker, Button, Select, Tooltip, Radio, Modal, Space } from 'antd'
import { CloseOutlined, QuestionOutlined } from '@ant-design/icons'
import infoModalConfig from './infoModalCosting'

const { Option } = Select
const { RangePicker } = DatePicker
Expand All @@ -17,7 +18,12 @@ const AccountsForm = props => {
</Option>
))

grpOptions = [ <Option value='all' key='all' >--all--</Option> , ...grpOptions ]
grpOptions = [
<Option value='all' key='all'>
--all--
</Option>,
...grpOptions
]

const radioOptions = ['Grants', 'Groups', 'Users']

Expand All @@ -31,29 +37,30 @@ const AccountsForm = props => {
})
}

if (dateRange) {
values.dateRange = dateRange.map(date => date.format('YYYY-MM-DD'))
}
if (!dateRange) {
return Modal.confirm({
title: 'Date range not defined',
content: (
<div>
<p>If date range is not defined, the calculation can take very long time</p>
<p>Do you want to proceed?</p>
</div>
),
onOk() {
if (dateRange) {
values.dateRange = dateRange.map(date => date.format('YYYY-MM-DD'))
}

if (type !== 'Grants') {
props.getCosts(token, values)
} else {
props.getGrantsCosts(token, { dateRange: values.dateRange })
if (type !== 'Grants') {
props.getCosts(token, values)
} else {
props.getGrantsCosts(token, { dateRange: values.dateRange })
}
}
})
}
}

const infoModalConfig = {
title: 'Accounting Calculations',
width: 800,
content: (
<div>
<strong>Grants</strong>
<strong>Groups</strong>
<strong>Users</strong>
</div>
)
}

return (
<Form form={form} layout='inline' onFinish={values => submitHandler(values)}>
<Space size='large' style={{ marginRight: '30px' }}>
Expand All @@ -72,7 +79,11 @@ const AccountsForm = props => {
/>
</Space>
<Form.Item label='Group' name='groupId'>
<Select loading={props.groupList.length === 0} style={{ width: 150 }} disabled={type !== 'Users'}>
<Select
loading={props.groupList.length === 0}
style={{ width: 150 }}
disabled={type !== 'Users'}
>
{grpOptions}
</Select>
</Form.Item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react'
import { Alert } from 'antd'

const infoModalConfig = {
title: 'Accounting Calculations',
width: 800,
content: (
<div>
You can switch between three types of accounting calculations
<div style={{ marginTop: '5px' }}>
<strong>Grants</strong>
</div>
<p>
This calculation will work only if grants have been preset. In "Set Grants" table you can
assign either individual users or whole group to a grant. If you assign individual user and
his own group to two different grants, the experiments that were originated by the user will
be charged to the grant corresponding to the user and not to the one corresponding to the
whole group.
</p>
<Alert
message='If there are experiments originated by a user/s who was not assigned to a grant in the time of archiving the calculation issues a warning with corresponding username/s which allows to amend the results by using users type calculation'
type='warning'
/>
<div style={{ marginTop: '10px' }}>
<strong>Groups</strong>
</div>
<p>
Groups calculation provides total sums of total experimental times (including overhead
times) and corresponding costs for groups. Costs are calculated using instrument costings
that are set in the costing table in the time of calculation.
<Alert
message='Invalid costs will be obtained if costing has changed between archiving and calculation. Total experimental time values remain valid and can be use to calculate correct costs if if costing in the time of archiving is known'
type='warning'
/>
</p>
<strong>Users</strong>
<p>
Users calculation is similar to the previous one. A group can be selected from drop down
menu and total experimental times and costs are listed for individual users who were in the
group in the time of archiving of the experiments. If "--all--" option is selected the
calculation will be performed for all users who archived an experiment in the given period
of time.
</p>
<Alert
message='If "--all--" option is used the calculation will not register if a user moved from one group to another between the dates used for the calculation and sums of all experiments acquired by the user regardless of the group will be resulted.'
type='warning'
/>
</div>
)
}

export default infoModalConfig

0 comments on commit a224ec7

Please sign in to comment.