public static void Print(ReportViewer pRptViewer, string pP_id, List <PrintCopies> printdata) { vPId = pP_id; Print_PurchaseList data = GetData(pP_id, printdata); LocalReport localReport = pRptViewer.LocalReport; localReport.ReportPath = Application.StartupPath + @"\PRINTS\P_Purchase.rdlc"; //(1)// localReport.DisplayName = "invoice"; localReport.DataSources.Add(new ReportDataSource("MyDataSource", data)); //(2)// localReport.SubreportProcessing += localReport_SubreportProcessing; PrinterSettings v_PrinterSettings = GetPrinterSettings(); pRptViewer.PrinterSettings = v_PrinterSettings; pRptViewer.SetPageSettings(v_PrinterSettings.DefaultPageSettings); pRptViewer.RefreshReport(); }
private static Print_PurchaseList GetData(string p_id, List <PrintCopies> printcopies) { Garment_purchase invoice = CPurchase_exten.PKId(p_id, new DAL()); Print_PurchaseList list = new Print_PurchaseList(); for (int i = 0; i < printcopies.Count; i++) { Print_PurchaseRow row = new Print_PurchaseRow(); row.COPIES = printcopies[i].Copies; row.SALESTYPE = invoice.Salestype_id; Company obj = CCompany_exten.PKId(Current.Company_id, new DAL()); row.COMPANY_NAME = obj.Display_name.ToUpper(); row.ADDRESS1 = obj.Street1 + " , " + obj.Street2; row.ADDRESS2 = obj.City_id + " - " + obj.Pincode_id + " , " + obj.State_id + ". Code -33, Email : " + obj.Email; row.COMPANY_TIN = " GSTIN : " + obj.Gst + "";// , Cell : " + obj.Cell1 + " "; row.PURCHASE_ID = p_id; row.PURCHASE_NO = invoice.Garment_purchase_no; row.PURCHASE_DATE = ConvertTO.Date2S(invoice.Garment_purchase_date); row.PARTY_NAME = invoice.Party_id; Party _party_list = CParty_exten.SearchName(invoice.Party_id, new DAL()); if (_party_list.Party_name != null) { row.STREET1 = _party_list.Street1 + ", " + _party_list.Street2; row.STREET2 = ""; row.CITY = _party_list.City_id + " - " + _party_list.Pincode_id + " , " + _party_list.State_id; row.STATE = ""; row.COUNTRY = _party_list.Country_id; row.PINCODE = ""; if (_party_list.Tin.Trim().Length != 0) { row.GSTIN = "TIN No : " + _party_list.Tin; } if (_party_list.Gst.Trim().Length != 0) { row.GSTIN += "GSTIN No : " + _party_list.Gst; } } row.TOTAL_QTY = ConvertTO.DecimalToS(invoice.Total_qty.ToString()); row.TAXABLE_VALUE = ConvertTO.Decimal2d(invoice.Total_taxable_amount.ToString()); List <Purchaseitems> klist = CPurchaseitems_exten.FKId(p_id, new DAL()); if (klist.Count != 0) { row.LBL_CGST = " Add CGST tax @ " + ConvertTO.DecimalToS(klist[0].Cgst_percent.ToString()) + " %"; row.LBL_SGST = " Add SGST tax @ " + ConvertTO.DecimalToS(klist[0].Sgst_percent.ToString()) + " %"; } else { row.LBL_CGST = " Add CGST tax "; row.LBL_SGST = " Add SGST tax "; } row.TOTAL_CGST = ConvertTO.Decimal2d(invoice.Total_cgst.ToString()); row.TOTAL_SGST = ConvertTO.Decimal2d(invoice.Total_sgst.ToString()); row.TOTAL_IGST = ConvertTO.Decimal2d(invoice.Total_igst.ToString()); row.TOTAL_SUB = (Global.ToDecimal(row.TAXABLE_VALUE) + Global.ToDecimal(row.TOTAL_CGST) + Global.ToDecimal(row.TOTAL_SGST) + Global.ToDecimal(row.TOTAL_IGST) + Global.ToDecimal(row.TOTAL_CESS)).ToString(); if (invoice.Ledger_id != null) { if (invoice.Ledger_id.Trim() != "") { row.LEDGER = " " + CLedger_exten.GetName_Id(invoice.Ledger_id); row.ADDITIONAL = invoice.Additional.ToString(); } else { row.LEDGER = ""; row.ADDITIONAL = ""; } } row.ROUNDS = invoice.Rounds.ToString(); row.GSTTOTAL = invoice.Gsttotal.ToString(); row.GRANDTOTAL = invoice.Grandtotal.ToString(); if (invoice.Notes != null) { if (invoice.Notes.Trim().Length != 0) { row.NOTES = "Notes : " + invoice.Notes; } } row.AMOUNT_IN_WORDS = "Rupees : " + Global.AmountInWords(Convert.ToDecimal(invoice.Grandtotal)); row.ENTRY_BY = invoice.User_id; list.Add(row); } return(list); }