Exemplo n.º 1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            string filterStudent     = "";
            string filterSalesPerson = "";

            HelpFilter hp = new HelpFilter();

            if (!this.txtStudent.Text.Trim().Equals(""))
            {
                filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'";
            }
            else
            {
                filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight);
            }

            if (!this.txtRepCode.Text.Trim().Equals(""))
            {
                filterSalesPerson = "e.SRepCode = '" + this.txtRepCode.Text.Trim() + "'";
            }
            else
            {
                filterSalesPerson = hp.Get_Filter("e.SRepCode", DS_SalesPersonRight);
            }

            //validate
            if (!filterStudent.Trim().Equals(""))
            {
                filterStudent = " and " + filterStudent;
            }

            if (!filterSalesPerson.Trim().Equals(""))
            {
                filterSalesPerson = " and " + filterSalesPerson;
            }

            string filterDate = " where a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' and a.DDate <= '" + txtDateTo.Value.ToShortDateString() + "'";

            DatabaseConnection dbCon  = new DatabaseConnection();
            string             cQuery = "Select a.SRefNo,a.DAddDate as DDate,c.SName,iif(SRepName is null,'NONE',SRepName) as SRepName,b.NAlloAmount,"
                                        + " a.SAddUser from File_PaymentH a "
                                        + " inner join File_PaymentD b on a.SRefNo = b.SRefNo inner join File_Student c on a.SStudentId = c.SStudentId "
                                        + " left join File_InvoiceH e on b.SInvNo = e.SRefNo left join File_SalesPerson d on d.SRepCode = e.SRepCode "
                                        + filterDate + " " + filterStudent + " " + filterSalesPerson;

            DataSet Payment_ListingDataSet = dbCon.Get_ReportData(cQuery, "DT_PaymentListing");

            Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Payment_Listing.rpt", Payment_ListingDataSet, "Payment Listing");

            if (Payment_ListingDataSet.Tables[0].Rows.Count > 0)
            {
                newReport.ShowInTaskbar = false;
                newReport.ShowDialog();
            }
            else
            {
                MessageBox.Show("No Data To Print");
            }
        }
Exemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            HelpFilter hp = new HelpFilter();

            string filterStudent     = "";
            string filterCourse      = "";
            string filterSalesPerson = "";

            if (!this.txtStudent.Text.Trim().Equals(""))
            {
                filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'";
            }
            else
            {
                filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight);
            }

            if (!this.txtCourse.Text.Trim().Equals(""))
            {
                filterCourse = "b.SCourseCode = '" + this.txtCourse.Text.Trim() + "'";
            }
            else
            {
                filterCourse = hp.Get_Filter("b.SCourseCode", DS_CourseRight);
            }

            if (!this.txtRepCode.Text.Trim().Equals(""))
            {
                filterSalesPerson = "e.SRepCode = '" + this.txtRepCode.Text.Trim() + "'";
            }
            else
            {
                filterSalesPerson = hp.Get_Filter("e.SRepCode", DS_SalesPersonRight);
            }

            //validate
            if (!filterStudent.Trim().Equals(""))
            {
                filterStudent = " and " + filterStudent;
            }

            if (!filterCourse.Trim().Equals(""))
            {
                filterCourse = " and " + filterCourse;
            }

            if (!filterSalesPerson.Trim().Equals(""))
            {
                filterSalesPerson = " and " + filterSalesPerson;
            }

            DatabaseConnection dbCon  = new DatabaseConnection();
            string             cQuery = "select a.SRefNo,a.DDate,a.SStudentId,d.SName,b.SCourseCode,c.SCourseName,b.NAmount,"
                                        + "b.NDiscount,iif(SRepName is null, 'NONE', SRepName) as SRepName,a.SAddUser,a.DAddDate from "
                                        + " File_InvoiceH a inner join File_InvoiceD b on a.SRefNo = b.SRefNo inner join File_Course c on "
                                        + "b.SCourseCode = c.SCourseCode inner join File_Student d on d.SStudentId = a.SStudentId "
                                        + "left join File_SalesPerson e on e.SRepCode = a.SRepCode where a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' "
                                        + " and a.DDate<='" + txtDateTo.Value.ToShortDateString() + "' " + filterStudent + "  "
                                        + filterCourse + "  " + filterSalesPerson;

            DataSet Invoice_ListingDataSet = dbCon.Get_ReportData(cQuery, "DT_InvoiceListing");

            if (Invoice_ListingDataSet.Tables[0].Rows.Count > 0)
            {
                Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Invoice_Listing.rpt", Invoice_ListingDataSet, "Invoice Listing");
                newReport.ShowInTaskbar = false;
                newReport.ShowDialog();
            }
            else
            {
                MessageBox.Show("No Data To Print");
            }
        }
Exemplo n.º 3
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            HelpFilter hp = new HelpFilter();

            string filterStudent = "";
            string filterCourse  = "";

            if (!this.txtStudent.Text.Trim().Equals(""))
            {
                filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'";
            }
            else
            {
                filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight);
            }

            if (!this.txtCourse.Text.Trim().Equals(""))
            {
                filterCourse = "c.SCourseCode = '" + this.txtCourse.Text.Trim() + "'";
            }
            else
            {
                filterCourse = hp.Get_Filter("c.SCourseCode", DS_CourseRight);
            }

            //validate
            if (!filterStudent.Trim().Equals(""))
            {
                filterStudent = " and " + filterStudent;
            }

            if (!filterCourse.Trim().Equals(""))
            {
                filterCourse = " and " + filterCourse;
            }

            string filterDate = " and a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' and a.DDate <= '" + txtDateTo.Value.ToShortDateString() + "'";

            DatabaseConnection dbCon = new DatabaseConnection();
            string             cQuery;

            if (this.radioButton1.Checked)
            {
                cQuery = "Select c.SCourseCode,SCourseName,a.SStudentId,SName,STelNo,SMobileNo,SEmail "
                         + " from File_InvoiceH a,File_InvoiceD e, File_Student b,File_Course c  where "
                         + " a.SStudentId = b.SStudentId and c.SCourseCode = e.SCourseCode and a.SRefNo = e.SRefNo "
                         + " and a.NBalanceAmount > 0 " + filterDate + " " + filterStudent + " " + filterCourse;
            }
            else
            {
                cQuery = "Select c.SCourseCode,SCourseName,a.SStudentId,SName,STelNo,SMobileNo,SEmail "
                         + " from File_InvoiceH a,File_InvoiceD e, File_Student b,File_Course c  where "
                         + " a.SStudentId = b.SStudentId and c.SCourseCode = e.SCourseCode and a.SRefNo = e.SRefNo "
                         + filterDate + " " + filterStudent + " " + filterCourse;
            }

            DataSet Student_CourseDataSet = dbCon.Get_ReportData(cQuery, "DT_StudentCourse");

            Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Student_Course.rpt", Student_CourseDataSet, "Invoice Listing");

            if (Student_CourseDataSet.Tables[0].Rows.Count > 0)
            {
                newReport.ShowInTaskbar = false;
                newReport.ShowDialog();
            }
            else
            {
                MessageBox.Show("No Valid Data To Print");
            }
        }
Exemplo n.º 4
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            HelpFilter hp = new HelpFilter();

            string filterStudent = "";
            string filterCourse  = "";

            if (!this.txtStudent.Text.Trim().Equals(""))
            {
                filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'";
            }
            else
            {
                filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight);
            }

            if (!this.txtCourse.Text.Trim().Equals(""))
            {
                filterCourse = "c.SCourseCode = '" + this.txtCourse.Text.Trim() + "'";
            }
            else
            {
                filterCourse = hp.Get_Filter("c.SCourseCode", DS_CourseRight);
            }

            //validate
            if (!filterStudent.Trim().Equals(""))
            {
                filterStudent = " and " + filterStudent;
            }

            if (!filterCourse.Trim().Equals(""))
            {
                filterCourse = " and " + filterCourse;
            }

            string filterDate = " and a.DDate='" + txtDateFrom.Value.ToShortDateString() + "' ";

            DatabaseConnection dbCon  = new DatabaseConnection();
            string             cQuery = "Select SRefNo,DDate,SName,SMobileNo from File_PaymentH a,File_Student b "
                                        + " where a.SStudentId = b.SStudentId  " + filterDate + filterStudent + filterCourse;

            DataSet Student_PaymentDataSet = dbCon.Get_ReportData(cQuery, "DT_StudentPayment");

            Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Student_Payment.rpt", Student_PaymentDataSet, "Student Payment Listing");

            if (Student_PaymentDataSet.Tables[0].Rows.Count > 0)
            {
                newReport.ShowInTaskbar = false;
                newReport.ShowDialog();

                //Email
                DialogResult dRes = MessageBox.Show("Do You Want To Email This Report?", "Confirm", MessageBoxButtons.YesNo);
                if (dRes == DialogResult.Yes)
                {
                    string    studentId = this.txtStudent.Text.Trim();
                    SendEmail newMail   = new SendEmail("Rpt_Student_Payment.pdf", newReport, studentId);
                    newMail.ShowInTaskbar = false;
                    newMail.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("No Valid Data To Print");
            }
        }