← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9980: Add search-all-facilities option into Advanced-search in Multi data entry form.

 

------------------------------------------------------------
revno: 9980
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-05 16:01:39 +0700
message:
  Add search-all-facilities option into Advanced-search in Multi data entry form.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-03-05 07:29:03 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-03-05 09:01:39 +0000
@@ -434,46 +434,59 @@
                     case ProgramStageInstance.COMPLETED_STATUS:
                         patientWhere += condition + operatorStatus
                             + "( psi.executiondate is not null and  psi.executiondate>='" + keys[2]
-                            + "' and psi.executiondate<='" + keys[3]
-                            + "' and psi.completed=true and psi.organisationunitid=" + keys[4] + ")";
+                            + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=true ";
+                        if ( !keys[4].equals( "0" ) )
+                        {
+                            patientWhere += " and psi.organisationunitid=" + keys[4];
+                        }
+                        patientWhere += ")";
                         operatorStatus = " OR ";
                         condition = "";
                         continue;
                     case ProgramStageInstance.VISITED_STATUS:
                         patientWhere += condition + operatorStatus
                             + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
-                            + "' and psi.executiondate<='" + keys[3]
-                            + "' and psi.completed=false and psi.organisationunitid=" + keys[4] + ")";
+                            + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=false ";
+                        if ( !keys[4].equals( "0" ) )
+                        {
+                            patientWhere += " and psi.organisationunitid=" + keys[4];
+                        }
+                        patientWhere += ")";
                         operatorStatus = " OR ";
                         condition = "";
                         continue;
                     case ProgramStageInstance.FUTURE_VISIT_STATUS:
-                        patientWhere += condition
-                            + operatorStatus
-                            + "( psi.executiondate is null and psi.duedate>='"
-                            + keys[2]
-                            + "' and psi.duedate<='"
-                            + keys[3]
-                            + "' and psi.status is null and (DATE(now()) - DATE(psi.duedate) <= 0) and p.organisationunitid="
-                            + keys[4] + ")";
+                        patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
+                            + keys[2] + "' and psi.duedate<='" + keys[3]
+                            + "' and psi.status is null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
+                        if ( !keys[4].equals( "0" ) )
+                        {
+                            patientWhere += " and p.organisationunitid=" + keys[4];
+                        }
+                        patientWhere += ")";
                         operatorStatus = " OR ";
                         condition = "";
                         continue;
                     case ProgramStageInstance.LATE_VISIT_STATUS:
-                        patientWhere += condition
-                            + operatorStatus
-                            + "( psi.executiondate is null and  psi.duedate>='"
-                            + keys[2]
-                            + "' and psi.duedate<='"
-                            + keys[3]
-                            + "' and psi.status is null  and (DATE(now()) - DATE(psi.duedate) > 0) and p.organisationunitid="
-                            + keys[4] + ")";
+                        patientWhere += condition + operatorStatus + "( psi.executiondate is null and  psi.duedate>='"
+                            + keys[2] + "' and psi.duedate<='" + keys[3]
+                            + "' and psi.status is null  and (DATE(now()) - DATE(psi.duedate) > 0) ";
+                        if ( !keys[4].equals( "0" ) )
+                        {
+                            patientWhere += " and p.organisationunitid=" + keys[4];
+                        }
+                        patientWhere += ")";
                         operatorStatus = " OR ";
                         condition = "";
                         continue;
                     case ProgramStageInstance.SKIPPED_STATUS:
                         patientWhere += condition + operatorStatus + "( psi.status=5 and  psi.duedate>='" + keys[2]
-                            + "' and psi.duedate<='" + keys[3] + "' and p.organisationunitid=" + keys[4] + ")";
+                            + "' and psi.duedate<='" + keys[3] + "' ";
+                        if ( !keys[4].equals( "0" ) )
+                        {
+                            patientWhere += " and p.organisationunitid=" + keys[4];
+                        }
+                        patientWhere += ")";
                         operatorStatus = " OR ";
                         condition = "";
                         continue;
@@ -563,7 +576,7 @@
         {
             sql += statementBuilder.limitRecord( min, max );
         }
-
+        
         return sql;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2013-03-05 08:35:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2013-03-05 09:01:39 +0000
@@ -38,7 +38,7 @@
 	#set( $mark = false ) 
 	#foreach( $programStageInstance in $programStageInstances )
 		#set($patient = $programStageInstance.programInstance.patient)
-		<tr id='tr$programStageInstance.id'>
+		<tr id='tr$programStageInstance.id' #alternate( $mark )>
 			<td>
 				#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
 				$nr
@@ -79,6 +79,7 @@
 			</td>
 			
 		</tr>
+	#set( $mark = !$mark ) 
 	#end
 	</tbody>
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-03-02 15:09:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-03-05 09:01:39 +0000
@@ -215,10 +215,14 @@
 	if( getFieldValue('searchByProgramStage') == "true" ){
 		var statusEvent = jQuery('#programStageAddPatientTR [id=statusEvent]').val();
 		var startDueDate = getFieldValue('startDueDate');
+		var orgunitid = getFieldValue('orgunitId');
+		if( byId('searchInAllFacility').checked ){
+			orgunitid = 0;
+		}
 		var endDueDate = getFieldValue('endDueDate');
 		params = '&searchTexts=stat_' + getFieldValue('programIdAddPatient') 
 			   + '_' + startDueDate + '_' + endDueDate
-			   + "_" + getFieldValue('orgunitId')
+			   + "_" + orgunitid
 			   + '_false_' + statusEvent;
 	}
 	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2013-03-05 08:35:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2013-03-05 09:01:39 +0000
@@ -6,7 +6,6 @@
 				item.remove();
 			}
 		});
-		hideById('searchBySelectedUnitTD');
 		showById('dueDateTR');
 		showById('programStageAddPatientTR');
 		jQuery("#searchObjectId [value=prg]").remove();