|  | @ -5,37 +5,47 @@ const Registries = require('point_of_sale.Registries'); | 
			
		
	
		
		
			
				
					|  |  | // Created new class validation that extends PaymentScreen and overrides the validateOrder
 |  |  | // Created new class validation that extends PaymentScreen and overrides the validateOrder
 | 
			
		
	
		
		
			
				
					|  |  | const validation = PaymentScreen => |  |  | const validation = PaymentScreen => | 
			
		
	
		
		
			
				
					|  |  |     class extends PaymentScreen { |  |  |     class extends PaymentScreen { | 
			
		
	
		
		
			
				
					
					|  |  |          validateOrder(isForceValidate) { |  |  |            async validateOrder(isForceValidate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 var self = this |  |  |                 var self = this | 
			
		
	
		
		
			
				
					|  |  |                 var condition = true |  |  |                 var condition = true | 
			
		
	
		
		
			
				
					|  |  |                 var flag = true |  |  |                 var flag = true | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 var normal_flow = false | 
			
		
	
		
		
			
				
					|  |  |                 var number = 1 |  |  |                 var number = 1 | 
			
		
	
		
		
			
				
					|  |  |                 var orderlines = this.env.pos.selectedOrder.orderlines |  |  |                 var orderlines = this.env.pos.selectedOrder.orderlines | 
			
		
	
		
		
			
				
					|  |  |                 // Checking condition for each orderlines
 |  |  |                 // Checking condition for each orderlines
 | 
			
		
	
		
		
			
				
					
					|  |  |                 orderlines.forEach(async function (lines) { |  |  |                 for (const lines of orderlines) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                      if (lines.product.lst_price < lines.product.standard_price || lines.price < lines.product.standard_price){ |  |  |                     if (lines.product.lst_price < lines.product.standard_price || lines.price < lines.product.standard_price) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                      condition = false |  |  |                         condition = false; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         const { confirmed } = await self.showPopup('ConfirmPopup',{ |  |  |                         const { confirmed } = await self.showPopup('ConfirmPopup', { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                            title:'Alert', |  |  |                             title: 'Alert', | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                             body: 'The Sales Price of ' + lines.product.display_name + |  |  |                             body: 'The Sales Price of ' + lines.product.display_name + | 
			
		
	
		
		
			
				
					
					|  |  |                             ' is less than the Cost Price.Do you want to continue validation?', |  |  |                                 ' is less than the Cost Price. Do you want to continue validation?', | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         }); |  |  |                         }); | 
			
		
	
		
		
			
				
					|  |  |                         if (confirmed) { |  |  |                         if (confirmed) { | 
			
		
	
		
		
			
				
					
					|  |  |                            if (orderlines.length==number) { |  |  |                              // Set flag to false if popup is confirmed
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                            self.showScreen(self.nextScreen) |  |  |                             if (orderlines.length === number) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                                 flag = false; | 
			
		
	
		
		
			
				
					|  |  |                             } |  |  |                             } | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     else{ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     // Set normal_flow to true if there is no pop-up
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     normal_flow = true | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                     number = number + 1 |  |  |                     number = number + 1 | 
			
		
	
		
		
			
				
					
					|  |  |                 }) |  |  |                 } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                 if (flag==false && condition== false){ |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (normal_flow == true){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                  // Order validation for normal flow
 | 
			
		
	
		
		
			
				
					|  |  |                 super.validateOrder(isForceValidate); |  |  |                 super.validateOrder(isForceValidate); | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |                 orderlines.forEach(async function (lines) { |  |  |                 if (flag==false && condition== false && normal_flow== false){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                      if ((lines.product.lst_price > lines.product.standard_price || lines.price < lines.product.standard_price)  && condition==true ){ |  |  |                 // Order validation for low price product after confirming the pop-up
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                      self.showScreen(self.nextScreen) |  |  |                 super.validateOrder(isForceValidate); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |                 }) |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |            } |  |  |            } | 
			
		
	
		
		
			
				
					|  |  |         }; |  |  |         }; | 
			
		
	
		
		
			
				
					|  |  |         Registries.Component.extend(PaymentScreen, validation); |  |  |         Registries.Component.extend(PaymentScreen, validation); | 
			
		
	
	
		
		
			
				
					|  | 
 |