[pos] [minor] pos completed
This commit is contained in:
parent
cf0b6d579f
commit
12425ce85e
@ -2,14 +2,14 @@
|
||||
{
|
||||
"creation": "2011-12-21 11:08:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-29 17:40:19",
|
||||
"modified": "2013-08-30 12:46:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doc_type": "Sales Invoice",
|
||||
"doctype": "Print Format",
|
||||
"html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n\tvar oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n <tr>\\\n <td colspan=\"3\">------------------------------------------------------</td>\\\n </tr>\\\n <tr>\\\n <td width=\"60%\" align=\"left\">ITEM CODE/DESC.</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">RATE</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"3\">------------------------------------------------------</td>\\\n </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n\t\trows += '<tr>\\\n <td align=\"left\">' + oc[x].item_code + '<br>' + oc[x].item_name + '</td>\\\n <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n <td align=\"right\"><strong>' + format_currency(oc[x].export_amount) + '</strong><br>' + format_currency(oc[x].ref_rate) + '</td>\\\n </tr>';\n\t}\n rows += '<tr>\\\n <td colspan=\"3\">------------------------------------------------------</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\">Net Total</td>\\\n <td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n </tr>';\n if (doc.other_charges_total_export != 0) {\n var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount) + '</td>\\\n \t\t\t<tr>';\n\t\t});\n }\n rows += '<tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Grand Total</td>\\\n <td align=\"right\">==============<br>' + format_currency(doc.grand_total_export) + '<br>==============</td>\\\n </tr>\\\n <tr>\\\n <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n </tr>\\\n </table>';\n\treturn rows;\n}\n</script>\n<style>\n table, tr, td, div {\n font-family: Monospace;\n line-height: 200%;\n }\n h1, h2, h3, h4, h5, h6 {\n text-align: center;\n }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n <tr>\n <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n </tr>\n <tr>\n <td>M/s <script>doc.customer</script></td>\n </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n",
|
||||
"html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n\tvar oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td width=\"60%\" align=\"left\">ITEM CODE/DESC.</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">RATE</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n\t\trows += '<tr>\\\n <td align=\"left\">' + oc[x].item_code + '<br>' + oc[x].item_name + '</td>\\\n <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n <td align=\"right\" valign=\"top\">' + format_currency(oc[x].export_amount) + '</td>\\\n </tr>';\n\t}\n rows += '<tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\">Net Total</td>\\\n <td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n </tr>';\n if (doc.other_charges_total_export != 0) {\n var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount) + '</td>\\\n \t\t\t<tr>';\n\t\t});\n }\n rows += '<tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Grand Total</td>\\\n <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n <hr width=\"90%\" align=\"right\"></td>\\\n </tr>\\\n <tr>\\\n <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n </tr>\\\n </table>';\n\treturn rows;\n}\n</script>\n<style>\n table, tr, td, div, p {\n font-family: Monospace;\n line-height: 200%;\n }\n h1, h2, h3, h4, h5, h6 {\n text-align: center;\n }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n <tr>\n <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n </tr>\n <tr>\n <td>M/s <script>doc.customer</script></td>\n </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"print_format_type": "Client",
|
||||
|
@ -7,7 +7,7 @@ from webnotes import msgprint, _
|
||||
from webnotes.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
def __init__(self,doc,doclist):
|
||||
self.doc, self.doclist = doc,doclist
|
||||
|
||||
def get_series(self):
|
||||
@ -18,6 +18,7 @@ class DocType:
|
||||
return series and series[0] or ''
|
||||
|
||||
def validate(self):
|
||||
self.prev_user = webnotes.conn.get_value("POS Setting", self.doc.name, "user")
|
||||
self.check_for_duplicate()
|
||||
self.validate_expense_account()
|
||||
|
||||
@ -36,4 +37,17 @@ class DocType:
|
||||
def validate_expense_account(self):
|
||||
if cint(webnotes.defaults.get_global_default("auto_inventory_accounting")) \
|
||||
and not self.doc.expense_account:
|
||||
msgprint(_("Expense Account is mandatory"), raise_exception=1)
|
||||
msgprint(_("Expense Account is mandatory"), raise_exception=1)
|
||||
|
||||
def on_update(self):
|
||||
webnotes.defaults.clear_default("is_pos")
|
||||
|
||||
pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
|
||||
for user in pos_view_users:
|
||||
if user:
|
||||
webnotes.defaults.set_user_default("is_pos", 1, user)
|
||||
else:
|
||||
webnotes.defaults.set_global_default("is_pos", 1)
|
||||
|
||||
def on_trash(self):
|
||||
self.on_update()
|
@ -199,13 +199,16 @@ erpnext.POS = Class.extend({
|
||||
})).appendTo($wrap);
|
||||
});
|
||||
|
||||
$("div.pos-item").on("click", function() {
|
||||
if(!cur_frm.doc.customer) {
|
||||
msgprint("Please select customer first.");
|
||||
return;
|
||||
}
|
||||
me.add_to_cart($(this).attr("data-item_code"));
|
||||
});
|
||||
// if form is local then allow this function
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
$("div.pos-item").on("click", function() {
|
||||
if(!cur_frm.doc.customer) {
|
||||
msgprint("Please select customer first.");
|
||||
return;
|
||||
}
|
||||
me.add_to_cart($(this).attr("data-item_code"));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -303,33 +306,45 @@ erpnext.POS = Class.extend({
|
||||
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc.grand_total_export,
|
||||
cur_frm.doc.price_list_currency));
|
||||
|
||||
$("input.qty").on("focus", function() {
|
||||
$(this).select();
|
||||
});
|
||||
// if form is local then only run all these functions
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
$("input.qty").on("focus", function() {
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
// append quantity to the respective item after change from input box
|
||||
$("input.qty").on("change", function() {
|
||||
var item_code = $(this).closest("tr")[0].id;
|
||||
me.update_qty(item_code, $(this).val(), true);
|
||||
});
|
||||
// append quantity to the respective item after change from input box
|
||||
$("input.qty").on("change", function() {
|
||||
var item_code = $(this).closest("tr")[0].id;
|
||||
me.update_qty(item_code, $(this).val(), true);
|
||||
});
|
||||
|
||||
// on td click toggle the highlighting of row
|
||||
$("#cart tbody tr td").on("click", function() {
|
||||
var row = $(this).closest("tr");
|
||||
if (row.attr("data-selected") == "false") {
|
||||
row.attr("class", "warning");
|
||||
row.attr("data-selected", "true");
|
||||
}
|
||||
else {
|
||||
row.prop("class", null);
|
||||
row.attr("data-selected", "false");
|
||||
}
|
||||
me.refresh_delete_btn();
|
||||
|
||||
});
|
||||
|
||||
// on td click toggle the highlighting of row
|
||||
$("#cart tbody tr td").on("click", function() {
|
||||
var row = $(this).closest("tr");
|
||||
if (row.attr("data-selected") == "false") {
|
||||
row.attr("class", "warning");
|
||||
row.attr("data-selected", "true");
|
||||
}
|
||||
else {
|
||||
row.prop("class", null);
|
||||
row.attr("data-selected", "false");
|
||||
}
|
||||
me.refresh_delete_btn();
|
||||
|
||||
});
|
||||
|
||||
me.refresh_delete_btn();
|
||||
cur_frm.pos.barcode.$input.focus();
|
||||
cur_frm.pos.barcode.$input.focus();
|
||||
}
|
||||
|
||||
// if form is submitted & cancelled then disable all input box & buttons
|
||||
if (cur_frm.doc.docstatus>=1) {
|
||||
me.wrapper.find('input, button').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$(".delete-items").hide();
|
||||
$(".make-payment").hide();
|
||||
}
|
||||
},
|
||||
refresh_delete_btn: function() {
|
||||
$(".delete-items").toggle($(".item-cart .warning").length ? true : false);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_items(price_list, item=None, item_group=None):
|
||||
|
@ -26,9 +26,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}
|
||||
}
|
||||
|
||||
if(this.frm.doc.is_pos) {
|
||||
// toggle to pos view if is_pos is 1 in user_defaults
|
||||
if (cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos();
|
||||
cur_frm.cscript.toggle_pos(true);
|
||||
}
|
||||
|
||||
// if document is POS then change default print format to "POS Invoice"
|
||||
if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1) {
|
||||
locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice";
|
||||
cur_frm.setup_print();
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(doc, dt, dn) {
|
||||
@ -94,7 +103,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Show POS button only if it enabled from features setup
|
||||
if(cint(sys_defaults.fs_pos_view)===1)
|
||||
cur_frm.cscript.pos_btn();
|
||||
},
|
||||
@ -115,13 +125,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.cscript.toggle_pos();
|
||||
cur_frm.cscript.pos_btn();
|
||||
}, icon);
|
||||
|
||||
},
|
||||
|
||||
toggle_pos: function(show) {
|
||||
// if(cint(sys_defaults.fs_pos_view)===0) return;
|
||||
// if(!(this.frm.doc.is_pos && this.frm.doc.docstatus===0)) return;
|
||||
|
||||
toggle_pos: function(show) {
|
||||
if (!this.frm.doc.selling_price_list)
|
||||
msgprint(wn._("Please select Price List"))
|
||||
else {
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-09 14:45:42",
|
||||
"modified": "2013-09-01 05:26:13",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
"autoname": "naming_series:",
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Transaction",
|
||||
"icon": "icon-file-text",
|
||||
|
@ -257,4 +257,6 @@ patch_list = [
|
||||
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16",
|
||||
"patches.august_2013.p06_fix_sle_against_stock_entry",
|
||||
"execute:webnotes.bean('Style Settings').save() #2013-08-20",
|
||||
"patches.september_2013.p01_add_user_defaults_from_pos_setting",
|
||||
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02",
|
||||
]
|
1
patches/september_2013/__init__.py
Normal file
1
patches/september_2013/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
|
||||
for user in pos_view_users:
|
||||
if user:
|
||||
webnotes.defaults.set_user_default("is_pos", 1, user)
|
||||
else:
|
||||
webnotes.defaults.set_global_default("is_pos", 1)
|
Loading…
x
Reference in New Issue
Block a user