question: @ ValidationErrorPage ( value = "createReceipt" ) @ Action ( value = "/receipts/challan-saveOrupdate" ) public String saveOrupdate ( ) { try { errors . clear ( ) ; if ( receiptHeader . getReceiptHeader ( ) != null ) collectionCommon . cancelChallanReceiptOnCreation ( receiptHeader ) ; boolean setInstrument = true ; List < InstrumentHeader > receiptInstrList = new ArrayList < InstrumentHeader > ( ) ; receiptHeader . setIsReconciled ( Boolean . FALSE ) ; receiptHeader . setIsModifiable ( Boolean . TRUE ) ; receiptHeader . setCollectiontype ( CollectionConstants . COLLECTION_TYPE_COUNTER ) ; receiptHeader . setLocation ( collectionsUtil . getLocationOfUser ( getSession ( ) ) ) ; receiptHeader . setStatus ( collectionsUtil . getStatusForModuleAndCode ( CollectionConstants . MODULE_NAME_RECEIPTHEADER , CollectionConstants . RECEIPT_STATUS_CODE_TO_BE_SUBMITTED ) ) ; receiptHeader . setCreatedBy ( collectionsUtil . getLoggedInUser ( ) ) ; receiptHeader . setCreatedDate ( new Date ( ) ) ; if ( setInstrument ) { receiptInstrList = populateInstrumentDetails ( ) ; setInstrument = false ; } receiptHeader . setReceiptInstrument ( new HashSet ( receiptInstrList ) ) ; BigDecimal debitAmount = BigDecimal . ZERO ; for ( final ReceiptDetail receiptDetail : receiptHeader . getReceiptDetails ( ) ) debitAmount = debitAmount . add ( receiptDetail . getCramount ( ) ) ; receiptHeader . addReceiptDetail ( collectionCommon . addDebitAccountHeadDetails ( debitAmount , receiptHeader , chequeInstrumenttotal , cashOrCardInstrumenttotal , instrumentTypeCashOrCard ) ) ; if ( chequeInstrumenttotal != null && chequeInstrumenttotal . compareTo ( BigDecimal . ZERO ) != 0 ) receiptHeader . setTotalAmount ( chequeInstrumenttotal ) ; if ( cashOrCardInstrumenttotal != null && cashOrCardInstrumenttotal . compareTo ( BigDecimal . ZERO ) != 0 ) receiptHeader . setTotalAmount ( cashOrCardInstrumenttotal ) ; receiptHeaderService . setReceiptNumber ( receiptHeader ) ; receiptHeaderService . populateAndPersistReceipts ( receiptHeader , receiptInstrList ) ; final ReceiptHeader [ ] receipts = new ReceiptHeader [ 1 ] ; receipts [ 0 ] = receiptHeader ; try { reportId = collectionCommon . generateReport ( receipts , true ) ; } catch ( final Exception e ) { LOGGER . error ( CollectionConstants . REPORT_GENERATION_ERROR , e ) ; throw new ApplicationRuntimeException ( CollectionConstants . REPORT_GENERATION_ERROR , e ) ; } return CollectionConstants . REPORT ; } catch ( final StaleObjectStateException exp ) { errors . add ( new ValidationError ( getText ( "challanreceipt.created.staleobjectstate" ) , "Receipt Already Created For this Challan.Go to Search Receipt screen to Re-print the receipt." ) ) ; throw new ValidationException ( errors ) ; } catch ( final Exception exp ) { errors . add ( new ValidationError ( getText ( "challanreceipt.create.errorincreate" ) , "Error occured in Challan Receipt creation, please try again." ) ) ; throw new ValidationException ( errors ) ; } }
target:  This method is invoked on click of create button from Create Challan Receipt Screen