private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         bool Rights = ClsModuleName.ChechRights(ClsLogin.LoginId, this.Tag, ClsModuleName.Rights.U_Print.ToString());
         if (Rights == false)
         {
             return;
         }
         string SS = "Select * From vw_LoanApplication Where Id = " + LoanApplicationId + "";
         DataTable Dt = ObjData.GetDataTable(SS);
         if (Dt.Rows.Count > 0)
         {
             clsNumberToWord ObjNumber = new clsNumberToWord();
             Forms.Printing.LoanApplicationWithoutLetter Rpt = new Finance_Management_System.Forms.Printing.LoanApplicationWithoutLetter();
             string EMI = Dt.Rows[0]["EMI"].ToString();
             string EMIWords = ObjNumber.changeCurrencyToWords(EMI);
             string PLoanAmount = Dt.Rows[0]["PLoanAmount"].ToString();
             string PLoanAmountWords = ObjNumber.changeCurrencyToWords(PLoanAmount);
             Dt.Rows[0]["EMIWords"] = "Rs. " + EMIWords;
             Dt.Rows[0]["PLoanAmountWords"] = "Rs. " + PLoanAmountWords;
             Rpt.SetDataSource(Dt);
             //Rpt.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
             Rpt.PrintToPrinter(1, true, 0, 0);
         }
     }
     catch (Exception Erp)
     {
         clsGeneral.ShowErrMsg(Erp.Message);
     }
 }
Exemplo n.º 2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         bool Rights = ClsModuleName.ChechRights(ClsLogin.LoginId, this.Tag, ClsModuleName.Rights.U_Print.ToString());
         if (Rights == false)
         {
             return;
         }
         string SS = "Select * From vw_LoanSanction Where Id = " + LoanSanctionId + "";
         DataTable Dt = ObjData.GetDataTable(SS);
         if (Dt.Rows.Count > 0)
         {
             clsNumberToWord ObjNumber = new clsNumberToWord();
             DialogResult Dr = MessageBox.Show("Print on Letter Head", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             if (Dr == DialogResult.No)
             {
                 #region With Out Letter
                 Forms.Printing.LoanApplicationWithoutLetter Rpt = new Finance_Management_System.Forms.Printing.LoanApplicationWithoutLetter();
                 string EMI = Dt.Rows[0]["EMI"].ToString();
                 string EMIWords = ObjNumber.changeCurrencyToWords(EMI);
                 string PLoanAmount = Dt.Rows[0]["PLoanAmount"].ToString();
                 string PLoanAmountWords = ObjNumber.changeCurrencyToWords(PLoanAmount);
                 Dt.Rows[0]["EMIWords"] = "Rs. " + EMIWords;
                 Dt.Rows[0]["PLoanAmountWords"] = "Rs. " + PLoanAmountWords;
                 Rpt.SetDataSource(Dt);
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS1;
                 txtS1 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt1"];
                 txtS1.Text = clsGeneral.Slogan1;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS2;
                 txtS2 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt2"];
                 txtS2.Text = clsGeneral.Slogan2;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS3;
                 txtS3 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt3"];
                 txtS3.Text = clsGeneral.Slogan3;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS4;
                 txtS4 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt4"];
                 txtS4.Text = clsGeneral.Slogan4;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS5;
                 txtS5 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt5"];
                 txtS5.Text = clsGeneral.Slogan5;
                 Rpt.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
                 //Rpt.PrintToPrinter(1, true, 0, 0);
                 Frm_Preview F = new Frm_Preview(Rpt, Dt);
                 F.Show();
                 #endregion
             }
             else
             {
                 #region With Letter
                 Forms.Printing.LoanApplicationWithLetter Rpt = new Finance_Management_System.Forms.Printing.LoanApplicationWithLetter();
                 string EMI = Dt.Rows[0]["EMI"].ToString();
                 string EMIWords = ObjNumber.changeCurrencyToWords(EMI);
                 string PLoanAmount = Dt.Rows[0]["PLoanAmount"].ToString();
                 string PLoanAmountWords = ObjNumber.changeCurrencyToWords(PLoanAmount);
                 Dt.Rows[0]["EMIWords"] = "Rs. " + EMIWords;
                 Dt.Rows[0]["PLoanAmountWords"] = "Rs. " + PLoanAmountWords;
                 Rpt.SetDataSource(Dt);
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS1;
                 txtS1 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt1"];
                 txtS1.Text = clsGeneral.Slogan1;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS2;
                 txtS2 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt2"];
                 txtS2.Text = clsGeneral.Slogan2;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS3;
                 txtS3 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt3"];
                 txtS3.Text = clsGeneral.Slogan3;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS4;
                 txtS4 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt4"];
                 txtS4.Text = clsGeneral.Slogan4;
                 CrystalDecisions.CrystalReports.Engine.TextObject txtS5;
                 txtS5 = (CrystalDecisions.CrystalReports.Engine.TextObject)Rpt.Section3.ReportObjects["txt5"];
                 txtS5.Text = clsGeneral.Slogan5;
                 Rpt.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
                 //Rpt.PrintToPrinter(1, true, 0, 0);
                 Frm_Preview F = new Frm_Preview(Rpt, Dt);
                 F.Show();
                 #endregion
             }
         }
     }
     catch (Exception Erp)
     {
         clsGeneral.ShowErrMsg(Erp.Message);
     }
 }