Exemple #1
0
def _make_receipt_email(address, sale):
    out = []
    out.append("From: Open Produce <*****@*****.**>")
    out.append("To: %s"%(address))
    out.append("Subject: Open Produce sale receipt")
    out.append("")
    out.append("Here is a receipt for your purchase on %s."%(
        sale.time_ended.strftime("%m/%d/%y %H:%M:%S")))
    if sale.clerk:
        out.append("Clerk: %s"%(sale.clerk.name))
    out.append("")
    for si in sale.items:
        out.append(si.item.name)
        out.append("                %s"%(
            money.moneyfmt(si.total, curr='$', sep='')))
    if db.PAYMENT[sale.payment] == 'void':
        out.append("Sale void, no payment.")
    else:
        out.append("Total: %s paid with %s."%(
            money.moneyfmt(sale.total, curr='$', sep=''),
            db.PAYMENT[sale.payment]))
    out.append("")
    if sale.customer and sale.customer.balance:
        out.append("Your current tab balance is %s."%(
            money.moneyfmt(decimal.Decimal(sale.customer.balance),
                curr='$', sep='')))
    out.append("")
    out.append("Thanks for shopping at Open Produce!")
    return out
Exemple #2
0
def _make_card_receipt_tex(sale, paid, merchant_copy=False):
    out = [
"""\\nonstopmode
\documentclass[12pt]{article}
\usepackage[paperwidth=7cm,top=1cm]{geometry}
\\pagestyle{empty}
\usepackage{epsfig}
\\begin{document}
\epsfig{file=logo.eps,width=4cm,height=1.5cm}
\parindent=0pt
\\vskip 0.2cm
{\small 1635 E. 55th St.}\n\n
{\small Chicago, IL 60615}\n\n
{\small (773) 496-4327}
\\vskip 0.5cm
{\Large \sf \\bf CARD RECEIPT}
""",
    ]
    out.append(sale.time_ended.strftime("\n%m/%d/%y %H:%M:%S\n\n"))
    out.append("\\vskip 0.5cm\n")
    if sale.clerk:
        out.append("{\\small Clerk: %s}\n\n"%(sale.clerk.name))
    out.append("{\\small Card brand: %s}\n\n"%(sale.cc_brand))
    out.append("{\\small Last 4 of card: %s}\n\n"%(sale.cc_last4))
    out.append("{\\small Card expires: xx/xx}\n\n")
    if sale.cc_name:
        out.append("{\\small Holder:\n\n \\textsf{%s}}\n\n"%(sale.cc_name))
    out.append("{\\small Trans. type: Sale (Swiped)}\n\n")
    out.append("{\\small Trans. ID:} {\\tiny %s}\n\n"%(sale.cc_trans))
    out.append("{\\small Auth. code:} {\\tiny %s}\n\n" % (sale.cc_auth))
    if merchant_copy:
        out.append("{\\small PNRef:} {\\tiny %s}\n\n" % (sale.cc_pnref))
    out.append("\\textbf{\\small Total:} \$%s\n\n"%(
        money.moneyfmt(paid, curr='', sep='')))
    if merchant_copy:
        out.append("""\\vskip 0.4cm\n{\\scriptsize I agree to pay the above amount \n\n according to the cardholder agreement.}
        \\vskip 0.2cm
{\\small Signature:}

\\vskip 2em
\\hline

\\vskip 0.5cm
""")
    if sale.customer and sale.customer.balance:
        out.append("{\small Tab balance:} \$%s\n\n"%(
            money.moneyfmt(decimal.Decimal(sale.customer.balance),
                curr='', sep='')))
    out.append("""
\\vskip 2.0cm

.
""")
    out.append("\end{document}\n")
    return out
Exemple #3
0
 def __str__(self):
     if self.sale_unit is None:
         return moneyfmt(self.unit_cost, curr='$', sep='')
     else:
         return moneyfmt(self.unit_cost, curr='$', sep='')
Exemple #4
0
def _make_receipt_tex(sale):
    out = [
"""\\nonstopmode
\documentclass[12pt]{article}
\usepackage[paperwidth=7cm,top=0cm,left=.25cm,right=.25cm]{geometry}
\\pagestyle{empty}
\usepackage{epsfig}
\\begin{document}
\\hskip .75cm
\\epsfig{file=logo.eps,width=4cm,height=1.5cm}
\parindent=0pt
\\vskip 0.2cm
\\begin{center}
{\small 1635 E. 55th St.}\n\n
{\small Chicago, IL 60615}\n\n
{\small (773) 496-4327}\n\n
www.openproduce.org\\\\
\\vskip 0.3cm
{\Large \sf \\bf SALE RECEIPT}\n\n
\\end{center}
{\scriptsize Returns, exchanges, and refunds are allowed at manager's discretion and as required by law. Bargain items cannot be returned.  To comply with Chicago's health code, frozen and refrigerated items cannot be returned for a refund, and may only be exchanged for the same item.  On all other items, only the person who made the original purchase may request a refund.\par}\n\n
\\begin{center}
""",
    ]
    out.append(sale.time_ended.strftime("%m/%d/%y %H:%M:%S\n"))
    out.append("\\end{center}\n\n")
    if sale.clerk:
        out.append("\nClerk: %s\n\n"%(sale.clerk.name))
    out.append("""
\\vskip 0.3cm
\\vskip 3pt
\\hrule
\\vskip 3pt
""")
    def size_unit(i):
        if i.size_unit.name != 'each' and i.size_unit.name != 'count':
            return ' [%.1f %s]'%(i.size, i.size_unit)
        return ''
    total_tax = 0
    for si in sale.items:
        name = 'other/grocery'
        qty = si.quantity
        unit = ''
        unit_cost = money.moneyfmt(si.unit_cost, curr='\$', sep='')
        tax = ''
        total = money.moneyfmt(si.total, curr='\$', sep='')
        if si.item:
            name = si.item.name
            unit = ''.join(['/',si.item.price.sale_unit.name])
            tax = str(si.item.tax_rate)
            total_tax += si.tax
        out.append("%s\n\n\\hskip 1cm %.2f @ %s%s = %s\n\n"%(name, qty, unit_cost, unit, total))
        out.append("\\hskip 2cm (tax = %s)\n\n" % money.moneyfmt(si.tax, curr='', sep=''))

    out.append("""
\\vskip 3pt
\\hrule
\\vskip 3pt
""")
    out.append("(Total Tax: \$%s)\n\n" % money.moneyfmt(total_tax, curr='', sep=''))
    out.append("Total: \$%s\n\n"%(
        money.moneyfmt(sale.total, curr='', sep='')))
    if db.PAYMENT[sale.payment] == 'void':
        out.append("Sale void, no payment.\n\n")
    else:
        out.append("Paid with %s.\n\n"%(db.PAYMENT[sale.payment]))
    if sale.customer and sale.customer.balance:
        out.append("Tab balance: \$%s\n\n"%(
            money.moneyfmt(decimal.Decimal(sale.customer.balance),
                curr='', sep='')))
	out.append("{\small Customer: %s}\n\n" % sale.customer.name)	
    out.append("""
\\vskip 0.5cm
\\begin{center}
Thanks for shopping!\n\n
\\vskip 0.2cm
{\\large \\textbf{Open 8am--2am every day}}
\end{center}
%\\vspace*{4cm}
\\vskip 1.5cm

.
""")
    out.append("\end{document}\n")
    return out