stamp and signs

remotes/origin/yandex
Bachurin Sergey 12 years ago
parent 1a9c219592
commit 9994ded72d
  1. 1
      project/customer/views/bank_accounts.py
  2. 2
      project/docs/forms/email.py
  3. 1
      project/docs/views/aktrabot.py
  4. 10
      project/docs/views/base_views.py
  5. 1
      project/docs/views/invoice.py
  6. 1
      project/docs/views/nakladn.py
  7. 23
      project/templates/docs/aktrabot/as_pdf.html
  8. 30
      project/templates/docs/email/base_email_form.html
  9. 12
      project/templates/docs/invoice/as_pdf.html
  10. 51
      project/templates/docs/nakladn/as_pdf.html

@ -40,7 +40,6 @@ def bank_accounts_add(request):
form = form_class(data=request.POST)
if form.is_valid():
new_account = form.save(commit=False)
print new_account
new_account.company = request.user.profile
new_account.save()
return redirect(success_url)

@ -15,5 +15,7 @@ class EmailForm(forms.Form):
widget=forms.Textarea(attrs={'cols': 80, 'rows': 3}))
doc_format = forms.ChoiceField(label=u'Отправить как', choices=DOC_FORMATS, initial=DOC_FORMATS[0][0],
widget=forms.RadioSelect())
insert_sign = forms.BooleanField(label=u'Вставить печать и подпись', initial=False,
required=False)
save_client_email = forms.BooleanField(label=u'Сохранить этот e-mail в анкете контрагента', initial=False,
required=False)

@ -41,6 +41,7 @@ class AktRabotViews(BaseItemsViews, AddByInvoiceMethodMixin):
PDF_TEMPLATE = 'docs/aktrabot/as_pdf.html'
XLS_TEMPLATE = 'aktrabot.xls'
FILENAME = u'Акт выполненных работ № %s, %s' # без расширения
MAYBE_SIGNED = True
# --- грамматика для вывода наименований в шаблонах
PADEJI = {

@ -95,6 +95,7 @@ class BaseViews(object):
PDF_TEMPLATE = ''
XLS_TEMPLATE = ''
FILENAME = u'Документ № %s, %s' # без расширения
MAYBE_SIGNED = False
# --- константы для вывода наименований в шаблонах
PADEJI = {
@ -229,6 +230,7 @@ class BaseViews(object):
'obj_list_count_before_filtering': obj_list_count_before_filtering,
'email_form': email_form,
'template_create_docs': self.TEMPLATE_CREATE_DOCS,
'maybe_sign': self.MAYBE_SIGNED,
}
self.update_list_dict(dictionary)
return render(self.request, self.TEMPLATE_LIST, dictionary)
@ -363,6 +365,7 @@ class BaseViews(object):
'obj_items': None,
'profile': profile,
'main_account': main_account,
'doc_sign': kwargs.get('doc_sign', True),
}
c1 = time()
pdf = render_pdf_to_string(self.request, self.PDF_TEMPLATE, params)
@ -459,7 +462,7 @@ class BaseViews(object):
else:
return HttpResponseServerError('Server error. Try later.')
def send_email(self, subject, to, body, files):
def send_email(self, subject, to, body, files, sign_doc):
"""Отправка письма."""
dict_context = {'body': body, 'support_email': SUPPORT_EMAIL,}
email_body = render_to_string(self.EMAIL_MSG_TEMPLATE, dict_context)
@ -480,6 +483,7 @@ class BaseViews(object):
client.save()
doc_format = form.cleaned_data['doc_format']
kwargs['doc_sign'] = form.cleaned_data.get('insert_sign', False)
if doc_format in ('pdf', 'xls',):
files = []
filename = self.get_filename(*args, **kwargs)
@ -500,7 +504,8 @@ class BaseViews(object):
subject = u'%s' % filename, # тема письма = имя файла без расширения
to = form.cleaned_data['to'],
body = form.cleaned_data['body'],
files = files
files = files,
sign_doc = form.cleaned_data.get('save_client_email', None)
)
return False # что-то пошло не так
@ -794,6 +799,7 @@ class BaseItemsViews(BaseViews):
'obj_items': obj_items,
'profile': profile,
'main_account': main_account,
'doc_sign': kwargs.get('doc_sign', True),
}
c1 = time()
pdf = render_pdf_to_string(self.request, self.PDF_TEMPLATE, params)

@ -43,6 +43,7 @@ class InvoiceViews(BaseItemsViews):
PDF_TEMPLATE = 'docs/invoice/as_pdf.html'
XLS_TEMPLATE = 'invoice.xls'
FILENAME = u'Счет № %s, %s' # без расширения
MAYBE_SIGNED = True
# --- грамматика для вывода наименований в шаблонах
PADEJI = {

@ -43,6 +43,7 @@ class NakladnViews(BaseItemsViews, AddByInvoiceMethodMixin):
PDF_TEMPLATE = 'docs/nakladn/as_pdf.html'
XLS_TEMPLATE = 'nakladn.xls'
FILENAME = u'Накладная № %s, %s' # без расширения
MAYBE_SIGNED = True
# --- грамматика для вывода наименований в шаблонах
PADEJI = {

@ -21,6 +21,7 @@
.center { text-align: center; }
.top { vertical-align: top; }
.bottom { vertical-align: bottom; }
.bold { font-weight: bold; }
.font_8 { font-size: 8pt; }
@ -145,10 +146,18 @@
<tr><td colspan="5">{# пустая строка #}</td></tr>
<tr>
<td width="22%" class="bottom_border">{# место для подписи #}</td>
<td width="23%" class="bottom_border center">{{ profile.get_boss_fio }}</td>
<td width="22%" class="bottom_border bottom">
{# место для подписи #}
{% if doc_sign and profile.boss_sign %}
<img src="{{ profile.boss_sign.path }}" />
{% else %}
{% endif %}
</td>
<td width="23%" class="bottom_border center bottom">{{ profile.get_boss_fio }}</td>
<td width="10%">
<td width="22%" class="bottom_border">{# место для подписи #}</td>
<td width="22%" class="bottom_border">
{# место для подписи #}
</td>
<td width="23%" class="bottom_border center">{{ obj.client.contact_name }}</td>
</tr>
@ -163,7 +172,13 @@
<tr><td colspan="5">{# пустая строка #}</td></tr>
<tr class="font_12 center">
<td colspan="2">М. П.</td>
<td colspan="2">
{% if doc_sign and profile.stamp %} {# TODO передавать флаг из вьюхи #}
<img src="{{ profile.stamp.path }}" /> {# печать #}
{% else %}
М. П.
{% endif %}
</td>
<td></td>
<td colspan="2">М. П.</td>
</tr>

@ -45,15 +45,18 @@
<div class="clear"></div>
</div>
<div class="buttons">
{% if not is_ajax %}
<input type="submit" name="submit" value="Отправить" />
<input type="submit" name="_cancel" value="Отмена" />
{% else %}
<button type="submit" role="button" name="submit">Отправить</button>
<button class="close-form" type="button" role="close" name="close-form">Отмена</button>
{% endif %}
{% if maybe_sign %}
<div id="insert_sign" class="field">
<div style="float: left; width: 346px; font-size: 11px; margin-top: 5px; word-break: break-all;">
<label for="{{ form.insert_sign.auto_id }}">
{{ form.insert_sign }}
Вставить подписи и печать
</label>
{% if not is_ajax %}{{ form.insert_sign.errors }}{% endif %}
</div>
<div class="clear"></div>
</div>
{% endif %}
<div id="save_client_email" class="field">
<div style="float: left; width: 346px; font-size: 11px; margin-top: 5px; word-break: break-all;">
@ -66,5 +69,16 @@
</div>
<div class="clear"></div>
</div>
<div class="buttons">
{% if not is_ajax %}
<input type="submit" name="submit" value="Отправить" />
<input type="submit" name="_cancel" value="Отмена" />
{% else %}
<button type="submit" role="button" name="submit">Отправить</button>
<button class="close-form" type="button" role="close" name="close-form">Отмена</button>
{% endif %}
</div>
</form>
</div>

@ -149,7 +149,7 @@
<b>{{ obj.sum_full_total_price|to_float|rubles|capfirst }}. {{ obj.doc_text|safe }}</b>
</div>
{% if obj.add_sign_and_stamp and profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
{% if doc_sign and profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
<table width="100%"> {# не делать отступ, если нужно вставить подпись руководителя #}
{% else %}
<table width="100%" style="padding-top:3ex;">
@ -166,7 +166,7 @@
{{ profile.get_boss_title }}
</td>
<td class="bottom_border">
{% if profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
{% if doc_sign and profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
<img src="{{ profile.boss_sign.path }}" /> {# подпись руководителя #}
{% endif %}
</td>
@ -182,7 +182,7 @@
<tr>
<td colspan="2">Главный бухгалтер</td>
<td class="bottom_border">
{% if profile.glavbuh_sign %} {# TODO передавать флаг из вьюхи #}
{% if doc_sign and profile.glavbuh_sign %} {# TODO передавать флаг из вьюхи #}
<img src="{{ profile.glavbuh_sign.path }}" /> {# подпись главбуха #}
{% else %}
<br />&nbsp;
@ -197,10 +197,10 @@
<tr>
<td colspan="2">Главный бухгалтер</td>
<td class="bottom_border">
{% if profile.glavbuh_sign %}
{% if doc_sign and profile.glavbuh_sign %}
<img src="{{ profile.glavbuh_sign.path }}" /> {# подпись главбуха #}
{% else %}
{% if profile.boss_sign %}
{% if doc_sign and profile.boss_sign %}
<img src="{{ profile.boss_sign.path }}" /> {# или подпись руководителя #}
{% else %}
<br />&nbsp;
@ -219,7 +219,7 @@
<tr>
<td></td>
<td colspan="2" class="left">
{% if obj.add_sign_and_stamp and profile.stamp %} {# TODO передавать флаг из вьюхи #}
{% if doc_sign and profile.stamp %} {# TODO передавать флаг из вьюхи #}
<img src="{{ profile.stamp.path }}" /> {# печать #}
{% endif %}
</td>

@ -497,12 +497,16 @@
<td width="14%"></td>
</tr>
<tr>
<td>Отпуск груза разрешил</td>
<td colspan="2" class="bottom_border"></td>
<td class='bottom'>Отпуск груза разрешил</td>
<td colspan="2" class="bottom_border">{{ profile.boss_title|default:'' }}</td>
<td></td>
<td class="bottom_border"></td>
<td class="bottom_border center bottom">
{% if doc_sign and profile.boss_sign %}
<img src="{{ profile.boss_sign.path }}" /> {# или подпись руководителя #}
{% endif %}
</td>
<td></td>
<td class="center bottom_border">{{ profile.get_boss_fio }}</td>
<td class="center bottom_border bottom">{{ profile.get_boss_fio }}</td>
<td class="right_border"></td>
{# правая половина #}
<td></td>
@ -521,15 +525,19 @@
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td colspan="3">Главный (старший) бухгалтер</td>
<td colspan="3" class="bottom">Главный (старший) бухгалтер</td>
<td></td>
<td class="bottom_border"></td>
<td class="bottom bottom_border">
{% if doc_sign and profile.glavbuh_sign %}
<img src="{{ profile.glavbuh_sign.path }}" /> {# подпись главбуха #}
{% endif %}
</td>
<td></td>
<td class="center bottom_border">{{ profile.get_glavbuh_fio }}</td>
<td class="center bottom_border bottom">{{ profile.get_glavbuh_fio }}</td>
<td class="right_border"></td>
{# правая половина #}
<td></td>
<td>Груз принял</td>
<td class="bottom">Груз принял</td>
<td class="bottom_border"></td>
<td></td>
<td class="bottom_border"></td>
@ -595,7 +603,13 @@
<table width="100%" class="left font_8">
<tr>
<td width="10%" class="font_10 right">М.П.</td>
<td width="10%" class="font_10 right">
{% if not doc_sign or not profile.stamp %} {# TODO передавать флаг из вьюхи #}
М. П.
{% else %}
&nbsp;
{% endif %}
</td>
<td width="3%"></td>
<td width="1%" class="right">«</td>
<td width="2%" class="bottom_border"></td>
@ -618,6 +632,25 @@
<td width="5%" class="bottom_border"></td>
<td width="13%">года</td>
</tr>
<tr>
<td colspan="10" class="left">
{% if doc_sign and profile.stamp %} {# TODO передавать флаг из вьюхи #}
<img src="{{ profile.stamp.path }}" /> {# печать #}
{% endif %}
</td>
{# правая половина #}
<td width="1%"></td>
<td width="10%" class="font_10 right"></td>
<td width="3%"></td>
<td width="1%"></td>
<td width="2%"></td>
<td width="1%"></td>
<td width="1%"></td>
<td width="13%"></td>
<td width="1%"></td>
<td width="5%"></td>
<td width="13%"></td>
</tr>
</table>
</div>

Loading…
Cancel
Save