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

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        /// <summary>
        /// Function to print PaymentVoucher in curresponding Crystal report
        /// </summary>
        /// <param name="dsPaymentVoucher"></param>
        internal void PaymentVoucherPrinting(DataSet dsPaymentVoucher)
        {
            try
            {

                crptPaymentVoucher crptPaymentVoucher = new crptPaymentVoucher();
                decimal decTotalAmount = 0;
                foreach (DataTable dtbl in dsPaymentVoucher.Tables)
                {
                    if (dtbl.TableName == "Table")
                    {
                        crptPaymentVoucher.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);
                            }
                            crptPaymentVoucher.Database.Tables["dtblPaymentMaster"].SetDataSource(dtbl);
                        }
                    }
                    else if (dtbl.TableName == "Table2")
                    {
                        foreach (DataRow drow in dtbl.Rows)
                        {
                            if (drow["chequeNo"].ToString() == string.Empty)
                            {
                                drow["chequeDate"] = string.Empty;
                            }
                        }
                        DataColumn dtClmnSlNo = new DataColumn("SlNo");
                        dtbl.Columns.Add(dtClmnSlNo);
                        int inRowIndex = 0;

                        foreach (DataRow drSlNo in dtbl.Rows)
                        {
                            drSlNo["SlNo"] = ++inRowIndex;
                        }
                        crptPaymentVoucher.Database.Tables["dtblPaymentDetails"].SetDataSource(dtbl);
                    }
                }
                this.crptViewer.ReportSource = crptPaymentVoucher;
                SettingsSP spSettings = new SettingsSP();

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