示例#1
0
        private void lnkPrintLedger_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (Convert.ToUInt16(this.Tag) == 0)
            {
                return;
            }
            ReportDocument RptFilename = new ReportDocument();

            RptFilename = new Reports.Ledger();

            //  RptFilename.Load(MyModules.AppPath + "ConfigDir\\Ledger.rpt");
            string        selformular = "";
            FrmRptDisplay ChildForm   = new FrmRptDisplay();

            ChildForm.RptTitle         = "Ledger";
            ChildForm.RptDestination   = "Screen";
            ChildForm.myReportDocument = RptFilename;

            if (RadSchool.Checked)
            {
                selformular = " {RptLedger.Source}='SCHOOL' AND {RptLedger.RefNo}=" + this.Tag;
            }
            if (RadStudent.Checked)
            {
                selformular = " {RptLedger.Source}='STUDENT' AND {RptLedger.RefNo}=" + this.Tag;
            }
            if (RadVendor.Checked)
            {
                selformular = " {RptLedger.Source}='VENDOR' AND {RptLedger.RefNo}=" + this.Tag;
            }
            if (radStaff.Checked)
            {
                selformular = " {RptLedger.Source}='STAFF' AND {RptLedger.RefNo}=" + this.Tag;
            }

            string tstartdate = (dtpStartDate.Checked == false ? "" : "Date(" + dtpStartDate.Value.Year + "," + dtpStartDate.Value.Month + "," + dtpStartDate.Value.Day + ")");
            string tenddate   = (dtpEndDate.Checked == false ? "" : "Date(" + dtpEndDate.Value.Year + "," + dtpEndDate.Value.Month + "," + dtpEndDate.Value.Day + ")");

            if (tstartdate != "")
            {
                selformular = selformular + (selformular == ""?"": " AND ") + " {RptLedger.PayValueDate}>=" + tstartdate;
            }

            if (tenddate != "")
            {
                selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptLedger.PayValueDate}<=" + tenddate;
            }

            if (selformular != "")
            {
                ChildForm.SelFormula = selformular;
            }
            ChildForm.ShowDialog();
        }
示例#2
0
        private void cmdOk_Click(object sender, EventArgs e)
        {
            if (tMandateNo.Text.Trim() == "")
            {
                MessageBox.Show("Pls. select mandate no", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //if (LastMandateNo == "")
            //{
            //    MessageBox.Show("Cannot determine last Mandate...pls select", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            CrystalDecisions.CrystalReports.Engine.ReportDocument RptFilename = new CrystalDecisions.CrystalReports.Engine.ReportDocument();



            FrmRptDisplay ChildForm1 = new FrmRptDisplay();

            ChildForm1.SelFormula = "";
            if (MainAction == "Main")
            {
                RptFilename.Load(MyModules.AppPath + "ConfigDir\\Mandate.rpt");
                ChildForm1.SelFormula = " {RptPayment.MandateNo}='" + TheMandateNo + "'";
            }
            if (MainAction == "VAT")
            {
                RptFilename.Load(MyModules.AppPath + "ConfigDir\\MandateVAT.rpt");
                ChildForm1.SelFormula = " {RptPaymentDeductions.MandateNo}='" + TheMandateNo + "' AND {RptPaymentDeductions.MainAction}='VAT'";
            }
            if (MainAction == "WHT")
            {
                RptFilename.Load(MyModules.AppPath + "ConfigDir\\MandateWHT.rpt");
                ChildForm1.SelFormula = " {RptPaymentDeductions.MandateNo}='" + TheMandateNo + "' AND {RptPaymentDeductions.MainAction}='WHT'";
            }
            if (MainAction == "Stamp")
            {
                RptFilename.Load(MyModules.AppPath + "ConfigDir\\MandateStamp.rpt");
                ChildForm1.SelFormula = " {RptPaymentDeductions.MandateNo}='" + TheMandateNo + "' AND {RptPaymentDeductions.MainAction}='Stamp'";
            }


            RptFilename.DataDefinition.FormulaFields["Signatory1"].Text = "'" + tSignatory1.Text + "'";
            RptFilename.DataDefinition.FormulaFields["Signatory2"].Text = "'" + tSignatory2.Text + "'";
            RptFilename.DataDefinition.FormulaFields["RefNo"].Text      = "'" + tMandateNo.Text + "'";

            ChildForm1.RptTitle         = "Mandate";
            ChildForm1.RptDestination   = "Screen";
            ChildForm1.myReportDocument = RptFilename;
            ChildForm1.ShowDialog();

            if (MainAction == "VAT")
            {
                FrmRptDisplay ChildForm0 = new FrmRptDisplay();
                ChildForm0.SelFormula = "";
                RptFilename.Load(MyModules.AppPath + "ConfigDir\\DeductionList.rpt");
                ChildForm0.SelFormula       = " {RptPaymentDeductions.MandateNo}='" + TheMandateNo + "' AND {RptPaymentDeductions.MainAction}='VAT'";
                ChildForm0.RptTitle         = "Mandate";
                ChildForm0.RptDestination   = "Screen";
                ChildForm0.myReportDocument = RptFilename;
                ChildForm0.ShowDialog();
            }

            if (MyModules.Signatory1 != tSignatory1.Text || MyModules.Signatory2 != tSignatory2.Text)
            {
                SaveDefault();
                MyModules.Signatory1 = tSignatory1.Text;
                MyModules.Signatory2 = tSignatory2.Text;
            }
            if (tMandateNo.Text != "")
            {
                SaveRefNo();
            }
        }
示例#3
0
        private void cboOk_Click(object sender, EventArgs e)
        {
            string         selformular = "";
            ReportDocument RptFilename = new ReportDocument();

            string tstartdate = (dtpStartDate.Checked == false ? "" : "Date(" + dtpStartDate.Value.Year + "," + dtpStartDate.Value.Month + "," + dtpStartDate.Value.Day + ")");
            string tenddate   = (dtpEndDate.Checked == false ? "" : "Date(" + dtpEndDate.Value.Year + "," + dtpEndDate.Value.Month + "," + dtpEndDate.Value.Day + ")");

            switch (lblReportTitle.Text)
            {
            case "Payment List (Layout 1)":
                RptFilename = new Reports.PaymentList();
                if (chkSchool.Checked)
                {
                    selformular = " {RptPaymentWithRegionAndCategory.Source}='SCHOOL'";
                }
                if (chkStudent.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STUDENT'";
                }
                if (chkVendor.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='VENDOR'";
                }
                if (chkStaff.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STAFF'";
                }

                if (selformular != "")
                {
                    selformular = "(" + selformular + ")";
                }

                if (tstartdate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}>=" + tstartdate;
                }

                if (tenddate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}<=" + tenddate;
                }

                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Category}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Intervention Line")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.InterventionLine}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Region}";
                    break;

                case  "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Category}";
                    break;

                case "Intervention Line":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.InterventionLine}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }
                break;

            case "Payment List (Layout 2)":
                RptFilename = new Reports.PaymentList2();
                if (chkSchool.Checked)
                {
                    selformular = " {RptPaymentWithRegionAndCategory.Source}='SCHOOL'";
                }
                if (chkStudent.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STUDENT'";
                }
                if (chkVendor.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='VENDOR'";
                }
                if (chkStaff.Checked)
                {
                    selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STAFF'";
                }

                if (selformular != "")
                {
                    selformular = "(" + selformular + ")";
                }

                if (tstartdate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}>=" + tstartdate;
                }

                if (tenddate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}<=" + tenddate;
                }

                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Category}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Intervention Line")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.InterventionLine}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Region}";
                    break;

                case "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Category}";
                    break;

                case "Intervention Line":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.InterventionLine}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }
                break;

            case "School List":
                RptFilename = new Reports.SchoolList();
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterSchool.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterSchool.Category}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterSchool.Region}";
                    break;

                case "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterSchool.Category}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }

                break;

            case "Student List":
                RptFilename = new Reports.StudentList();
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterStudent.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterStudent.Category}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterStudent.Region}";
                    break;

                case "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterStudent.Category}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }
                break;

            case "Staff List":
                RptFilename = new Reports.VendorList();
                selformular = " {RptRegisterVendor.Source}='STAFF'";
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Category}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Region}";
                    break;

                case "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Category}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }
                break;

            case "Vendor List":
                RptFilename = new Reports.VendorList();
                selformular = " {RptRegisterVendor.Source}='VENDOR'";
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Region}='" + cboGrpFilter.Text + "'";
                }
                if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Category}='" + cboGrpFilter.Text + "'";
                }

                switch (cboGrpBy.Text)
                {
                case "Region":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Region}";
                    break;

                case "Category":
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Category}";
                    break;

                default:
                    RptFilename.DataDefinition.FormulaFields["Grp"].Text = "";
                    break;
                }
                break;

            case "Mandate":
                FrmMandateRpt childform = new FrmMandateRpt();
                childform.TheMandateNo = cboMandateNo.Text;
                childform.dAmount      = "0";
                childform.MainAction   = "Main";
                childform.ShowDialog();
                return;

            case "Payment Deduction List":
                RptFilename = new Reports.PaymentDeductionList();
                if (tstartdate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentDeductions.PayValueDate}>=" + tstartdate;
                }

                if (tenddate != "")
                {
                    selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentDeductions.PayValueDate}<=" + tenddate;
                }

                break;

            default:
                MessageBox.Show("Pls. select a report option");
                return;
            }

            FrmRptDisplay ChildForm = new FrmRptDisplay();

            ChildForm.RptTitle         = lblReportTitle.Text;
            ChildForm.RptDestination   = "Screen";
            ChildForm.myReportDocument = RptFilename;

            //MessageBox.Show(selformular);

            if (selformular != "")
            {
                ChildForm.SelFormula = selformular;
            }
            ChildForm.ShowDialog();
        }