From: Anneli <an...@us...> - 2005-05-02 13:17:46
|
Update of /cvsroot/redpos/RedPOS/src/org/redpos/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23980/src/org/redpos/client Modified Files: POSEngine.java Log Message: It is now possible to give discount on a correction receipt, bug 1186489 Index: POSEngine.java =================================================================== RCS file: /cvsroot/redpos/RedPOS/src/org/redpos/client/POSEngine.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** POSEngine.java 7 Mar 2005 11:13:59 -0000 1.8 --- POSEngine.java 2 May 2005 13:16:31 -0000 1.9 *************** *** 872,883 **** // confirm that discount limit is not exceeded ! if(percent != null ! && percent.doubleValue() > 1 ! || amount != null ! && amount.doubleValue() > (rr.getAmount().doubleValue() * rr.getQuantity())) { ! throw new POSEngineException( ! "Cannot add row discount, discount limit has been exceeded", ! POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); } --- 872,907 ---- // confirm that discount limit is not exceeded ! try { ! if (receiptSessionUtility.getReceiptType() == ReceiptConstants.TYPE_RECEIPT_NORMAL) ! { ! if(percent != null && percent.doubleValue() > 1 ! || amount != null && amount.doubleValue() > (rr.getAmount().doubleValue() * rr.getQuantity())) ! { ! throw new POSEngineException( ! "Cannot add row discount, discount limit has been exceeded", ! POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); ! } ! } ! else ! { ! if (amount != null) ! amount.multiply(-1); ! if(percent != null && percent.doubleValue() > 1 ! || amount != null && amount.doubleValue() < (rr.getAmount().doubleValue() * rr.getQuantity())) ! { ! throw new POSEngineException( ! "Cannot add row discount, discount limit has been exceeded", ! POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); ! } ! } ! } ! catch(POSEngineException e) ! { ! log.error(e.getMessage(), e); ! } ! catch(JMException e) ! { ! log.error(e.getMessage(), e); } *************** *** 966,977 **** { Amount total = receiptSessionUtility.getTotal(); ! ! if(percent != null && percent.doubleValue() > 1 || amount != null && amount.doubleValue() > total.doubleValue()) ! { throw new POSEngineException( "Cannot add total discount, discount limit has been exceeded", POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); ! } } catch(JMException e1) --- 990,1015 ---- { Amount total = receiptSessionUtility.getTotal(); ! if (receiptSessionUtility.getReceiptType() == ReceiptConstants.TYPE_RECEIPT_NORMAL) ! { ! if(percent != null && percent.doubleValue() > 1 || amount != null && amount.doubleValue() > total.doubleValue()) ! { throw new POSEngineException( "Cannot add total discount, discount limit has been exceeded", POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); ! } ! } ! else ! { ! if (amount != null) ! amount.multiply(-1); ! if(percent != null && percent.doubleValue() > 1 || amount != null ! && amount.doubleValue() < total.doubleValue()) ! { ! throw new POSEngineException( ! "Cannot add total discount, discount limit has been exceeded", ! POSEngineException.DISCOUNT_LIMIT_EXCEEDED_EXCEPTION); ! } ! } } catch(JMException e1) *************** *** 983,986 **** --- 1021,1025 ---- } + // create discount receipt row DiscountReceiptRow discountRow; |