public static Print_quotationItemsList GetData(string p_id) { Print_quotationItemsList list = new Print_quotationItemsList(); // List <Quotationitems> inv_item_list = new List <Quotationitems>(); //if (Customise.Invoice_poid_dcid == true) //{ // inv_item_list = CQuotationitems_exten.FKId(p_id, new DAL()); //} //if ((Customise.Invoice_pono_dcno == true) || (Customise.Invoice_Without_podc == true)) //{ inv_item_list = CQuotationitems_exten.FKNo(p_id, new DAL()); //} for (int r = 0; r <= inv_item_list.Count - 1; r++) { Print_quotationitemsRow row = new Print_quotationitemsRow(); // row.QUOTATION_ITEM_ID = inv_item_list[r].Quotationitems_id; row.QUOTATION_ID = inv_item_list[r].Quotation_id; row.SL_NO = (r + 1).ToString(); row.PRODUCT_ID = Checks.RemoveEscape(inv_item_list[r].Product_id); row.HSN_CODE_ID = Ccoreplus.GetHsncode_name(inv_item_list[r].Product_id); row.SIZES_ID = inv_item_list[r].Sizes_id; row.QTY = ConvertTO.DecimalToS(inv_item_list[r].Qty); row.PRICE = ConvertTO.Decimal2d(inv_item_list[r].Price.ToString()); decimal vAmount = 0M; decimal vTaxableValue = 0M; decimal vQty = Global.ToDecimal(row.QTY); decimal vPrice = Global.ToDecimal(row.PRICE); vTaxableValue = vQty * vPrice; vAmount = vTaxableValue; row.TAXABLEVALUE = ConvertTO.Decimal2d(vTaxableValue.ToString()); row.SUB_TOTAL = ConvertTO.Decimal2d(vAmount.ToString()); // list.Add(row); // } // return(list); }
static void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e) { switch (e.DataSourceNames[0]) { case "MyDataSource_Items": try { Print_quotationItemsList data_AT = P_QuotationItem.GetData(vPId); e.DataSources.Add(new ReportDataSource("MyDataSource_Items", data_AT)); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } break; } }
public static void Print(ReportViewer pRptViewer, string p_id) { Print_quotationItemsList data = GetData(p_id); LocalReport localReport = pRptViewer.LocalReport; //= Set Report Path localReport.ReportPath = Application.StartupPath + @"\PRINTS\P_QuotationItem.rdlc"; //(1)// localReport.DisplayName = "quotation items"; //= Set Report Data Source localReport.DataSources.Add(new ReportDataSource("MyDataSource_Items", data)); //(2)// //= Refresh the report PrinterSettings v_PrinterSettings = GetPrinterSettings(); pRptViewer.PrinterSettings = v_PrinterSettings; pRptViewer.SetPageSettings(v_PrinterSettings.DefaultPageSettings); pRptViewer.RefreshReport(); }