Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crptPaySlip rpt = new crptPaySlip();

            rpt.Site = this.Site;
            return(rpt);
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     crptPaySlip rpt = new crptPaySlip();
     rpt.Site = this.Site;
     return rpt;
 }
Example #3
0
        /// <summary>
        ///  Function to print PaySlip in curresponding Crystal report
        /// </summary>
        /// <param name="dsPaySlip"></param>
        internal void PaySlipPrinting(DataSet dsPaySlip)
        {
            try
            {
                decimal decTotalAdd = 0;
                decimal decTotalDed = 0;
                decimal decNetPay = 0;
                crptPaySlip crptPaySlip = new crptPaySlip();

                foreach (DataTable dtbl in dsPaySlip.Tables)
                {
                    if (dtbl.TableName == "Table")
                    {
                        crptPaySlip.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl);
                    }
                    else if (dtbl.TableName == "Table1")
                    {
                        crptPaySlip.Database.Tables["dtblEmployeeDetails"].SetDataSource(dtbl);

                        foreach (DataRow drow in dtbl.Rows)
                        {
                            if (drow["ADDamount"].ToString() != string.Empty)
                            {
                                decTotalAdd += Convert.ToDecimal(drow["ADDamount"].ToString());
                            }
                            if (drow["DEDamount"].ToString() != string.Empty)
                            {
                                decTotalDed += Convert.ToDecimal(drow["DEDamount"].ToString());
                            }
                        }

                        foreach (DataRow drow in dtbl.Rows)
                        {
                            if (drow["LOP"].ToString() != string.Empty)
                            {
                                decTotalDed += Convert.ToDecimal(drow["LOP"].ToString());
                            }

                            if (drow["Deduction"].ToString() != string.Empty)
                            {
                                decTotalDed += Convert.ToDecimal(drow["Deduction"].ToString());
                            }

                            if (drow["Advance"].ToString() != string.Empty)
                            {
                                decTotalDed += Convert.ToDecimal(drow["Advance"].ToString());
                            }

                            if (drow["Bonus"].ToString() != string.Empty)
                            {
                                decTotalAdd += Convert.ToDecimal(drow["Bonus"].ToString());
                            }

                            break;

                        }
                    }
                    else if (dtbl.TableName == "Table2")
                    {
                        DataColumn dtClmn = new DataColumn("AmountInWords");
                        dtbl.Columns.Add(dtClmn);
                        decNetPay = decTotalAdd - decTotalDed;
                        foreach (DataRow drow in dtbl.Rows)
                        {
                            drow["AmountInWords"] = new NumToText().AmountWords(decNetPay, PublicVariables._decCurrencyId);
                        }

                        crptPaySlip.Database.Tables["dtblOther"].SetDataSource(dtbl);
                    }
                }

                this.crptViewer.ReportSource = crptPaySlip;
                SettingsSP spSettings = new SettingsSP();

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