Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding Voice Auction workflows. Removing FC-specific stuff. Defaults …

…file.
  • Loading branch information...
commit 5fdb414145c5689ddadb08dc74d515fc7ee6784f 1 parent 4eb2dc3
@chmarr authored
View
9 artshow/cashier.py
@@ -16,7 +16,8 @@
from django.conf import settings
from django.core.exceptions import ValidationError
from decimal import Decimal
-import logging, datetime
+import logging
+import datetime
import invoicegen
logger = logging.getLogger ( __name__ )
from django.contrib import messages
@@ -168,10 +169,11 @@ class PrintInvoiceForm ( forms.Form ):
def do_print_invoices ( request, invoice_id, copy_names ):
try:
invoicegen.print_invoices ( [invoice_id], copy_names, to_printer=True )
- except invoicegen.PrintingError:
+ except invoicegen.PrintingError, x:
messages.error ( request, "Printing failed. Please ask administrator to consult error log" )
+ logger.error ( "Printing failed with exception: %s", x )
else:
- messages.info ( request, "Invoice has been sent to the printer" )
+ messages.info ( request, "Invoice %s has been sent to the printer" % invoice_id )
@permission_required ( 'artshow.add_invoice' )
@@ -188,7 +190,6 @@ def print_invoice ( request, invoice_id ):
return_to = form.cleaned_data['return_to']
if not return_to:
return_to = "artshow.views.index"
- messages.info ( request, "Invoice %s has been sent to the printer." % invoice.id )
return redirect ( return_to )
messages.error ( request, "Print Invoice request is invalid" )
View
51 artshow/default_settings.py
@@ -0,0 +1,51 @@
+"""List of all Artshow Jockey settings. Those that can have reasonable
+defaults have their defaults set here. Those that must be overridden
+have been set to the _UNCONFIGURED object, which will be checked during
+startup of the artshow application. _DISABLED is to leave a non-critical
+feature disabled"""
+
+_UNCONFIGURED = object()
+_DISABLED = object()
+
+# These are the "PaymentType" IDs used by various procedures
+ARTSHOW_SPACE_FEE_PK = 3
+ARTSHOW_PAYMENT_SENT_PK = 5
+ARTSHOW_COMMISSION_PK = 6
+ARTSHOW_SALES_PK = 7
+
+# name of the model handling people, in "app.model" format
+ARTSHOW_PERSON_CLASS = "peeps.Person"
+
+# name of the module used to print forms, in python path format
+ARTSHOW_PREPRINT_MODULE = "artshow.preprint_dummy"
+
+ARTSHOW_SHOW_NAME = "Generic Art Show"
+ARTSHOW_SHOW_YEAR = "1999"
+ARTSHOW_TAX_RATE = "0.10" # Used to initialise a Decimal object
+ARTSHOW_TAX_DESCRIPTION = "Fictitious County 10% Tax"
+ARTSHOW_EMAIL_SENDER = "Generic Art Show <artshow@example.com>"
+ARTSHOW_COMMISSION = "0.1" # Used to initialise a Decimal object
+ARTSHOW_INVOICE_PREFIX = "1999-" # Prefixed on all printed invoices
+ARTSHOW_EMAIL_FOOTER = """\
+--
+Random J Hacker
+Generic Art Show Lead.
+artshow@example.com - http://www.example.com/artshow
+"""
+ARTSHOW_CHEQUE_THANK_YOU = "Thank you for exhibiting at Generic Art Show"
+ARTSHOW_BLANK_BID_SHEET = "artshow/files/BidSheet.pdf"
+ARTSHOW_BLANK_CONTROL_FORM = "artshow/files/ControlForm.pdf"
+
+# The in-build form printing code uses this font to print piece barcodes.
+# Specify as a 2-tuple: ( "font name", "font path" )
+ARTSHOW_BARCODE_FONT = ('Free3of9', 'artshow/files/free3of9/FREE3OF9.TTF')
+ARTSHOW_SCANNER_DEVICE = "/dev/ttyUSB0"
+
+# Set this to "True" to prevent all standard logins from making edits to
+# piece details. Best used when this database is no longer the "master".
+ARTSHOW_SHUT_USER_EDITS = False
+
+# Command to send a text file to the printer. Eg: enscript
+ARTSHOW_PRINT_COMMAND = _DISABLED
+ARTSHOW_AUTOPRINT_INVOICE = [ "CUSTOMER COPY", "MERCHANT COPY", "PICK LIST" ]
+ARTSHOW_MONEY_PRECISION = 2
View
BIN  artshow/files/FCBidSheetSingle.pdf
Binary file not shown
View
BIN  artshow/files/FCNFSSheetSingle.pdf
Binary file not shown
View
BIN  artshow/files/PrecisionID C39 04.ttf
Binary file not shown
View
BIN  artshow/files/blank_bid_sheet.pdf
Binary file not shown
View
BIN  artshow/files/blank_control_form.pdf
Binary file not shown
View
BIN  artshow/files/free3of9/FRE3OF9X.TTF
Binary file not shown
View
BIN  artshow/files/free3of9/FREE3OF9.TTF
Binary file not shown
View
71 artshow/files/free3of9/FREE3OF9.TXT
@@ -0,0 +1,71 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Font: Free 3 of 9 Barcode (free3of9.ttf)
+Created By: Matthew Welch
+E-Mail: daffy-duck@worldnet.att.net
+Web Address: http://home.att.net/~daffy-duck
+ (PGP public key available here)
+
+Free 3 of 9, like all of my fonts, is free. You can use it for most
+personal or business uses you'd like, and I ask for no money. I
+would, however, like to hear from you. If you use my fonts for
+something please send me a postcard or e-mail letting me know how
+you used it. Send me a copy if you can or let me know where I can
+find your work.
+
+You may use this font for graphical or printed work, but you may not
+sell it or include it in a collection of fonts (on CD or otherwise)
+being sold. You can redistribute this font as long as you charge
+nothing to receive it. If you redistribute it include this text file
+with it as is (without modifications).
+
+If you use this font for commercial purposes please credit me in
+at least some little way.
+
+About the font:
+
+Can you believe there are people who would charge you for a barcode
+font like this? It took very little time to make this so I thought
+I'd donate it to the world. It is suitable for scanning even at
+fairly small point sizes (with a laser printer). I have tested
+printed copies of this font with a couple different scanners and it
+worked perfectly.
+
+This is 3 of 9 (sometimes called "code 39"), a widely used barcode
+standard that includes capital letters, numbers, and several symbols.
+This is not the barcode for UPC's (universal price codes) found on
+products at the store. However, most kinds of barcode scanners will
+recognize 3 of 9 just fine.
+
+To create a valid 3 of 9 barcode you have to begin and end it with
+a special character. Scanners look for this character to know
+where to start and stop reading the barcode. It is represented in
+this font with the '*' character. So, to create a barcode for the
+text "ABC123" you have to type out "*ABC123*". Note that barcode
+readers will not include the *'s in the text they return. They will
+just give you the "ABC123".
+
+Two versions of 3 of 9 are included. The font called "Free 3 of 9" is
+the basic 3 of 9 standard. It includes letters and these symbols: $ %
++ - . and /. The font called "Free 3 of 9 Extended" covers the
+extended 3 of 9 standard. It includes all the ASCII characters.
+
+Special note to MS Word users: There is a default setting in Word
+that changes text surrounded by *'s into bold text. This setting must
+be disabled for these fonts to work, otherwise the * characters that
+are necessary for the barcode to scan properly will be lost and the
+thickness of the bars will be altered. I have a copy of Word '97. The
+setting might be found in a different place in other versions but
+this is how I disabled it. From the Tools menu open the AutoCorrect
+dialog box. On the AutoFormat tab uncheck the box for "*Bold* and
+_underline_"
+
+
+-----BEGIN PGP SIGNATURE-----
+Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
+
+iQA/AwUBOmY8/uEM8BJ4ZA+2EQLSDgCgqHT1WtBW34v7JAQr4+1zCzUaeGgAn2uu
+stjL0d7RVR5C5p2zpks371e9
+=jqNv
+-----END PGP SIGNATURE-----
View
6 artshow/invoicegen.py
@@ -7,6 +7,7 @@
import sys
import subprocess
from django.conf import settings
+from default_settings import _DISABLED as SETTING_DISABLED
from StringIO import StringIO
import re
from logging import getLogger
@@ -100,7 +101,7 @@ def write_header ():
def write_footer ():
for i in range( max_lines_per_page - lines_this_page ):
buffer.write (invoice_spacer)
- buffer.write ( non_last_invoice_footer % { 'copystr': copy_name.center(60) } )
+ buffer.write ( invoice_footer % { 'copystr': copy_name.center(60) } )
def write_item ( name_wrapped, price ):
for l in name_wrapped[:-1]:
@@ -182,6 +183,9 @@ def print_invoices ( invoices, copy_names, to_printer=False ):
if not sbuf.getvalue():
logger.error ( "nothing to generate" )
elif to_printer:
+ if settings.ARTSHOW_PRINT_COMMAND is SETTING_DISABLED:
+ logger.error ( "Cannot print invoice. ARTSHOW_PRINT_COMMAND is DISABLED" )
+ raise PrintingError ( "Printing is DISABLED in configuration" )
p = subprocess.Popen ( settings.ARTSHOW_PRINT_COMMAND, stderr=subprocess.PIPE, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True )
output, error = p.communicate ( sbuf.getvalue() )
if output:
View
24 artshow/templates/artshow/auction_bids.html
@@ -0,0 +1,24 @@
+{% extends "artshow/base_generic.html" %}
+{% block content %}
+<h1>Enter Voice Auction Bids &mdash; {% if adult %}Adult{% else %}General{% endif %}</h1>
+<form method="post">
+{% csrf_token %}{{ formset.management_form }}
+<table>
+<tr><th rowspan="2">Code</th><th rowspan="2">Artist</th><th rowspan="2">Title</th><th colspan="2">Sheet</th><th rowspan="2">Action</th><th colspan="2">New</th></tr>
+<tr><th>Bidder</th><th>Amount</th><th>Bidder</th><th>Amount</th></tr>
+{% for form in formset %}
+<tr>
+ <td>{{ form.piece }}{{ form.initial.piece.code }}</td>
+ <td>{{ form.initial.piece.artist.artistname }}</td>
+ <td>{{ form.initial.piece.name }}</td>
+ <td>{{ form.initial.piece.top_bid.bidder.bidder_ids|join:", " }}</td>
+ <td>{{ form.initial.piece.top_bid.amount }}</td>
+ <td>{{ form.id }}{{ form.action }}</td>
+ <td>{{ form.bidder }}</td>
+ <td>{{ form.amount }}</td>
+</tr>
+{% endfor %}
+</table>
+<input type="submit" value="Submit" />
+</form>
+{% endblock %}
View
4 artshow/templates/artshow/dataentry.html
@@ -6,8 +6,8 @@
<li><a href="{% url artshow.addbidder.bulk_add %}">Add Bidders</a></li>
<li>Auction Ordering
<ul>
- <li><a href="{% url artshow.auction_ordering.order_auction adult='y' %}">Adult</a></li>
- <li><a href="{% url artshow.auction_ordering.order_auction adult='n' %}">General</a></li>
+ <li><a href="{% url artshow.voice_auction.order_auction adult='y' %}">Adult</a></li>
+ <li><a href="{% url artshow.voice_auction.order_auction adult='n' %}">General</a></li>
</ul>
</li>
View
1  artshow/urls.py
@@ -9,6 +9,7 @@
(r'^entry/$', 'views.dataentry' ),
(r'^entry/bidders/$', 'addbidder.bulk_add' ),
(r'^entry/bids/$', 'addbidder.bid_bulk_add' ),
+ (r'^entry/auction_bids/(?P<adult>[yn])/$', 'voice_auction.auction_bids' ),
(r'^entry/order_auction/(?P<adult>[yn])/$', 'voice_auction.order_auction' ),
#(r'^entry/bids/location/(?P<location>[^/]+)/$', 'bidentry.add_bids' ),
(r'^reports/$', 'reports.index' ),
View
51 artshow/voice_auction.py
@@ -1,6 +1,6 @@
-from artshow.models import Piece
+from artshow.models import Piece, Bid
from django import forms
-from django.forms.models import modelformset_factory
+from django.forms.models import modelformset_factory, formset_factory
from django.contrib.auth.decorators import permission_required
from django.shortcuts import render, redirect
from django.contrib import messages
@@ -36,3 +36,50 @@ def order_auction ( request, adult ):
return render ( request, "artshow/order_auction.html", {'formset':formset, 'adult':adult} )
+
+
+
+class AuctionBidForm ( forms.ModelForm ):
+
+ ACTION_CHOICES = (
+ ( 0, "Defer" ),
+ ( 1, "To Bid Sheet" ),
+ ( 2, "Outbid" ),
+ )
+
+ action = forms.ChoiceField ( choices=ACTION_CHOICES, initial=0, widget=forms.RadioSelect )
+
+ class Meta:
+ model = Bid
+ fields = ( "action", "piece", "bidder", "amount" )
+ widgets = {
+ 'bidder': forms.TextInput,
+ 'piece': forms.HiddenInput,
+ }
+
+
+AuctionBidFormSet = formset_factory ( AuctionBidForm, extra=0 )
+
+
+def auction_bids ( request, adult ):
+
+ adult = adult=="y"
+ pieces = Piece.objects.filter ( voice_auction=True, adult=adult ).order_by ( "order", "artist", "pieceid" )
+
+ initial_data = [ {'piece':p} for p in pieces ]
+ logger.debug ( "initial_data %s", initial_data )
+
+ if request.method == "POST":
+ pass
+ else:
+ formset = AuctionBidFormSet ( initial=initial_data )
+
+ for index, f in enumerate(formset):
+ logger.debug ( "form %d %s", index, dir(f) )
+
+ return render ( request, "artshow/auction_bids.html", { 'formset':formset, 'adult':adult } )
+
+
+
+
+
View
9 artshowjockey/common_settings.py
@@ -168,12 +168,3 @@
AJAX_SELECT_INLINES = 'inline'
LOGIN_REDIRECT_URL = "/"
-
-ARTSHOW_SPACE_FEE_PK = 3
-ARTSHOW_PAYMENT_SENT_PK = 5
-ARTSHOW_COMMISSION_PK = 6
-ARTSHOW_SALES_PK = 7
-
-ARTSHOW_PERSON_CLASS = "peeps.Person"
-
-ARTSHOW_PREPRINT_MODULE = "artshow.preprint_dummy"
View
3  local_settings.py.example
@@ -1,4 +1,5 @@
from artshowjockey.common_settings import *
+from artshow.default_settings import *
# This is, probably, the minimum set of settings attributes that
# should be specified for your installation.
@@ -35,7 +36,7 @@ Generic Art Show Lead.
artshow@example.com - http://www.example.com/artshow
"""
ARTSHOW_CHEQUE_THANK_YOU = "Thank you for exhibiting at Generic Art Show"
-ARTSHOW_PRINT_COMMAND = "enscript -P Samsung -B -L 66 -f Courier-Bold10"
+ARTSHOW_PRINT_COMMAND = "enscript -P Samsung -B -L 66 -f Courier-Bold10 -q"
ARTSHOW_AUTOPRINT_INVOICE = [ "CUSTOMER COPY", "MERCHANT COPY", "PICK LIST" ]
ARTSHOW_BLANK_BID_SHEET = "artshow/files/blank_bid_sheet.pdf"
ARTSHOW_SCANNER_DEVICE = "/dev/ttyUSB0"
Please sign in to comment.
Something went wrong with that request. Please try again.