-my @suggestions_loop;
-foreach my $suggestion (@$suggestions) {
- $suggestion->{'reasonsloop'} = $reasonsloop;
- push @suggestions_loop, $suggestion;
-}
+my $pending_suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "",$branchcode );
+map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$pending_suggestions;
+my $accepted_suggestions = &GetSuggestionByStatus('ACCEPTED',$branchcode);
+map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$accepted_suggestions;
+my $rejected_suggestions = &GetSuggestionByStatus('REJECTED',$branchcode);
+map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$rejected_suggestions;
+
+my @allsuggestions;
+push @allsuggestions,{"suggestiontype"=>"accepted",
+ 'suggestions_loop'=>$accepted_suggestions,
+ 'reasonsloop' => $reasonsloop};
+push @allsuggestions,{"suggestiontype"=>"pending",
+ 'suggestions_loop'=>$pending_suggestions,
+ 'reasonsloop' => $reasonsloop};
+push @allsuggestions,{"suggestiontype"=>"rejected",
+ 'suggestions_loop'=>$rejected_suggestions,
+ 'reasonsloop' => $reasonsloop};