Add fields to Sales Invoice Print Format

Hello,

I am working at a new Sales Invoice print template.
So, I created a new Prin Format from Setup, and copied the existing Standard one.

But how to:
- add a column with VAT for each item ?
- add my own company details (address etc) ?

I added tax_amount, but perhaps the calculation is not included here:

                [// Here specify the table columns to be displayed
                    ‘SR’, ‘item_name’, ‘description’, ‘qty’, ‘stock_uom’,
                    ‘export_rate’, ‘export_amount’,‘tax_amount’
                ],
                [// Here specify the labels of column headings
                    ‘Sr’, ‘Item Name’, ‘Description’, ‘Qty’,
                    ‘UoM’, ‘Basic Rate’, ‘Amount’,‘VAT’
                ],
                [// Here specify the column widths
                    ‘3%’, ‘20%’, ‘37%’, ‘5%’,
                    ‘5%’, ‘15%’, ‘9%’,‘6%’

Regards



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/5AqrEl0ZJtsJ.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi,

You are right, you will have to calculate the tax for each item.

To do that, you will have to write a function to return the tax amount.

Here is an example:

https://gist.github.com/3953872

See line #150 for the function to return the "tax_amount" column. This assumes you have a field in the main form called vat_rate. You should get the general idea.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 25-Oct-2012, at 1:35 PM, bd <bo...@gmail.com> wrote:

Hello,

I am working at a new Sales Invoice print template.
So, I created a new Prin Format from Setup, and copied the existing Standard one.

But how to:
- add a column with VAT for each item ?
- add my own company details (address etc) ?

I added tax_amount, but perhaps the calculation is not included here:

                [// Here specify the table columns to be displayed
                    'SR', 'item_name', 'description', 'qty', 'stock_uom',
                    'export_rate', 'export_amount','tax_amount'
                ],
                [// Here specify the labels of column headings
                    'Sr', 'Item Name', 'Description', 'Qty',
                    'UoM', 'Basic Rate', 'Amount','VAT'
                ],
                [// Here specify the column widths
                    '3%', '20%', '37%', '5%',
                    '5%', '15%', '9%','6%'

Regards



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/5AqrEl0ZJtsJ.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi,

Thank you for example, I believe I got the idea.
Still, did not manage to show an additional column (even without using any calculation).
Perhaps I am still missing something. This is set also as SalesInvVatCol report on my erpnext.com account.
Do you have any suggestion?


 
<!-- Javascript –>
<script>
    si_std = {
        print_item_table: function() {
            var table = print_table(
                ‘Sales Invoice’,
                doc.name,
                ‘entries’,
                ‘Sales Invoice Item’,
                [// Here specify the table columns to be displayed
                    ‘SR’, ‘item_code’, ‘description’, ‘qty’, ‘stock_uom’,
                    ‘export_rate’, ‘export_amount’, ‘vatvat’
                ],
                [// Here specify the labels of column headings
                    ‘Sr’, ‘Item Code’, ‘Description’, ‘Qty’,
                    ‘UoM’, ‘Basic Rate’, ‘Amount’,‘VAT’
                ],
                [// Here specify the column widths
                    ‘3%’, ‘10%’, ‘15%’, ‘32%’, ‘5%’,
                    ‘10%’, ‘15%’,‘10%’
                ],
                null,
                null,
                {       
                    ‘description’ : function(data_row) {
                        if(data_row.adj_rate) {
                            var to_append = '<div style=“padding-left: 15px;”><i>Discount: ’ +
                                data_row.adj_rate + '% on ’ + doc.currency + ’ ’ +
                                fmt_money(data_row.ref_rate) + ‘</i></div>’;
                            if(data_row.description.indexOf(to_append)==-1) {
                                return data_row.description + to_append;
                            } else { return data_row.description; }
                        } else {
                            return data_row.description;
                        }
                    },
                    // return vavat column just a value for test
                    ‘vatvat’ : function(data_row) {
                        return data_row.amount;
                    }

                }
                );

On Thursday, October 25, 2012 11:05:24 AM UTC+3, bd wrote:

Hello,

I am working at a new Sales Invoice print template.
So, I created a new Prin Format from Setup, and copied the existing Standard one.

But how to:
- add a column with VAT for each item ?
- add my own company details (address etc) ?

I added tax_amount, but perhaps the calculation is not included here:

                [// Here specify the table columns to be displayed
                    ‘SR’, ‘item_name’, ‘description’, ‘qty’, ‘stock_uom’,
                    ‘export_rate’, ‘export_amount’,‘tax_amount’
                ],
                [// Here specify the labels of column headings
                    ‘Sr’, ‘Item Name’, ‘Description’, ‘Qty’,
                    ‘UoM’, ‘Basic Rate’, ‘Amount’,‘VAT’
                ],
                [// Here specify the column widths
                    ‘3%’, ‘20%’, ‘37%’, ‘5%’,
                    ‘5%’, ‘15%’, ‘9%’,‘6%’

Regards



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/PxVFQu7B_HQJ.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi,

1. Sorry did not mention but you will also have to add a custom field in the Sales Invoice Detail table named "vatvat" (or equivalent)
2. There must be some value in the field (the print_table function will automatically remove any empty columns).

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 31-Oct-2012, at 1:23 PM, bd <bo...@gmail.com> wrote:

Hi,

Thank you for example, I believe I got the idea.
Still, did not manage to show an additional column (even without using any calculation).
Perhaps I am still missing something. This is set also as SalesInvVatCol report on my erpnext.com account.
Do you have any suggestion?

.......
 
<!-- Javascript -->
<script>
    si_std = {
        print_item_table: function() {
            var table = print_table(
                'Sales Invoice',
                doc.name,
                'entries',
                'Sales Invoice Item',
                [// Here specify the table columns to be displayed
                    'SR', 'item_code', 'description', 'qty', 'stock_uom',
                    'export_rate', 'export_amount', 'vatvat'
                ],
                [// Here specify the labels of column headings
                    'Sr', 'Item Code', 'Description', 'Qty',
                    'UoM', 'Basic Rate', 'Amount','VAT'
                ],
                [// Here specify the column widths
                    '3%', '10%', '15%', '32%', '5%',
                    '10%', '15%','10%'
                ],
                null,
                null,
                {       
                    'description' : function(data_row) {
                        if(data_row.adj_rate) {
                            var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
                                data_row.adj_rate + '% on ' + doc.currency + ' ' +
                                fmt_money(data_row.ref_rate) + '</i></div>';
                            if(data_row.description.indexOf(to_append)==-1) {
                                return data_row.description + to_append;
                            } else { return data_row.description; }
                        } else {
                            return data_row.description;
                        }
                    },
                    // return vavat column just a value for test
                    'vatvat' : function(data_row) {
                        return data_row.amount;
                    }

                }
                );

On Thursday, October 25, 2012 11:05:24 AM UTC+3, bd wrote:
Hello,

I am working at a new Sales Invoice print template.
So, I created a new Prin Format from Setup, and copied the existing Standard one.

But how to:
- add a column with VAT for each item ?
- add my own company details (address etc) ?

I added tax_amount, but perhaps the calculation is not included here:

                [// Here specify the table columns to be displayed
                    'SR', 'item_name', 'description', 'qty', 'stock_uom',
                    'export_rate', 'export_amount','tax_amount'
                ],
                [// Here specify the labels of column headings
                    'Sr', 'Item Name', 'Description', 'Qty',
                    'UoM', 'Basic Rate', 'Amount','VAT'
                ],
                [// Here specify the column widths
                    '3%', '20%', '37%', '5%',
                    '5%', '15%', '9%','6%'

Regards



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/PxVFQu7B_HQJ.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Daer

Please find full script of sales invoice, may be its work for you.

Thanks
MHI

On 1 November 2012 09:30, Rushabh Mehta <rm...@gmail.com> wrote:
Hi,

1. Sorry did not mention but you will also have to add a custom field in the Sales Invoice Detail table named "vatvat" (or equivalent)
2. There must be some value in the field (the print_table function will automatically remove any empty columns).

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 31-Oct-2012, at 1:23 PM, bd <bo...@gmail.com> wrote:

Hi,

Thank you for example, I believe I got the idea.
Still, did not manage to show an additional column (even without using any calculation).
Perhaps I am still missing something. This is set also as SalesInvVatCol report on my erpnext.com account.
Do you have any suggestion?

.......

<!-- Javascript -->
<script>
si_std = {
print_item_table: function() {
var table = print_table(
'Sales Invoice',
doc.name,
'entries',
'Sales Invoice Item',
[// Here specify the table columns to be displayed
'SR', 'item_code', 'description', 'qty', 'stock_uom',
'export_rate', 'export_amount', 'vatvat'
],
[// Here specify the labels of column headings
'Sr', 'Item Code', 'Description', 'Qty',
'UoM', 'Basic Rate', 'Amount','VAT'
],
[// Here specify the column widths
'3%', '10%', '15%', '32%', '5%',
'10%', '15%','10%'
],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '% on ' + doc.currency + ' ' +
fmt_money(data_row.ref_rate) + '</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
},
// return vavat column just a value for test
'vatvat' : function(data_row) {
return data_row.amount;
}

}
);

On Thursday, October 25, 2012 11:05:24 AM UTC+3, bd wrote:
Hello,

I am working at a new Sales Invoice print template.
So, I created a new Prin Format from Setup, and copied the existing Standard one.

But how to:
- add a column with VAT for each item ?
- add my own company details (address etc) ?

I added tax_amount, but perhaps the calculation is not included here:

[// Here specify the table columns to be displayed
'SR', 'item_name', 'description', 'qty', 'stock_uom',
'export_rate', 'export_amount','tax_amount'
],
[// Here specify the labels of column headings
'Sr', 'Item Name', 'Description', 'Qty',
'UoM', 'Basic Rate', 'Amount','VAT'
],
[// Here specify the column widths
'3%', '20%', '37%', '5%',
'5%', '15%', '9%','6%'

Regards



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/PxVFQu7B_HQJ.

For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

It works with added field, thank you Rushabh!

Is there any plan to add VAT as a column in Sales Invoice Item table?
This is a common practice in other ERPs.
Right now there is no direct link between VAT for each item and sales invoice lines. Now It can be only calculated, but if changed manually on total, then is no link.

Regards



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/0O4bZjMMqW4J.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

You are welcome.


We are in the process of rewriting this code. If you have some experience please feel free to dive in :slight_smile:

This is the tax calculation code on the server side:


https://github.com/webnotes/erpnext/blob/aii/controllers/accounts_controller.py

We are hoping to rewrite the client code for this soon.

If you are looking for a quick fix, I recommend you write your own function, the current client-side code is extremely messy.

best,
Rushabh




On Fri, Nov 2, 2012 at 1:36 PM, bd <bo...@gmail.com> wrote:
It works with added field, thank you Rushabh!

Is there any plan to add VAT as a column in Sales Invoice Item table?
This is a common practice in other ERPs.
Right now there is no direct link between VAT for each item and sales invoice lines. Now It can be only calculated, but if changed manually on total, then is no link.


Regards



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/0O4bZjMMqW4J.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hello,

I understood you were/ are rewriting parts of code.

Are the taxes (VAT or any other, as they are very generic) saved after invoice validation separately for each item?
The tax for each item may be calculated based on item master, but if calculation changes in time, it is not possible.

Regards
B


On Friday, November 2, 2012 11:23:22 AM UTC+2, rushabh wrote:

You are welcome.

We are in the process of rewriting this code. If you have some experience please feel free to dive in :slight_smile:

This is the tax calculation code on the server side:



We are hoping to rewrite the client code for this soon.

If you are looking for a quick fix, I recommend you write your own function, the current client-side code is extremely messy.

best,
Rushabh




On Fri, Nov 2, 2012 at 1:36 PM, bd <> wrote:
It works with added field, thank you Rushabh!

Is there any plan to add VAT as a column in Sales Invoice Item table?
This is a common practice in other ERPs.
Right now there is no direct link between VAT for each item and sales invoice lines. Now It can be only calculated, but if changed manually on total, then is no link.


Regards



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To post to this group, send email to erpnext-dev…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/0O4bZjMMqW4J.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/JFa14M215q4J.

For more options, visit https://groups.google.com/groups/opt_out.