Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crptCreditNote rpt = new crptCreditNote();

            rpt.Site = this.Site;
            return(rpt);
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     crptCreditNote rpt = new crptCreditNote();
     rpt.Site = this.Site;
     return rpt;
 }
Exemplo n.º 3
0
        /// <summary>
        ///  Function to print  CreditNote in curresponding Crystal report
        /// </summary>
        /// <param name="dsCreditNote"></param>
        internal void CreditNotePrinting(DataSet dsCreditNote)
        {
            try
            {

                crptCreditNote crptCreditNote = new crptCreditNote();
                decimal decTotalAmount = 0;
                foreach (DataTable dtbl in dsCreditNote.Tables)
                {
                    if (dtbl.TableName == "Table")
                    {
                        crptCreditNote.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);
                            }
                            crptCreditNote.Database.Tables["dtblCredittNoteMaster"].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";
                            }

                        }
                        crptCreditNote.Database.Tables["dtblCreditNoteDetails"].SetDataSource(dtbl);
                    }

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

                if (spSettings.SettingsStatusCheck("DirectPrint") == "No")
                {
                    base.Show();
                    this.BringToFront();
                }
                else
                {
                    crptCreditNote.PrintToPrinter(1, false, 0, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("RPT :5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }