public void PrintBill() { try { int UserId = 0; Int32.TryParse(ddlUser.SelectedValue, out UserId); List <ProductInvoice_Master> _Pro = ProductInvoice_MasterCollection.GetAll().FindAll(x => x.BILL_ID == billid); #region Company string CompanyName = USERPROFILEMASTER.GetByUser_Name("OMHRD").First_Name; string CompanyAddress = USERPROFILEMASTER.GetByUser_Name("OMHRD").Address; string CompanyState = USERPROFILEMASTER.GetByUser_Name("OMHRD").StateName; string CompanyCity = USERPROFILEMASTER.GetByUser_Name("OMHRD").CityName; string ZipCode = USERPROFILEMASTER.GetByUser_Name("OMHRD").ZipCode; string CompanyGST = USERPROFILEMASTER.GetByUser_Name("OMHRD").GstinVerified; string CompanyContact = USERPROFILEMASTER.GetByUser_Name("OMHRD").ContactNumber; #endregion #region Seller string ShipName = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name; string ShipAdd1 = USERPROFILEMASTER.GetByRegistration_ID(UserId).Address; string ShipAdd2 = USERPROFILEMASTER.GetByRegistration_ID(UserId).AddressLine2; string ShipState = USERPROFILEMASTER.GetByRegistration_ID(UserId).StateName; string ShipCity = USERPROFILEMASTER.GetByRegistration_ID(UserId).CityName; string ShipZip = USERPROFILEMASTER.GetByRegistration_ID(UserId).ZipCode; string Contry = USERPROFILEMASTER.GetByRegistration_ID(UserId).COUNTRY; string BillName = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name; string PermanentAdd1 = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddress; string PermanentAdd2 = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddressLine2; string PermanentState = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippStateName; string PermanentCity = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShipCityName; string PermanentZip = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingZip; string Gstin = USERPROFILEMASTER.GetByRegistration_ID(UserId).GstinVerified; #endregion #region PickUp int PicupId = int.Parse(Session["PickupID"].ToString()); string PickUpName = PickupMaster.GetByPickupID(PicupId).FirstName + " " + PickupMaster.GetByPickupID(PicupId).LastName; string PickUpAddress = PickupMaster.GetByPickupID(PicupId).Address; string PickUpContact = PickupMaster.GetByPickupID(PicupId).ContactNo; string CenterName = PickupMaster.GetByPickupID(PicupId).CenterName; string CenterCode = PickupMaster.GetByPickupID(PicupId).CenterCode; #endregion #region BillDetail System.Guid guid = System.Guid.NewGuid(); String id = guid.ToString(); string OrderId = id; DateTime dt = System.DateTime.Today; string InvoiNo = ProductBill_Master.GetByBILL_ID(billid).BILLNO; string InvoiDate = dt.ToString(); string Phone = USERPROFILEMASTER.GetByRegistration_ID(UserId).ContactNumber; string Email = USERPROFILEMASTER.GetByRegistration_ID(UserId).Email; #endregion decimal totamt = Math.Round(ProductBill_Master.GetByBILL_ID(billid).TOTAL, 0); var values = totamt.ToString(CultureInfo.InvariantCulture).Split('.'); Int64 rup = Convert.ToInt64(values[0]); Int64 paise = 0; if (values.Length == 2) { paise = Convert.ToInt64(values[1]); } string rupee = string.Empty; string pa = string.Empty; if (paise != 0) { pa = Rupees(paise) + "Paise Only"; rupee = Rupees(rup) + "Rupees and " + pa; } else { rupee = Rupees(rup) + "Rupees Only"; } ReportViewer1.ProcessingMode = ProcessingMode.Local; this.ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Report/PickUpSale.rdlc"); ReportDataSource datasource = new ReportDataSource("BillGenrate", _Pro); ReportParameter[] rpt = new ReportParameter[33]; rpt[0] = new ReportParameter("CompanyName", CompanyName); rpt[1] = new ReportParameter("CompanyAddress", CompanyAddress); rpt[2] = new ReportParameter("CompanyState", CompanyState); rpt[3] = new ReportParameter("CompanyCity", CompanyCity); rpt[4] = new ReportParameter("ZipCode", ZipCode); rpt[5] = new ReportParameter("CompanyGST", CompanyGST); rpt[6] = new ReportParameter("CompanyContact", CompanyContact); rpt[7] = new ReportParameter("ShipName", ShipName); rpt[8] = new ReportParameter("ShipAdd1", ShipAdd1); rpt[9] = new ReportParameter("ShipAdd2", ShipAdd2); rpt[10] = new ReportParameter("ShipCity", ShipCity); rpt[11] = new ReportParameter("ShipState", ShipState); rpt[12] = new ReportParameter("ShipZip", ShipZip); rpt[13] = new ReportParameter("Contry", Contry); rpt[14] = new ReportParameter("BillName", BillName); rpt[15] = new ReportParameter("PermanentAdd1", PermanentAdd1); rpt[16] = new ReportParameter("PermanentAdd2", PermanentAdd2); rpt[17] = new ReportParameter("PermanentCity", PermanentCity); rpt[18] = new ReportParameter("PermanentState", PermanentState); rpt[19] = new ReportParameter("PermanentZip", PermanentZip); rpt[20] = new ReportParameter("Gstin", Gstin); rpt[21] = new ReportParameter("OrderId", OrderId); rpt[22] = new ReportParameter("InvoiNo", InvoiNo); rpt[23] = new ReportParameter("InvoiDate", InvoiDate); rpt[24] = new ReportParameter("Phone", Phone); rpt[25] = new ReportParameter("Email", Email); rpt[26] = new ReportParameter("TotalAmountWord", rupee); rpt[27] = new ReportParameter("PaymentMod", PaymentMod); rpt[28] = new ReportParameter("PickUpName", PickUpName); rpt[29] = new ReportParameter("PickUpAddress", PickUpAddress); rpt[30] = new ReportParameter("PickUpContact", PickUpContact); rpt[31] = new ReportParameter("CenterName", CenterName); rpt[32] = new ReportParameter("CenterCode", CenterCode); this.ReportViewer1.LocalReport.SetParameters(rpt); this.ReportViewer1.LocalReport.DataSources.Clear(); this.ReportViewer1.LocalReport.DataSources.Add(datasource); this.ReportViewer1.LocalReport.Refresh(); } catch (Exception ex) { } }
public void grid() { gdvNotice.DataSource = ProductInvoice_MasterCollection.GetAll().FindAll(x => x.BILL_ID == billid); gdvNotice.DataBind(); }