mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 05:39:12 +00:00
@@ -0,0 +1,74 @@
|
|||||||
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.provide("erpnext.cheque_print");
|
||||||
|
|
||||||
|
frappe.ui.form.on('Cheque Print Template', {
|
||||||
|
refresh: function(frm) {
|
||||||
|
if(!frm.doc.__islocal) {
|
||||||
|
frm.add_custom_button(frm.doc.has_print_format?__("Update Print Format"):__("Create Print Format"),
|
||||||
|
function() {
|
||||||
|
erpnext.cheque_print.view_cheque_print(frm);
|
||||||
|
}).addClass("btn-primary");
|
||||||
|
|
||||||
|
$(frm.fields_dict.cheque_print_preview.wrapper).empty()
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<div style="position: relative; overflow-x: scroll;">\
|
||||||
|
<div id="cheque_preview" style="width: {{ cheque_width }}cm; \
|
||||||
|
height: {{ cheque_height }}cm;\
|
||||||
|
background-image: url({{ scanned_cheque }});\
|
||||||
|
background-repeat: no-repeat;\
|
||||||
|
background-size: cover;">\
|
||||||
|
<span style="top: {{ acc_pay_dist_from_top_edge }}cm;\
|
||||||
|
left: {{ acc_pay_dist_from_left_edge }}cm;\
|
||||||
|
border-bottom: solid 1px;border-top:solid 1px;\
|
||||||
|
position: absolute;"> {{ message_to_show || __("Account Pay Only") }} </span>\
|
||||||
|
<span style="top: {{ date_dist_from_top_edge }}cm;\
|
||||||
|
left: {{ date_dist_from_left_edge }}cm;\
|
||||||
|
position: absolute;"> {{ frappe.datetime.obj_to_user() }} </span>\
|
||||||
|
<span style="top: {{ acc_no_dist_from_top_edge }}cm;\
|
||||||
|
left: {{ acc_no_dist_from_left_edge }}cm;\
|
||||||
|
position: absolute;"> Acc. No. </span>\
|
||||||
|
<span style="top: {{ payer_name_from_top_edge }}cm;\
|
||||||
|
left: {{ payer_name_from_left_edge }}cm;\
|
||||||
|
position: absolute;"> Payer Name </span>\
|
||||||
|
<span style="top:{{ amt_in_words_from_top_edge }}cm;\
|
||||||
|
left: {{ amt_in_words_from_left_edge }}cm;\
|
||||||
|
position: absolute;\
|
||||||
|
display: block;\
|
||||||
|
width: {{ amt_in_word_width }}cm;\
|
||||||
|
line-height: {{ amt_in_words_line_spacing }}cm;\
|
||||||
|
word-wrap: break-word;"> Amount in Words </span>\
|
||||||
|
<span style="top: {{ amt_in_figures_from_top_edge }}cm;\
|
||||||
|
left: {{ amt_in_figures_from_left_edge }}cm;\
|
||||||
|
position: absolute;"> 1000 </span>\
|
||||||
|
<span style="top: {{ signatory_from_top_edge }}cm;\
|
||||||
|
left: {{ signatory_from_left_edge }}cm;\
|
||||||
|
position: absolute;"> Signatory Name </span>\
|
||||||
|
</div>\
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
$(frappe.render(template, frm.doc)).appendTo(frm.fields_dict.cheque_print_preview.wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
erpnext.cheque_print.view_cheque_print = function(frm) {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.accounts.doctype.cheque_print_template.cheque_print_template.create_or_update_cheque_print_format",
|
||||||
|
args:{
|
||||||
|
"template_name": frm.doc.name
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if (!r.exe && !frm.doc.has_print_format) {
|
||||||
|
var doc = frappe.model.sync(r.message);
|
||||||
|
frappe.set_route("Form", r.message.doctype, r.message.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
frappe.msgprint(__("Print settings updated in respective print format"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
from frappe import _
|
||||||
|
|
||||||
|
class ChequePrintTemplate(Document):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def create_or_update_cheque_print_format(template_name):
|
||||||
|
if not frappe.db.exists("Print Format", template_name):
|
||||||
|
cheque_print = frappe.new_doc("Print Format")
|
||||||
|
cheque_print.update({
|
||||||
|
"doc_type": "Journal Entry",
|
||||||
|
"standard": "No",
|
||||||
|
"custom_format": 1,
|
||||||
|
"print_format_type": "Server",
|
||||||
|
"name": template_name
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
cheque_print = frappe.get_doc("Print Format", template_name)
|
||||||
|
|
||||||
|
doc = frappe.get_doc("Cheque Print Template", template_name)
|
||||||
|
|
||||||
|
cheque_print.html = """
|
||||||
|
<div style="position: relative; top:%(starting_position_from_top_edge)scm">
|
||||||
|
<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
|
||||||
|
<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
|
||||||
|
border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
|
||||||
|
%(message_to_show)s
|
||||||
|
</span>
|
||||||
|
<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
|
||||||
|
position: absolute;">
|
||||||
|
{{doc.cheque_date or '' }}
|
||||||
|
</span>
|
||||||
|
<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
|
||||||
|
position: absolute;">
|
||||||
|
{{ doc.account_no }}
|
||||||
|
</span>
|
||||||
|
<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
|
||||||
|
position: absolute;">
|
||||||
|
{{doc.pay_to_recd_from}}
|
||||||
|
</span>
|
||||||
|
<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
|
||||||
|
position: absolute; display: block; width: %(amt_in_word_width)scm;
|
||||||
|
line-height:%(amt_in_words_line_spacing)scm; word-wrap: break-word;">
|
||||||
|
{{doc.total_amount_in_words}}
|
||||||
|
</span>
|
||||||
|
<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
|
||||||
|
position: absolute;">
|
||||||
|
{{doc.get_formatted("total_amount")}}
|
||||||
|
</span>
|
||||||
|
<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
|
||||||
|
position: absolute;">
|
||||||
|
{{doc.company}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>"""%{
|
||||||
|
"starting_position_from_top_edge": doc.starting_position_from_top_edge \
|
||||||
|
if doc.cheque_size == "A4" else 0.0,
|
||||||
|
"cheque_width": doc.cheque_width, "cheque_height": doc.cheque_height,
|
||||||
|
"acc_pay_dist_from_top_edge": doc.acc_pay_dist_from_top_edge,
|
||||||
|
"acc_pay_dist_from_left_edge": doc.acc_pay_dist_from_left_edge,
|
||||||
|
"message_to_show": doc.message_to_show if doc.message_to_show else _("Account Pay Only"),
|
||||||
|
"date_dist_from_top_edge": doc.date_dist_from_top_edge,
|
||||||
|
"date_dist_from_left_edge": doc.date_dist_from_left_edge,
|
||||||
|
"acc_no_dist_from_top_edge": doc.acc_no_dist_from_top_edge,
|
||||||
|
"acc_no_dist_from_left_edge": doc.acc_no_dist_from_left_edge,
|
||||||
|
"payer_name_from_top_edge": doc.payer_name_from_top_edge,
|
||||||
|
"payer_name_from_left_edge": doc.payer_name_from_left_edge,
|
||||||
|
"amt_in_words_from_top_edge": doc.amt_in_words_from_top_edge,
|
||||||
|
"amt_in_words_from_left_edge": doc.amt_in_words_from_left_edge,
|
||||||
|
"amt_in_word_width": doc.amt_in_word_width,
|
||||||
|
"amt_in_words_line_spacing": doc.amt_in_words_line_spacing,
|
||||||
|
"amt_in_figures_from_top_edge": doc.amt_in_figures_from_top_edge,
|
||||||
|
"amt_in_figures_from_left_edge": doc.amt_in_figures_from_left_edge,
|
||||||
|
"signatory_from_top_edge": doc.signatory_from_top_edge,
|
||||||
|
"signatory_from_left_edge": doc.signatory_from_left_edge
|
||||||
|
}
|
||||||
|
|
||||||
|
cheque_print.save(ignore_permissions=True)
|
||||||
|
|
||||||
|
frappe.db.set_value("Cheque Print Template", template_name, "has_print_format", 1)
|
||||||
|
|
||||||
|
return cheque_print
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
# test_records = frappe.get_test_records('Cheque Print Template')
|
||||||
|
|
||||||
|
class TestChequePrintTemplate(unittest.TestCase):
|
||||||
|
pass
|
||||||
BIN
erpnext/docs/assets/img/articles/attach_scanned_copy.png
Normal file
BIN
erpnext/docs/assets/img/articles/attach_scanned_copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
erpnext/docs/assets/img/articles/cheque_print.gif
Normal file
BIN
erpnext/docs/assets/img/articles/cheque_print.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 MiB |
BIN
erpnext/docs/assets/img/articles/create_print_format.png
Normal file
BIN
erpnext/docs/assets/img/articles/create_print_format.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
BIN
erpnext/docs/assets/img/articles/cueque_print_preview.png
Normal file
BIN
erpnext/docs/assets/img/articles/cueque_print_preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
BIN
erpnext/docs/assets/img/articles/cueque_print_template.png
Normal file
BIN
erpnext/docs/assets/img/articles/cueque_print_template.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
BIN
erpnext/docs/assets/img/articles/journal_entry_cheque_print.png
Normal file
BIN
erpnext/docs/assets/img/articles/journal_entry_cheque_print.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
@@ -0,0 +1,36 @@
|
|||||||
|
#Cheque Print
|
||||||
|
|
||||||
|
** Whats is Cheque Print? **
|
||||||
|
|
||||||
|
You can choose to print Cheques at the time of making payments to Creditors/ parties during Voucher Entry i.e., directly from the Payment Vouchers and Inter-bank payment or transfers through Contra Vouchers.
|
||||||
|
|
||||||
|
###Setup Cheque Print
|
||||||
|
|
||||||
|
To enable cheque printing,
|
||||||
|
|
||||||
|
1. Create cheque settings under `Accounts > Cheque Print Template`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can see a preview of cheque print by attaching scanned copy of cheque to avoid miss printing.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
2. After saving cheque print settings, you can Create / Update print format for settings.
|
||||||
|
|
||||||
|
To create print format, click on `Create Print Format`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you have already created a Print Format, you can update it by clicking on `Update Print Format`.
|
||||||
|
|
||||||
|
3. You will see newly created / updated print format under Journal Entry.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
###Cheque Print
|
||||||
|
|
||||||
|

|
||||||
@@ -12,4 +12,5 @@ fiscal-year-creation
|
|||||||
post-dated-cheque-entry
|
post-dated-cheque-entry
|
||||||
update-stock-option-in-sales-invoice
|
update-stock-option-in-sales-invoice
|
||||||
what-is-the-differences-of-total-and-valuation-in-tax-and-charges
|
what-is-the-differences-of-total-and-valuation-in-tax-and-charges
|
||||||
withdrawing-salary-from-owners-equity-account
|
withdrawing-salary-from-owners-equity-account
|
||||||
|
cheque-print
|
||||||
Reference in New Issue
Block a user