Stripping Work Order Notes From Sales Receipt Using the Print Template

2>

39 comments

  • jonassmetsjonassmets Member Posts: 40 ✭

    Hi @Adrian Samuel.

    How about stripping the notes from the receipt all together? As far as I understand now we use Javascript to hide them? But what about just deleting them? Would that work? I only need the notes on a work order receipt and not on the sales receipt?


    Jonas

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    @jonassmets you could do that, a simple display:none in CSS would accomplish that. However when it comes to completing that workorder and generating a sale, there will be nothing to show for those lines

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • laurielaurie Member Posts: 10 ✭

    @Adrian Samuel, I think the code to strip out the Work Order notes is stripping the some of the work order item descriptions on the Sales receipt but not all. Can this be fixed?


  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @laurie,

    Thank you for the heads up on that! I've update the code in the gist so you can get the new code here and you should find that it works accordingly whilst maintaining the old functionality:

    https://gist.github.com/Adrian-Samuel/efdc1511f825c36903f19577b395e178

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • laurielaurie Member Posts: 10 ✭

    Perfect, thank you so much!


    Is there a way to remove the # 1 and $0.00 price next to the Work Order # line? It's a bit confusing to the customer to see a $0 next to what is actually a title line with detail and prices below.

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @laurie,

    Since that's not a workflow that's necessarily reflected across the spectrum of our customers, i've written a custom snippet for you below, but in future, please seek this assistance of our development partners who will be able to support and assist in your development requests if you desire any more changes.

    These development partners can be found on our page here:

    document.addEventListener("DOMContentLoaded", () => {
        const lines_with_notes = document.querySelectorAll('.line_note');
        lines_with_notes.forEach(line => {
            const parentRow = line.parentElement.parentElement;
            Array.from(parentRow.children)
                .filter((element, idx) => idx > 0)
                .forEach(element => {
                    element.style.cssText = "visibility:hidden"
                })
            const line_content = line.innerText;
            if (/Work order/gi.test(line_content)) {
                const firstLine = line_content.split(/\n/g)[0];
                line.innerHTML = line_content.replace(line_content, firstLine);
            }
        });
    });
    

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • Scott MerrittScott Merritt Member Posts: 2

    I have tried multiple times to insert code and it seems to be still printing the internal notes. I am trying to remove printed notes in SaleReceipt.

    The codes dont seem to be working.

    please advise

  • Ruben_van_heeRuben_van_hee Member, Lightspeed Staff Posts: 1 Lightspeed

    @jonassmets Hi again!

    As Adrian stated, javascript is indeed not accepted in email clients. Any JS framework is also not accepted in the iPad printing function.

    I may have a css solution to hide the workorder notes though. You should be able to keep the line height of the items at the same height as the font. In that way, the workorder notes shouldn't show up in the receipt print.

    Something like:

    div.line_note {height:16px; overflow:hidden;}

Sign In or Register to comment.