Click here to Skip to main content
15,881,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
// simple description : In R i have for example ID 1 , 2 i want to pop up two reports the first has value of ID = 1 and the second with ID =2

C#
Purs.DataSets.Suppliers_Second_Lists SPDS = new Purs.DataSets.Suppliers_Second_Lists();
            var R = M.PO_Masters.Where(c => c.PO_Date.Value.Date >= dateTimePicker1.Value.Date &&
                   c.PO_Date.Value.Date <= dateTimePicker2.Value.Date).OrderBy(c => c.PO_ID).Select(c => c.PO_ID).Distinct();
          
            int i = 1;
            foreach (var item in R)
            {
                string FromSub = M.PO_Masters.Where(c => c.PO_ID == item).Single().Supplier.Supplier_Name;
                string ContactName = M.PO_Masters.Where(c => c.PO_ID == item).Single().Supplier.Supplier_Contact_Name;
                string Fax = M.PO_Masters.Where(c => c.PO_ID == item).Single().Supplier.Supplier_Fax;
                string Po_Delivery = M.PO_Masters.Where(c => c.PO_ID == item).Single().PO_Delivery_Date.Value.Date.ToShortDateString();
                string Po_Condition = M.PO_Masters.Where(c => c.PO_ID == item).Single().PO_Conditions;
                string Po_Date = M.PO_Masters.Where(c => c.PO_ID == item).Single().PO_Date.Value.Date.ToShortDateString();
                string Pro_No = M.PO_Dets.Where(c => c.PO_ID == item).Single().PO_Product_ID;
                string Pro_Name = M.PO_Dets.Where(c => c.PO_ID == item).Single().Product_Description.Product_Name;
                string Unit = M.PO_Dets.Where(c => c.PO_ID == item).Single().Product_Description.Product_Unit;
                decimal Qty = M.PO_Dets.Where(c => c.PO_ID == item).Single().PO_Qty.Value;
                decimal Price = M.PO_Dets.Where(c => c.PO_ID == item).Single().PO_Price.Value;
              
                
                object[] MyLine = 
                { 
                    Po_Date, FromSub,ContactName,Fax,item,textBox2.Text,Po_Delivery,Po_Condition,
                   i++, Pro_No,Pro_Name,Unit,Qty,Price,Qty * Price,
                };

                SPDS.Tables["Current_PO"].Rows.Add(MyLine);

                Suppliers_Printing_Form MyForm = new Suppliers_Printing_Form();
                MyForm.current_PO1.SetDataSource(SPDS.Tables["Current_PO"]);
                MyForm.crystalReportViewer1.ReportSource = MyForm.current_PO1;
                MyForm.crystalReportViewer1.Refresh();
                MyForm.Show();i = 1;
            }
Posted
Updated 20-Jan-12 9:16am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900