cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Apply Discount from Plugin - Retail UI

0 Kudos
1,017

Hi,

I am trying to build a plugin for CCO Retail UI where i have catch the event on "addSalesItems" where position before.

like:
@PluginAt(pluginClass = IReceiptManager.class, method = "addSalesItems", where = POSITION.AFTER) public void checkSalesItem(Object proxy, Object[] args, Object ret, StackTraceElement Caller) {}

getting the itemcode as
saleseItem.getMaterial().getExternalID()

and query this item from a user table in CCO where i am saving the discount values, after selecting the item i am applying discount percentage but its not caluluating the Gross Amount and Discount Amount auto.

cco-discount-plugin.jpg

Best Regards,

Accepted Solutions (1)

Accepted Solutions (1)

R_Zieschang
Contributor
0 Kudos

Hi usman.jamil,

you need to let CCO recalculate the receipt. What is the Feature Pack are you using?

Regards
Robert

0 Kudos

Hi rzieschang,

Thank you for your quick reply.

I am using CCO Release: 2.0 FP09 PL00 Version 2.9.2.
What will be the function to recalculate the receipt from the plugin after setting the discount percentage as
saleseItem.setDiscountPercentage(discountPercentage);

Regrads

R_Zieschang
Contributor
0 Kudos

Hi,

please try:

salesItem.setMarkChanged(true);
salesItem.setDiscountManuallyChanged(true);
UIEventDispatcher.INSTANCE.dispatchAction(CConst.UIEventsIds.RECEIPT_REFRESH, null, receipt);

Regards

Robert

0 Kudos

Hi rzieschang,

I tried the above code and it's not refreshing the Receipt auto. After clicking on the discount % field, the discount screen pop up, and here it's not calculating the gross amount auto, now if I click OK then it will calculate Gross Amount.


0 Kudos

Hi rzieschang,

Thanks for your support, I managed to set the discount and auto calculate with your guidance.

Answers (1)

Answers (1)

raveedriaz
Explorer
0 Kudos

Dear rzieschang ,

I have tried to do the same but not able to reflect the discount.
I am using CCO FP 11 PL 02 Quick Service UI

@PluginAt(pluginClass = ReceiptPosService.class, method = "addSalesItem", where = POSITION.AFTER) 
	public void checkSalesItem(Object proxy, Object[] args, Object ret, StackTraceElement Caller) {
		ReceiptEntity receipt=(ReceiptEntity) args[0];
		
		
		for (SalesItemEntity item : receipt.getSalesItems()) {
			item.setDiscountPercentage(new BigDecimal("10") );
			item.setDiscountPurposeCode("1000");
			item.setMarkChanged(true);
			item.setDiscountManuallyChanged(true);
		}
		UIEventDispatcher.INSTANCE.dispatchAction(CConst.UIEventsIds.RECEIPT_REFRESH, null, receipt);
	}
raveedriaz
Explorer
0 Kudos

rzieschang

raveedriaz
Explorer
0 Kudos

Solved the problem Thanks.