Skip to content
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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