From: Stroller <lin...@my...> - 2006-11-03 11:42:12
|
Hi there, I want to make an SQL-Ledger variable field display in my invoice =20 only if the value is greater than one. Is there any way to achieve =20 this? I'm guessing not, but throw it out for discussion just in case; =20= I don't want to modify SL itself to do this - it's not important =20 enough for me to maintain a patchset, but it'd be kinda cute for me =20 if it were possible. What I want to do is make the quantity & price fields display only if =20= the customer has bought more than one item: Part no. Description Price Qty = Amount FH001 French Hen =A310 x 3 = =A330=09 TD001 Turtle Dove =A310 x 2 = =A320 PA001 Partridge in a Pear Tree = =A310 TOTAL = =A360 I've laid out the above with tabs, so I hope it displays as well on =20 other clients as it does on my Mac. Anyway, I suspect this is an =20 unusual request & not possible, but I would prefer being able to use =20 such a simplified & "user friendly" format in my invoices. I have tried: \begin{tabularx}{\textwidth}{lXrlr} Part & Description & Price & & Amount \\ <%foreach number%> <%number%> & <%description%> & \pounds <%sellprice%> & <%if qty%> x <%qty%> <%end qty%> & \pounds <%linetotal%> \\ % end of table row <%end number%> \end{tabularx} But of course the minimum quantity of 1 always triggers the if-=20 statement. Stroller.= |
From: Stroller <lin...@my...> - 2006-11-04 13:10:46
|
On 4 Nov 2006, at 06:39, Dr Eberhard Lisse wrote: > > Everything is possible, and it is always helpful to read the archives, > if one could find them :-)-O Ha! Indeed!! Actually, I didn't at expect this to be possible, so I only Googled a few pages. > By the way, the way I read your example it will display the Price no > matter how many purchased Yes, indeed. This is what I meant when I said "of course the minimum quantity of 1 always triggers the if-statement." Sorry if I was unclear in that. > ...so try this fragment: > > \usepackage{ifthen} > \usepackage{numprint} > > \begin{tabularx}{\textwidth}{lXrlr} > Part & Description & Price & & Amount \\ > <%foreach number%> > <%number%> & > <%description%> & > % \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{\pounds <%sellprice%>} > {}}}}& \ifthenelse{\lengthtest{<%qty%>pt>1pt}{\pounds <%sellprice%>}{}} & > % \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{x <%qty%>}{}}}} & \ifthenelse{\lengthtest{<%qty%>pt>1pt}{x <%qty%>}{}} & > \pounds <%linetotal%> \\ % end of table row > <%end number%> > \end{tabularx} Many thanks! You caught me with your spot-the-deliberate-mistakes, but managed to see them when comparing with the ifthen.dvi documentation. Many thanks for your help - I'm very grateful. Stroller. |
From: Stroller <lin...@my...> - 2006-11-04 13:58:03
|
On 4 Nov 2006, at 13:10, Stroller wrote: > On 4 Nov 2006, at 06:39, Dr Eberhard Lisse wrote: >> ...so try this fragment: >> >> \usepackage{ifthen} >> \usepackage{numprint} >> >> \begin{tabularx}{\textwidth}{lXrlr} >> Part & Description & Price & & Amount \\ >> <%foreach number%> >> <%number%> & >> <%description%> & >> % \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{\pounds <%sellprice%>} >> {}}}}& > \ifthenelse{\lengthtest{<%qty%>pt>1pt}{\pounds <%sellprice%>}{}} & >> % \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{x <%qty%>}{}}}} & > \ifthenelse{\lengthtest{<%qty%>pt>1pt}{x <%qty%>}{}} & >> \pounds <%linetotal%> \\ % end of table row >> <%end number%> >> \end{tabularx} Ooops! My bad. That bracketing prevents the /pounds from showing on my system. I _think_ this is right: \begin{tabularx}{\textwidth}{lXrlr} Part & Description & Price & Quantity & Amount \\ <%foreach number%> <%number%> & <%description%> & \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{\pounds <%sellprice%>}{} & \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{x <%qty%>}{} & \pounds <%linetotal%> \\ % end of table row <%end number%> \end{tabularx} Stroller. |
From: Stroller <lin...@my...> - 2006-11-04 20:18:31
|
On 4 Nov 2006, at 16:31, Dr Eberhard Lisse wrote: > Take the \pounds out everywhere and let me know if it otherwise works. Sorry, I didn't explain clearly. I did a number of "minimal case" test documents and - at least on the invoices I have tried - this bracketing works perfectly: >> \begin{tabularx}{\textwidth}{lXrlr} >> Part & Description & Price & Quantity & Amount \\ >> <%foreach number%> >> <%number%> & >> <%description%> & >> \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{\pounds <%sellprice%>} >> {} & >> \ifthenelse{\lengthtest{<%qty%>pt>1pt}}{x <%qty%>}{} & >> \pounds <%linetotal%> \\ % end of table row >> <%end number%> >> \end{tabularx} Stroller. |
From: Dr E. L. <el...@li...> - 2006-11-05 05:14:12
|
Cool, I have the tendency not to fix what is working :-)-O, but maybe I'll at a $ to my own invoices :-)-O el on 11/4/06 9:47 PM Stroller said the following: > On 4 Nov 2006, at 16:31, Dr Eberhard Lisse wrote: > >> Take the \pounds out everywhere and let me know if it otherwise works. > > Sorry, I didn't explain clearly. I did a number of "minimal case" > test documents and - at least on the invoices I have tried - this > bracketing works perfectly: > |