Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions resources/queries/targetedms/InstrumentBilling.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ SELECT
TIMESTAMPDIFF('SQL_TSI_HOUR', StartTime, EndTime) * ir.Fee + ir.rateType.setupFee AS TotalCost,
iup.PaymentMethod.UWBudgetNumber AS Payment_Method,
iup.PaymentMethod.Name AS Payment_Method_Name,
iup.PercentPayment
iup.PercentPayment,
((TIMESTAMPDIFF('SQL_TSI_HOUR', StartTime, EndTime) * Fee + ir.rateType.setupFee) * PercentPayment / 100) AS AmountBilled

FROM targetedms.InstrumentSchedule i
LEFT OUTER JOIN targetedms.InstrumentRate ir ON i.Instrument = ir.Instrument
LEFT OUTER JOIN targetedms.InstrumentUsagePayment iup ON i.Id = iup.InstrumentScheduleId
INNER JOIN targetedms.InstrumentRate ir ON i.Instrument = ir.Instrument
INNER JOIN targetedms.InstrumentUsagePayment iup ON i.Id = iup.InstrumentScheduleId
3 changes: 2 additions & 1 deletion resources/queries/targetedms/InstrumentBillingByMonth.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ SELECT
Payment_Method,
Payment_Method_Name,
PercentPayment,
((HoursInRange * Fee + Setup_Cost) * PercentPayment / 100) AS AmountBilled
-- Only include the setup fee when the beginning of the reservation falls within the report's time window
((HoursInRange * Fee + (CASE WHEN StartDate <= StartBillDate THEN 0 ELSE Setup_Cost END)) * PercentPayment / 100) AS AmountBilled

FROM
(SELECT
Expand Down
4 changes: 4 additions & 0 deletions resources/queries/targetedms/instrumentBilling.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="instrumentBilling" tableDbType="TABLE">
<tableTitle>Instrument Billing</tableTitle>
<columns>
<column columnName="Hours">
<formatString>0.0</formatString>
</column>
<column columnName="TotalCost">
<formatString>$#,##0.00</formatString>
</column>
<column columnName="AmountBilled">
<formatString>$#,##0.00</formatString>
</column>
</columns>
</table>
</tables>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="instrumentBillingByMonth" tableDbType="TABLE">
<tableTitle>Instrument Billing by Month</tableTitle>
<columns>
<column columnName="HoursInRange">
<formatString>0.0</formatString>
Expand Down
10 changes: 0 additions & 10 deletions resources/queries/targetedms/userProjects.query.xml

This file was deleted.

6 changes: 0 additions & 6 deletions resources/queries/targetedms/userProjects.sql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Don't allow duplicate project/researcher mapping rows
DELETE FROM targetedms.projectresearcher WHERE Id NOT IN (SELECT MIN(Id) FROM targetedms.projectresearcher GROUP BY project, researcher);

ALTER TABLE targetedms.projectResearcher
ADD CONSTRAINT UQ_projectResearcher_project_researcher UNIQUE (project, researcher);

DROP INDEX targetedms.IDX_projectResearcher_Project;
2 changes: 0 additions & 2 deletions resources/views/instrumentSchedulingAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=rateType">Edit rate types</a> (setup fee)</div>
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=instrumentRate">Edit rate list</a> (assigns a setup fee and an hourly rate to instruments)</div>
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=MSProject">Edit project list</a></div>
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=projectResearcher">Edit project/researcher mapping</a> (attaches users to projects)</div>
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=paymentMethod">Edit payment method list</a></div>
<div><a href="query-executeQuery.view?schemaName=targetedms&query.queryName=projectPaymentMethod">Edit project/payment method mapping</a></div>
7 changes: 5 additions & 2 deletions resources/views/msProject.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
renderTo: 'ms-project',
frame: 'none',
schemaName: 'targetedms',
queryName: 'userProjects',
containerFilter: LABKEY.Query.containerFilter.currentAndSubfolders
queryName: 'msProject',
containerFilter: LABKEY.Query.containerFilter.currentAndSubfolders,
filters: [
LABKEY.Filter.create('ProjectMember', true)
]
};
// admins can see all projects, non-admins can only see projects they are a researcher on
new LABKEY.QueryWebPart(config);
Expand Down
23 changes: 15 additions & 8 deletions resources/views/msProjectDetails.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<div id="project-details">
</div>
<div id="schedule-instrument-time">
</div>
<div id="project-details"></div>
<div id="schedule-instrument-time"></div>
<br/>
<div id="payment-methods">
</div>
<div id="payment-summary">
</div>
<div id="researchers"></div>
<div id="payment-methods"></div>
<div id="payment-summary"></div>

<script type="text/javascript" nonce="<%=scriptNonce%>">
$(function() {
Expand Down Expand Up @@ -105,6 +102,16 @@
containerFilter: LABKEY.Query.containerFilter.currentAndSubfolders
});

new LABKEY.QueryWebPart({
renderTo: 'researchers',
frame: 'portal',
title: 'Researchers for this Project',
schemaName: 'targetedms',
queryName: 'projectResearcher',
filterArray: [LABKEY.Filter.create('project', project, LABKEY.Filter.Types.EQUAL)],
containerFilter: LABKEY.Query.containerFilter.currentAndSubfolders
});

const scheduleInstrumentTimeEl = document.getElementById('schedule-instrument-time');
const scheduleUrlParams = {
project: LABKEY.ActionURL.getParameter('project')
Expand Down
2 changes: 1 addition & 1 deletion resources/views/scheduleAllInstruments.view.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<view xmlns="http://labkey.org/data/xml/view" title="Schedule Instrument Time">
<view xmlns="http://labkey.org/data/xml/view" title="Instrument Schedules">
<dependencies>
<dependency path="internal/jQuery"/>
<dependency path="targetedms/instrumentCalendar"/>
Expand Down
Loading
Loading