Skip to main content

Handling Product Returns Without Invoice Numbers

Overview

This guide explains how to enable product returns in Ultimate POS version 6.10 when customers don't have their invoice numbers. The solution involves allowing negative quantities in POS transactions.

⚠️ Version Note: This guide has been updated and tested for Ultimate POS v6.10. Version 6.10 introduced additional JavaScript validation that requires extra steps compared to v6.9.

✅ Verified Working: All code examples in this guide have been tested and confirmed working in v6.10.

Prerequisites

  • Administrative access to Ultimate POS files
  • Basic knowledge of file editing
  • Understanding of role permissions in Ultimate POS
  • Important: Create a backup of your files before making changes

Step 1: Modify the Quantity Input Field

Navigate to the product row template file:

resources/views/sale_pos/product_row.blade.php

Find the Input Field

Locate the quantity input field that contains the data-min="1" attribute (around line 250):

<input
type="text"
data-min="1"
style="width: auto"
class="form-control pos_quantity input_number mousetrap input_quantity"
name="products[{{$row_count}}][quantity]"
...
/>

Remove the Minimum Restriction

Remove the data-min="1" attribute from the input field:

<input
type="text"
style="width: auto"
class="form-control pos_quantity input_number mousetrap input_quantity"
name="products[{{$row_count}}][quantity]"
...
/>
tip

This change allows users to enter negative values in the quantity field, which is essential for processing returns.

Step 2: Modify JavaScript Validation (NEW for v6.10)

⚠️ NEW REQUIREMENT: Version 6.10 added JavaScript validation that automatically converts negative quantities to 1. This must be modified.

Navigate to the JavaScript file:

public/js/pos.js

Find the Quantity Validation Code

Locate the quantity validation code (around lines 390-395):

var entered_qty = __read_number($(this));
// Allow negative quantities for returns, but prevent zero
if (entered_qty == 0) {
entered_qty = 1;
__write_number($(this), entered_qty);
}
// Note: Negative quantities are now allowed for processing returns

Modify to Allow Negative Quantities

Replace the validation logic with code that allows negative quantities and zero for returns:

var entered_qty = __read_number($(this));
// Allow negative quantities for returns and zero quantities
// Only prevent invalid negative values (less than -999)
if (entered_qty < -999) {
entered_qty = 1;
__write_number($(this), entered_qty);
}
// Note: Negative quantities are now allowed for processing returns
Critical Issue

Why this change is essential: The original code converts quantities of 0 back to 1, preventing users from decrementing below 1. This means:

  • User clicks decrement button to go: 1 → 0
  • JavaScript immediately changes 0 back to 1
  • User can never decrement below 1
  • Cannot enter negative quantities for returns

Without this fix, the decrement buttons and manual entry of negative quantities will never work for returns!

Step 3: Fix Increment/Decrement Buttons (ADDITIONAL for v6.10)

⚠️ ADDITIONAL REQUIREMENT: The quantity increment/decrement buttons also need modification to allow going below 0.

Navigate to the common JavaScript file:

public/js/common.js

Find the Button Handler Code

Locate the quantity-down button handler (around lines 329-342):

} else if ($(this).hasClass('quantity-down')) {
//if min reached return false
if (typeof min != 'undefined' && qty - step < min) {
return false;
}

__write_number(input, qty - step);
input.change();
}

Modify to Allow Negative for POS

Replace with code that allows POS quantities to go negative:

} else if ($(this).hasClass('quantity-down')) {
// Allow negative quantities for POS returns, but respect min for other inputs
var isPosQuantity = input.hasClass('pos_quantity');
if (!isPosQuantity && typeof min != 'undefined' && qty - step < min) {
return false;
}
// For POS quantities, only prevent going below -999 (reasonable limit)
if (isPosQuantity && qty - step < -999) {
return false;
}

__write_number(input, qty - step);
input.change();
}
Button Functionality

With this fix, you can now use the minus (-) button to decrement below 0: 1 → 0 → -1 → -2 → -3 for processing returns.

Step 4: Set Up Role Permissions

Create appropriate role permissions to control who can process returns with negative quantities.

Security Note

Not all staff members should have permission to create transactions with negative quantities. Set up proper role restrictions to prevent misuse.

Step 5: Processing Returns

Once the code modification is complete, follow these steps to process a return:

  1. Create a new transaction/sale

    • Go to the POS interface
    • Start a new transaction
  2. Add returned products

    • Search and add the products being returned
    • Use barcode scanning if available
  3. Enter negative quantities

    • For each returned item, enter a negative quantity
    • Example: -1 for returning 1 item, -2 for returning 2 items
  4. Complete the transaction

    • Process the transaction as normal
    • The system will automatically subtract the items from inventory

Benefits

  • No invoice required: Process returns without needing the original receipt
  • Automatic inventory adjustment: Negative quantities properly update stock levels
  • Audit trail: All return transactions are recorded in the system
  • Flexible processing: Handle various return scenarios
Invoice Numbering

Each return transaction will increment the invoice numbering sequence. This means that processing returns will consume invoice numbers just like regular sales transactions.

Version 6.10 Specific Considerations

Changes from v6.9

  • New JavaScript validation was added that requires modification
  • New button handler validation prevents decrement below 0
  • The HTML template changes remain the same as v6.9
  • Three total modifications needed instead of one

Validation Behavior

  • Zero quantities: Now allowed (essential for decrementing below 1)
  • Negative quantities: Now allowed for returns processing
  • Positive quantities: Work normally as before
  • Extreme negatives: Prevented below -999 to avoid data corruption

Important Considerations

  • Backup your files before making any modifications
  • Test thoroughly in a development environment first
  • Clear browser cache after making JavaScript changes
  • Train staff on the new return process
  • Monitor return transactions for any unusual activity
  • Review role permissions regularly

Required Files for v6.10 (Complete List)

  1. resources/views/sale_pos/product_row.blade.php - Remove data-min="1"
  2. public/js/pos.js - Allow negative quantities in validation
  3. public/js/common.js - Allow decrement buttons to go below 0
v6.10 Update Note

If you upgrade from v6.9 to v6.10 and were using the old guide, you MUST implement ALL THREE modifications (Steps 1, 2, and 3) or negative quantities will not work properly.

Testing the Fix

After implementing the changes, test the functionality:

  1. Clear browser cache to ensure JavaScript changes take effect
  2. Go to POS screen and add any product
  3. Test decrement button: Should allow going 1 → 0 → -1 → -2
  4. Test manual entry: Should allow typing negative values like -5
  5. Verify calculations: Negative quantities should create negative line totals

If decrement buttons still won't go below 1, double-check that you've made all three modifications correctly.

💛 Support this project

Premium Login