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);
     }
 }
 private void button2_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)
         {
             Forms.Printing.Shapatra Rpt = new Finance_Management_System.Forms.Printing.Shapatra();
             Rpt.SetDataSource(Dt);
             Rpt.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
             // Rpt.PrintToPrinter(1, true, 0, 0);
             Frm_Preview F = new Frm_Preview(Rpt, Dt);
             F.Show();
         }
     }
     catch (Exception Erp)
     {
         clsGeneral.ShowErrMsg(Erp.Message);
     }
 }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            bool Rights = ClsModuleName.ChechRights(ClsLogin.LoginId, this.Tag, ClsModuleName.Rights.U_Print.ToString());
            if (Rights == false)
            {
                return;
            }
            if (CashId > 0)
            {
                string SS = "Select * From vw_LoanSanction Where Id = " + txtName.ValueGet("") + "";
                DataTable Dt = ObjData.GetDataTable(SS);
                if (Dt.Rows.Count > 0)
                {
                    if (ObjData.GetLoanbalance(txtName.ValueGet("")) > 0)
                    {
                        clsGeneral.ShowMessage("Loan balance is not Clearded");
                        return;
                    }

                    Forms.Printing.NOC Rpt = new Finance_Management_System.Forms.Printing.NOC();
                    Rpt.SetDataSource(Dt);
                    Rpt.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
                    // Rpt.PrintToPrinter(1, true, 0, 0);
                    Frm_Preview F = new Frm_Preview(Rpt, Dt);
                    F.Show();
                }
            }
        }