[flat discount] added flat discount in print format and all selling doctypes
This commit is contained in:
parent
c53dbc7cdf
commit
aebb844da9
@ -2,14 +2,14 @@
|
||||
{
|
||||
"creation": "2011-12-21 11:08:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-13 17:17:47",
|
||||
"modified": "2013-12-26 14:19:13",
|
||||
"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 var 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 NAME.</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">AMOUNT</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n console.log(oc[x].item_code!=oc[x].item_name);\n\t\trows += '<tr>\\\n <td align=\"left\">' + oc[x].item_code + \n (oc[x].item_code!=oc[x].item_name ? ('<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, doc.currency) + '</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, doc.currency) + '</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 / doc.conversion_rate, doc.currency) + '</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, doc.currency) + '<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",
|
||||
"html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n var 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 NAME</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">AMOUNT</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 + \n (oc[x].item_code!=oc[x].item_name ? ('<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, doc.currency) + '</td>\\\n </tr>';\n\t}\n rows += '<tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\"><b>Net Total</b></td>\\\n <td align=\"right\">' + format_currency(doc.net_total_export, doc.currency) + '</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 / doc.conversion_rate, doc.currency) + '</td>\\\n \t\t\t<tr>';\n\t\t});\n }\n rows += '<tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Flat Discount</td>\\\n <td align=\"right\" style=\"vertical-align:middle;\">' + format_currency(doc.flat_discount, doc.currency) + '</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\"><b>Grand Total</b></td>\\\n <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export, doc.currency) + '<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",
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -25,7 +25,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) {
|
||||
if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos(function() {
|
||||
@ -144,8 +144,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
me.set_default_values();
|
||||
me.set_dynamic_labels();
|
||||
me.calculate_taxes_and_totals();
|
||||
|
||||
if(callback_fn) callback_fn()
|
||||
|
||||
if(callback_fn) callback_fn();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-19 11:10:11",
|
||||
"modified": "2013-12-26 17:50:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -362,13 +362,6 @@
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_discount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flat Discount",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "taxes",
|
||||
@ -459,6 +452,14 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_discount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flat Discount",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "totals",
|
||||
|
@ -19,6 +19,10 @@ cur_frm.pformat.net_total_export = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.flat_discount = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.grand_total_export = function(doc) {
|
||||
return '';
|
||||
}
|
||||
@ -33,10 +37,10 @@ cur_frm.pformat.in_words_export = function(doc) {
|
||||
|
||||
cur_frm.pformat.other_charges= function(doc){
|
||||
//function to make row of table
|
||||
var make_row = function(title,val,bold){
|
||||
var make_row = function(title, val, bold){
|
||||
var bstart = '<b>'; var bend = '</b>';
|
||||
return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:50%;text-align:right;">'+format_currency(val, doc.currency)+'</td>'
|
||||
return '<tr><td style="width:50%;">' + (bold?bstart:'') + title + (bold?bend:'') + '</td>'
|
||||
+'<td style="width:50%;text-align:right;">' + format_currency(val, doc.currency) + '</td>'
|
||||
+'</tr>'
|
||||
}
|
||||
|
||||
@ -52,7 +56,7 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
|
||||
out ='';
|
||||
if (!doc.print_without_amount) {
|
||||
var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges');
|
||||
var cl = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
||||
@ -60,6 +64,7 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
// main table
|
||||
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
|
||||
if(!print_hide('net_total_export')) {
|
||||
out += make_row('Net Total', doc.net_total_export, 1);
|
||||
}
|
||||
@ -68,26 +73,31 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
if(cl.length){
|
||||
for(var i=0;i<cl.length;i++){
|
||||
if(convert_rate(cl[i].tax_amount)!=0 && !cl[i].included_in_print_rate)
|
||||
out += make_row(cl[i].description,convert_rate(cl[i].tax_amount),0);
|
||||
out += make_row(cl[i].description, convert_rate(cl[i].tax_amount), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// flat discount
|
||||
if(!print_hide('flat_discount') && doc.flat_discount) {
|
||||
out += make_row('Flat Discount', doc.flat_discount, 0);
|
||||
}
|
||||
|
||||
// grand total
|
||||
if(!print_hide('grand_total_export')) {
|
||||
out += make_row('Grand Total',doc.grand_total_export,1);
|
||||
out += make_row('Grand Total', doc.grand_total_export, 1);
|
||||
}
|
||||
|
||||
if(!print_hide('rounded_total_export')) {
|
||||
out += make_row('Rounded Total',doc.rounded_total_export,1);
|
||||
out += make_row('Rounded Total', doc.rounded_total_export, 1);
|
||||
}
|
||||
|
||||
if(doc.in_words_export && !print_hide('in_words_export')){
|
||||
out +='</table></td></tr>';
|
||||
out += '<tr><td colspan = "2">';
|
||||
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
|
||||
out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
|
||||
out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>'
|
||||
}
|
||||
out +='</table></td></tr></table></div>';
|
||||
out += '</table></td></tr></table></div>';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -99,7 +109,7 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
|
||||
d.charge_type = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('charge_type',d.name,'other_charges');
|
||||
refresh_field('charge_type', d.name, 'other_charges');
|
||||
cur_frm.cscript.row_id(doc, cdt, cdn);
|
||||
cur_frm.cscript.rate(doc, cdt, cdn);
|
||||
cur_frm.cscript.tax_amount(doc, cdt, cdn);
|
||||
@ -122,7 +132,7 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('row_id',d.name,'other_charges');
|
||||
refresh_field('row_id', d.name, 'other_charges');
|
||||
}
|
||||
|
||||
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
|
||||
@ -152,7 +162,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
d.rate = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('rate',d.name,'other_charges');
|
||||
refresh_field('rate', d.name, 'other_charges');
|
||||
}
|
||||
|
||||
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
|
||||
@ -166,5 +176,5 @@ cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
|
||||
d.tax_amount = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('tax_amount',d.name,'other_charges');
|
||||
refresh_field('tax_amount', d.name, 'other_charges');
|
||||
};
|
@ -79,7 +79,7 @@ def get_columns(invoice_list):
|
||||
|
||||
tax_accounts = webnotes.conn.sql_list("""select distinct account_head
|
||||
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
|
||||
and docstatus = 1 and ifnull(tax_amount, 0) != 0
|
||||
and docstatus = 1 and ifnull(tax_amount_after_flat_discount, 0) != 0
|
||||
and parent in (%s) order by account_head""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
|
||||
|
||||
@ -126,7 +126,8 @@ def get_invoice_income_map(invoice_list):
|
||||
return invoice_income_map
|
||||
|
||||
def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
|
||||
tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
|
||||
tax_details = webnotes.conn.sql("""select parent, account_head,
|
||||
sum(tax_amount_after_flat_discount) as tax_amount
|
||||
from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:08",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-14 17:25:46",
|
||||
"modified": "2013-12-26 17:54:55",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -458,6 +458,13 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_discount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flat Discount",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "totals",
|
||||
@ -863,7 +870,6 @@
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "customer",
|
||||
"role": "Customer",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-18 12:39:59",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:20:16",
|
||||
"modified": "2013-12-26 17:55:43",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -477,6 +477,13 @@
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_discount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flat Discount",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "totals",
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-14 17:26:12",
|
||||
"modified": "2013-12-26 18:01:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -465,7 +465,7 @@
|
||||
"fieldname": "other_charges_total_export",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Taxes and Charges Total",
|
||||
"options": "company",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
@ -487,6 +487,13 @@
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_discount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flat Discount",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "totals",
|
||||
@ -1058,7 +1065,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "customer",
|
||||
"match": "customer_name",
|
||||
"role": "Customer"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user