"Good day, sir. . ."

Well this isn’t even very close. – just a repeated, “Good afternoon.” I’m now even more positive that the familiar formulation is from Wonka.

And lacking the “I said” and the “sir”, which are integral to the quote.

No. The book has no screw-ups by Charlie and Grandpa Joe, and no reason for Wonka to play the head game that he did in the movie. It was just “farewell to Mike Teevee, congratulations Charlie, you win the factory, let’s go pick up your folks in the Great Glass Elevator, The End, don’t forget to buy Willy Wonka and the Great Glass Elevator”.

Couple of quotes from Dickens’ A Christmas Carol:

One can imagine the increasing forcefulness of Scrooge’s repeated utterance as Fred continues to needle him.

While it is not the exact quote from Willy Wonka, it clearly is said in much the same spirit and I don’t think it would be that far of a stretch to imagine “Good day” used in an identical context in that day and age.

And for all your Victorian-casual needs, might we suggest the following item?

ETA Damn you, kaylasdad! Good day, sir!

(It really wasn’t as good an ending, dramatically speaking, as the movie’s was. Rather anticlimactic, in fact.)

Here, btw, is a previous thread on this topic: Origin of quote, "I said GOOD DAY, sir!" - Factual Questions - Straight Dope Message Board

Although the definitive “I said good day!” construction may come from Willy Wonka, the practice of using “good morning” or some other greeting as a dismissal was certainly in use much earlier. Even Tolkien used it:

I remember that Andy Dick’s character (Matthew) said the exact phrase to Phil Hartman’s character (Bill) on News Radio…
(sure a shame that Hartman’s crazy, coked up wife didnt also shoot Andy Dick when she gunned down Phil Hartman and herself—would have almost been worth the loss of P.H.)

On reflection, I agree that Foghorn Leghorn is an unlikely source.

All I can say is that if no one turns up a direct use from at least Wodehouse or somesuch, I will truly have had my ignorance fought on this subject.

Bumped.

A repeated “Good morning” is also used dismissively in this Monty Python sketch: Monty Python: Secret Service Dentists

I think the origin of this as an oft-quoted phrase is almost certainly Willy Wonka and the Chocolate Factory.

However, a quick search of Google Books turned up a couple of much earlier examples of someone trying to end a conversation by saying “Good day, sir”, the other person trying to continue making their point, and the first person firmly saying “I said ‘Good day, sir.’” See for instance this piece from an 1916 Literary Digest and Opie Read’s 1896 An Arkansas Planter. But while Read was a well-known humorist in his day, I didn’t turn up any evidence that this was considered a memorable line in his book and I doubt many people saying “I said ‘Good day, sir!’” today have even heard of An Arkansas Planter.

I believe he also says “I bid you good day, gentlemen!” to the philanthropists soliciting contributions for the poor. This was the first thing that came to my mind.

It’s a very polite way of telling someone to fuck off.

Didn’t Rufus T. Firefly say it to Ambassador Trentino in Duck Soup (1933)?

Or maybe it was the Groucho character in Monkey Business (1931) who said it to the gangster character just before he stepped back into Thelma Todd’s closet.

Appears in this Robot Chicken sketch

Bumped.

William Shakespeare says “Cheerio” repeatedly to get rid of an uninvited fanboy visiting him in retirement in the very good historical drama All Is True, which I just saw.

Several have mentioned Christmas Carol. There are dozens of adaptations of this work floating around. The first instance I’m aware of the phrase appearing on film is in the 1951 version starring Alastair Sim. The scene where nephew Fred stops by Scrooge’s office to invite him to dine. Scrooge gets frustrated near the end of their interaction when Fred says “Merry Christmas” and dismisses him with a ‘good day, sir’. Then Fred adds ‘And a happy New Year’ and Scrooge explodes raising his voice “GOOD DAY!”

On Everybody Loves Raymond, Ray uses it on his parents after Marie drives the car into his living room.