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

Checks on the print button #243

Open
wants to merge 2 commits into
base: master
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
2 changes: 1 addition & 1 deletion src/outpatient/app/view/patient/more.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Ext.define('RaxaEmr.Outpatient.view.patient.more', {
layout: 'vbox',
items: [{
id: 'content',
tpl: ['<div class="top">', '<div style="float:left;width:50%;">', '<div class="headshot" style="float:left;background-image:url({image});">', '</div>', '<div class="name" style="float:left;width:80%;">', '{display}', '</br>', '<span>From : -- </span>', '</br>', '</div>', '</div>', '<div style="float:left;width:50%;">', '<div class="name_small" style="float:left;width:50%;">', '<span> Age : {age} </span>', '<span>ID : --</span>', '</br>', '</div>', '<div class="name_right" style="float:left;width:50%;">', '<h3>--</h3>', '<span></span>', '</div>', '</div>', '</div>'].join('')
tpl: ['<div class="top">', '<div style="float:left;width:50%;">', '<div class="headshot" style="float:left;background-image:url(resources/images/default_image.png);float:left;height:40px;width:48px;;">', '</div>', '<div class="name" style="float:left;width:80%;">', '{display}', '</br>', '<span>From : -- </span>', '</br>', '</div>', '</div>', '<div style="float:left;width:50%;">', '<div class="name_small" style="float:left;width:50%;">', '<span> Age : {age} </span>', '<span>ID : --</span>', '</br>', '</div>', '<div class="name_right" style="float:left;width:50%;">', '<h3>--</h3>', '<span></span>', '</div>', '</div>', '</div>'].join('')
}, {
xtype: 'vitalsGrid',
height: 84
Expand Down
13 changes: 8 additions & 5 deletions src/outpatient/app/view/patientlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,20 @@ Ext.define('RaxaEmr.Outpatient.view.patientlist', {
}],
//list items are shown by this
itemTpl: new Ext.XTemplate(
'<div class="headshot" style="background-image:url({image});"></div>', '<div style="float:left;width:25%;">', '{display}', '<span>Gender : {[this.gender(values.gender)]}</span>', '<span>From : ----</span>', '</div>', '<div style="float:left;width:25%;">', '<span>----</span>', '<span>Disease : ----</span>', '<span>Age : {age}</span>', '</div>', '<div style="float:left;height:32px;width:32px;background-image:url(resources/images/urgency.png);">8</div>', '<div style="float:right;width:25%;">', '<span>Last Visit : ----</span>', '<span>No. of Visits : --</span>', '<span>ID : ----</span>', '</div>',
'<div class="headshot" style="background-image:url(resources/images/default_image.png);float:left;height:40px;width:48px;"></div>', '<div style="float:left;width:25%;">', '{display}', '<span>Gender : {[this.gender(values.gender)]}</span>', '<span>From : ----</span>', '</div>', '<div style="float:left;width:25%;">', '<span>----</span>', '<span>Disease : ----</span>', '<span>Age : {age}</span>', '</div>', '<div style="float:left;height:32px;width:32px;background-image:url(resources/images/urgency.png);">8</div>', '<div style="float:right;width:25%;">', '<span>Last Visit : ----</span>', '<span>No. of Visits : --</span>', '<span>ID : ----</span>', '</div>',
{
date: function(str){
return str.encounters[0].encounterDatetime.split("T")[0];
},
gender: function(str){
if(str == 'M'){
if(str == 'Male'){
return 'Male';
}else if(str == 'F'){
return 'Female';
}
}else if(str == 'Female'){
return 'Female';
}
else if (str == 'Other'){
return '----';
}
}
}
)
Expand Down
Binary file added src/outpatient/resources/images/default_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion src/pharmacy/app/controller/prescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,27 @@ Ext.define("RaxaEmr.Pharmacy.controller.prescription", {
}
}
localStorage.setItem('selectedPatient', JSON.stringify(selectedPatient));
var printWindow = window.open('app/print.html', 'Fill Prescription', 'height=500,width=1100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');

// Checking DrugName and Quantity are enetered for each row entered.
var qtyanddrugNameFlag=0; // Flag to check for empty entries for either drugname or quantity
for (var i=0;i<selectedPatient['DrugGrid'].length;i++){
if (selectedPatient['DrugGrid'][i].drugName=="" && selectedPatient['DrugGrid'][i].qty==0){
// To remove empty rows.
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using
if (condition)
{ //nothing }
else
something

You can try
if ( !(condition) )
something

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it in there if it was necessary to remove the empty 'druggrid' row later. I was splicing the empty row, but there was a problem with json stringify or parse as the it wasn't displaying any row at all in 'print.html'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can paste the code here (or in pastebin and give us link), we can try to help you with any of your problem.

if (selectedPatient['DrugGrid'][i].drugName=="" || selectedPatient['DrugGrid'][i].qty==0){
qtyanddrugNameFlag++;
}
}
}

if (selectedPatient['DrugGrid'].length==0 || qtyanddrugNameFlag!=0) {
Ext.Msg.alert("Invalid","Please enter drug and corresponding quantity.");
}
else{
var printWindow = window.open('app/print.html', 'Fill Prescription', 'height=500,width=1100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');
}

},
readGrid: function() {
var drugs = Ext.getStore('orderStore').data;
Expand Down