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
Changes from 1 commit
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
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