public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crptDebitNote rpt = new crptDebitNote();

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #2
0
        /// <summary>
        /// Function to print  DebitNote in curresponding Crystal report
        /// </summary>
        /// <param name="dsDebitNote"></param>
        internal void DebitNotePrinting(DataSet dsDebitNote)
        {
            try
            {

                crptDebitNote crptDebitNote = new crptDebitNote();
                decimal decTotalAmount = 0;
                foreach (DataTable dtbl in dsDebitNote.Tables)
                {
                    if (dtbl.TableName == "Table")
                    {
                        crptDebitNote.Database.Tables["dtblCompany"].SetDataSource(dtbl);
                    }
                    else if (dtbl.TableName == "Table1")
                    {

                        foreach (DataRow drow in dtbl.Rows)
                        {
                            DataColumn dtClmn = new DataColumn("Amount In Words");
                            dtbl.Columns.Add(dtClmn);
                            if (drow["totalAmount"].ToString() != string.Empty)
                            {
                                decTotalAmount = Convert.ToDecimal(drow["totalAmount"].ToString());
                                drow["Amount In Words"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId);
                            }
                            crptDebitNote.Database.Tables["dtblDebitNoteMaster"].SetDataSource(dtbl);
                        }
                    }
                    else if (dtbl.TableName == "Table2")
                    {
                        DataColumn dtClmn = new DataColumn("CreditOrDebit");
                        dtbl.Columns.Add(dtClmn);
                        DataColumn dtClmn1 = new DataColumn("Amount");
                        dtbl.Columns.Add(dtClmn1);
                        foreach (DataRow drow in dtbl.Rows)
                        {

                            if (drow["chequeNo"].ToString() == string.Empty)
                            {

                                drow["chequeDate"] = string.Empty;
                            }


                            if (Convert.ToDecimal(drow["debit"].ToString()) == 0)
                            {
                                drow["Amount"] = Convert.ToDecimal(drow["credit"].ToString());
                                drow["CreditOrDebit"] = "Cr";
                            }
                            else
                            {
                                drow["Amount"] = Convert.ToDecimal(drow["debit"].ToString());
                                drow["CreditOrDebit"] = "Dr";
                            }

                        }
                        crptDebitNote.Database.Tables["dtblDebitNoteDetails"].SetDataSource(dtbl);
                    }

                }
                this.crptViewer.ReportSource = crptDebitNote;
                SettingsSP spSettings = new SettingsSP();

                if (spSettings.SettingsStatusCheck("DirectPrint") == "No")
                {
                    base.Show();
                    this.BringToFront();
                }
                else
                {
                    crptDebitNote.PrintToPrinter(1, false, 0, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("RPT :5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     crptDebitNote rpt = new crptDebitNote();
     rpt.Site = this.Site;
     return rpt;
 }