Add xref buttons for viewing transaction in CORE-POS
This commit is contained in:
		
							parent
							
								
									f3a49838c1
								
							
						
					
					
						commit
						a838c7c2d1
					
				
					 1 changed files with 34 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2022 Lance Edgar
 | 
			
		||||
#  Copyright © 2010-2023 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +37,7 @@ class TransactionDetailMasterView(CoreMasterView):
 | 
			
		|||
        'pos_row_id': "POS Row ID",
 | 
			
		||||
        'transaction_id': "Transaction ID",
 | 
			
		||||
        'upc': "UPC",
 | 
			
		||||
        'tax_rate_id': "Tax Rate ID",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
| 
						 | 
				
			
			@ -54,11 +55,17 @@ class TransactionDetailMasterView(CoreMasterView):
 | 
			
		|||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(TransactionDetailMasterView, self).configure_grid(g)
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.set_type('quantity', 'quantity')
 | 
			
		||||
        g.set_type('item_quantity', 'quantity')
 | 
			
		||||
 | 
			
		||||
        g.set_type('cost', 'currency')
 | 
			
		||||
        g.set_type('unit_price', 'currency')
 | 
			
		||||
        g.set_type('reg_price', 'currency')
 | 
			
		||||
        g.set_type('discount', 'currency')
 | 
			
		||||
        g.set_type('member_discount', 'currency')
 | 
			
		||||
        g.set_type('volume_special', 'currency')
 | 
			
		||||
        g.set_type('total', 'currency')
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('date_time', 'desc')
 | 
			
		||||
| 
						 | 
				
			
			@ -72,9 +79,33 @@ class TransactionDetailMasterView(CoreMasterView):
 | 
			
		|||
        g.set_link('description')
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
        super(TransactionDetailMasterView, self).configure_form(f)
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
 | 
			
		||||
        f.set_type('quantity', 'quantity')
 | 
			
		||||
        f.set_type('item_quantity', 'quantity')
 | 
			
		||||
 | 
			
		||||
        f.set_type('cost', 'currency')
 | 
			
		||||
        f.set_type('unit_price', 'currency')
 | 
			
		||||
        f.set_type('reg_price', 'currency')
 | 
			
		||||
        f.set_type('discount', 'currency')
 | 
			
		||||
        f.set_type('member_discount', 'currency')
 | 
			
		||||
        f.set_type('volume_special', 'currency')
 | 
			
		||||
        f.set_type('total', 'currency')
 | 
			
		||||
 | 
			
		||||
    def get_xref_buttons(self, detail):
 | 
			
		||||
        app = self.get_rattail_app()
 | 
			
		||||
        corepos = app.get_corepos_handler()
 | 
			
		||||
        url = corepos.get_office_url()
 | 
			
		||||
        if url:
 | 
			
		||||
 | 
			
		||||
            dt = detail.date_time
 | 
			
		||||
            txnkey = f'{detail.employee_number}-{detail.register_number}-{detail.transaction_number}'
 | 
			
		||||
            rendered_url = f'{url}/admin/LookupReceipt/RenderReceiptPage.php?year={dt.year}&month={dt.month}&day={dt.day}&receipt={txnkey}'
 | 
			
		||||
            raw_url = f'{url}/admin/LookupReceipt/RawReceipt.php?date={dt.date()}&trans={txnkey}'
 | 
			
		||||
 | 
			
		||||
            return [
 | 
			
		||||
                self.make_xref_button(url=rendered_url,
 | 
			
		||||
                                      text="View in CORE Office (rendered)"),
 | 
			
		||||
                self.make_xref_button(url=raw_url,
 | 
			
		||||
                                      text="View in CORE Office (raw)"),
 | 
			
		||||
            ]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue