Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reports update #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
223 changes: 223 additions & 0 deletions EMR/billable_item_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#report-app .loader-section {
padding: 5rem;
text-align: center;
background-color: #f2f2f2;
margin-top: 10px;
margin-bottom: 20px;
}

#report-app .spaced {
margin-top: 5rem;
}

#report-app table {
border-collapse: collapse;
}

#report-app table,
#report-app th,
#report-app td {
border: 1px solid #c0c0c0;
}

#report-app th {
text-align: center;
}
#report-app td,
#report-app th {
height: 25px;
padding: 6px;
margin: 10px;
}

#report-app .loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}

/* Safari */
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>

<link
rel="stylesheet"
type="text/css"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"
integrity="sha512-WFN04846sdKMIP5LKNphMaWzU7YpMyCU245etK3g/2ARYbPK9Ub18eG+ljU96qKRCWh+quCY7yefSmlkQw1ANQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script type="text/javascript">
angular
.module("reportModule", [])
.factory("FactoryDefns", function ($window, $http) {
var uri = "data:application/vnd.ms-excel;base64,",
template =
'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table border="1">{table}</table><br /><table border="1">{table}</table></body></html>',
base64 = function (s) {
return $window.btoa(unescape(encodeURIComponent(s)));
},
format = function (s, c) {
return s.replace(/{(\w+)}/g, function (m, p) {
return c[p];
});
};
return {
tableToExcel: function () {
var tables = $(
".pop-table, .maternal-table, .cchp-table, .opd-table, .ipd-table, .death-table, .notifiable-table, .tracer-table"
);
var ctx = { worksheet: "Sheet 1" };
var str =
'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>';

tables.each(function (index) {
$(this)
.find("td.hidden")
.each(function (index2) {
this.remove();
});
ctx["table" + index] = this.innerHTML;
if (this.title == "no-border") {
str += "<table>{" + "table" + index + "}</table><br />";
} else {
str +=
'<table border="1">{' + "table" + index + "}</table><br />";
}
});
str += "</body></html>";
var href = uri + base64(format(str, ctx));
return href;
},
getData: async function (reportDimensions) {
if (!reportDimensions) {
return null;
}
return await $http
.get(
`../../../openmrs/ws/rest/v1/reportingrest/dataSet/${reportDimensions?.dataSetUuid}?startDate=${reportDimensions?.startDate}&endDate=${reportDimensions?.endDate}`
)
.then((response) => {
return response.data;
});
},
};
})
.controller("reportController", [
"$scope",
"$http",
"$timeout",
"$q",
"FactoryDefns",
function ($scope, $http, $timeout, $q, FactoryDefns) {
$scope.currentUser = null;
$scope.loading = false;
$scope.reasonsHeaders = [];
$scope.reportDimensions = {
startDate: window["iReportsDimensions"]
? window["iReportsDimensions"]?.startDate
: "2022-11-22",
endDate: window["iReportsDimensions"]
? window["iReportsDimensions"]?.endDate
: new Date().getFullYear().toString() +
"-" +
(new Date().getMonth() + 1) +
"-" +
new Date().getDate(),

dataSetUuid: "7c052816-b673-454c-a54b-e79fd51ada66",
// dataSetUuid: "718fa52e-3de0-4bcb-8c44-9957ac2a8170",
};
$scope.dataRows = [];
$scope.maxRejectionReasons = 1;
$scope.loading = true;
FactoryDefns.getData($scope.reportDimensions).then((response) => {
const responseRows = response?.rows;
$scope.dataRows = responseRows?.map((row, index) => {
return {
...row,
};
});
$scope.loading = false;
$scope.$apply();
});
},
]);
</script>
</head>
<body>
<div id="report-app" ng-app="reportModule" ng-controller="reportController">
<h3 class="text-center">Billable Item List Report</h3>
<div style="width: 100%; overflow: auto; margin-top: 16px">
<table class="table table-bordered" ng-if="!loading">
<thead style="background-color: #2e8180; color: #fff">
<tr>
<th>S/NO</th>
<th>NAME</th>
<th>TYPE</th>
<th>CASH PRICES</th>
<th>NHIF PRICES</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="dataRow in dataRows;">
<td>{{$index+1}}</td>
<td>{{dataRow.name}}</td>
<td>{{dataRow.Type}}</td>
<td>{{dataRow.Cash_prices}}</td>
<td>{{dataRow.Nhif_prices}}</td>
</tr>
</tbody>
</table>
<div
ng-if="loading"
style="
width: 100%;
display: flex;
align-items: center;
justify-content: center;
"
>
<div class="loader"></div>
</div>
</div>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions EMR/billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ <h3 class="text-center">Billing</h3>
<thead style="background-color: #2e8180; color: #fff">
<tr>
<!-- <th>No</th> -->
<th>S/NO</th>
<th>CASH PATIENT</th>
<th>INSURANCE PATIENT</th>
<th>TOTAL INVOICE</th>
Expand All @@ -203,6 +204,8 @@ <h3 class="text-center">Billing</h3>
<tbody>
<tr ng-repeat="dataRow in dataRows;">
<!-- <td>{{dataRow.#}}</td> -->

<td>{{$index+1}}</td>
<td>{{dataRow.cashpatients}}</td>
<td>{{dataRow.Insurancepatients}}</td>
<td>{{dataRow.total_invoice_count}}</td>
Expand Down
Loading
Loading