0
votes

i have developed a pos system using vb.net with MySQL. now i want to generate a report using crystal report.

original report

   itemcode       itemname             quntity    profit  
    0001        A4 single side           2          4
    0002        A4 double side           2          6
    0005        A5 double side           1          2
    0001        A4 single side           3          6
    0002        A4 double side           1          3

and i want this result in my report

itemcode       itemname             quntity    profit
0001        A4 single side           5          10
0002        A4 double side           3          9
0005        A5 double side           1          2

how to create a formula for that in crystal report formula maker. what will be the formula. i dont know how to do it. please help me. thanks for helping me

1

1 Answers

0
votes

You asked a wrong question because you don't need formula to solve your problem. It's possible to make your original report to your desired one by some Boolean logic but it's messy and you wont learn how to solve similar problems by proper way. So let's solve your problem step by step. For start you have your original report

itemcode       itemname             quntity    profit  
0001        A4 single side           2          4
0002        A4 double side           2          6
0005        A5 double side           1          2
0001        A4 single side           3          6
0002        A4 double side           1          3

To calculate your quantity and profit by itemcode/itemname you need groups. To make a group you go in Crystal Report Insert->Group...

crystal report

After that you select your attribute by which you want to group by your records. In your case you select itemcode. After that your records should look like this

itemcode       itemname             quntity    profit  
0001        A4 single side           2          4
0001        A4 single side           3          6
0002        A4 double side           2          6
0002        A4 double side           1          3
0005        A5 double side           1          2

To get your desired report you need to use Group Header or Group Footer. So put itemcode, itemname, sum(quantity) and sum(profit) in your Group Header or Group Footer and suppress/hide all other sections (detail etc...). And then your report should look like this.

itemcode       itemname             quntity    profit
0001        A4 single side           5          10
0002        A4 double side           3          9
0005        A5 double side           1          2

If you have any other question feel free to ask. Hope it helps.