Barcode with qty

is it possible to fetch the quantity when scanning a barcode in a sales invoice.

hii @Rajkumudu_Rk

Yes, when you scan a barcode, fetch the item and item quantity fields using the Frappe database API (query).

Example:

function get_item_details_from_barcode(barcode) {
    return new Promise((resolve, reject) => {
        // Query the local Stock Doctype data to find item details based on the barcode
        frappe.db.get_value('Item', [["Item Barcode","barcode","=",barcode]], ['name','quantity']).then(result => {
            if (result) {
                resolve(result);
            } else {
                reject();
            }
        }).catch(error => {
            reject(error);
        });
    });
}

Thank you for your quick response

Actually we need to get the quantity from the barcode.similar to weighted item in pos billing.
We plan to print along with name and qty on the barcode. Is it possible to fetch the item and quantity included in the barcode?

@Rajkumudu_Rk

To print a barcode with the name and quantity, you can generate the barcode using JavaScript. It will include both the item name and quantity. For generating a custom barcode and printing, you can refer to the following links: