TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lm Martiness
NA
107
8.2k
How to store tax (vat) value in SQL
May 26 2020 2:31 PM
Hi everyone.
Could someone tell me , how to store vat value into SQL and during the calculation? For now i am storing into sql like dcimal (4,2). Everthing is ok during the call up process . I retrieve data from sql into datagridview and there data are displayed like i store into db. But the vat value is stored in this format 1.18 for 18.00 % for calculation purpose. But i want into the vat column into the datagridview to be a kind of a mask for vat filed (data to be displayed 18.00 not 1.18)
Here is the declared data columns
//Made a new DataColumn to populate above DataTable
dc.DataType = System.Type.GetType("System.Int32");//Defined the DataType inside, this can be [[int]] if you want.
dc.ColumnName = "Barcode";//Gave it a name (important for the custom expression - can only be one word so use underscores if you need multiple words)
dc.ReadOnly = true;
DataColumn dc2 = new DataColumn();
dc2.DataType = System.Type.GetType("System.String");
dc2.ColumnName = "NAME";
dc2.ReadOnly = true;
DataColumn dc4 = new DataColumn();
dc4.DataType = System.Type.GetType("System.Decimal");
dc4.ColumnName = "PRICE";
dc4.ReadOnly = false;
DataColumn dc3 = new DataColumn();
dc3.DataType = System.Type.GetType("System.Decimal");
dc3.ColumnName = "QTY";
DataColumn dc5 = new DataColumn();
dc5.DataType = System.Type.GetType("System.Decimal");
dc5.ColumnName = "TVSH";
dc5.ReadOnly = false;
DataColumn dc6 = new DataColumn();
dc6.DataType = System.Type.GetType("System.Decimal");
dc6.ColumnName = "Total";
dc6.Expression = "Price* QTY";//Multiplying the Price and Quantity DataColumns
dc6.ReadOnly = true;
DataColumn dc7 = new DataColumn();
dc7.DataType = System.Type.GetType("System.Decimal");
dc7.ColumnName = "WithoutVAT";
dc7.Expression = "Total/ VAT";//Multiplying the Price and Quantity DataColumns
dc7.ReadOnly = true ;
DataColumn dc9 = new DataColumn();
dc9.DataType = System.Type.GetType("System.Decimal");
dc9.ColumnName = "VATvalue";
dc9.Expression = "Total-
WithoutVAT
";//Multiplying the Price and Quantity DataColumns
dc9.ReadOnly = true ;
What should i change to make this work? Thanks
Reply
Answers (
1
)
How to format datagridview to shown correct format number
How do i project 3 different columns from 3 rows ?