Monday, March 26, 2012

Multiple Invoice

 This example illustrate how to generate report for Multiple Invoice. Multiple Invoice is a concept where table data changes  accordingly invoice no but header and footer will be same.
Step 1 : Now start from Creating Stored Procedure which fetches data from table or view for invoice.
Step 2 : Create DataSet. and  Add new RDLC. If you need help in doing this then goto HELP
Step 3 : Add LIST from Report Items

Step 4 : Right Click on Blank Area of List then goto properties.

Step 5 : Choose Data set Name. Click “Edit Details Group” button. In General Tab  Select in Group on the expression value on which you want to group. Parent group is optional.Check “ Page Break at End”  option.

Step 6 : Now you have to put all information in the list area.In my sample report I have a header section in body which will change a/c to  Invoice No.
Drag n Drop Textbox from ReportItems and then Drag n Drop field values to related textboxes.

Step 7 :  Drag n Drop Table.

Step 8 : Now Drag n Drop the fields  to detail section which u want to show in table format.

Step 9 : To add new column to table right click on any column and do whatever you want.

Step 10  : Reduce the width of textbox of table from its properties.

Step 11  : To view sum of any field of table just drag n drop same field to its footer section.
 Step 12 : To calculate VAT put formula in texbox's expression.

Step 12 : From Report Menu Add Header and Footer. 
Step 13 : Design Header and Footer Section a/c to your need.


Now Add ReportViewer to aspx and connect it to RDLC.If you need elaborate description  for then read Basic RDLC
Finally view report in browser  and  output will be like this.

Now here is the thing you are looking for :

Show Value upto Two Decimal Places in Gridview

Show money or float values upto two decimal places using 
String.Format in Gridview.
<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem,"Rate")) %>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Amt","{0:f2}")  %>'></asp:Label> 
Example :  
<asp:TemplateField  HeaderText="Rate">
   <table align="right" style="text-align: right"><tr><td align="right">
    <asp:Label ID="lblRate" runat="server" 

Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem,"Rate")) %>' ></asp:Label>