示例#1
0
        //BGW asynchronously GET EMPLOYEE DETAILS
        //ASYNC GET IMAGE FROM DATABASE
        //ASYNC GET LASTEST POSITION
        private void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            Employee getter = new Employee();
            getter.empid = empid;

            if (dbcon.CONNECT()) {
                emp=getter.SELECT_BY_ID(dbcon);
                emp.GET_IMAGE_BY_ID(dbcon);
                emp.GET_CURRENT_POSITION(dbcon);

                Emp_Sched es = new Emp_Sched();
                es.empid = emp.empid;
                empsched = es.SELECT_BY_EMPID(dbcon);
            }
        }
示例#2
0
        private void cboemp_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtinterest.Text = "";
            txtinterest_amort.Text = "";
            cboprincipal.Text = "";
            txtprincipal_amort.Text = "";
            txttotal_amort.Text = "";
            MAXIMUM_ALLOWED_AMORT_PERIOD = 0;
            MAXIMUM_ALLOWED_LOAN = 0;
            txtbalance.Text = "";
            cbopayment_mode.Text = "";
            cbocollection_day.Text = "";
            cboamortization_period.Text = "";
            txtnetproceeds.Text = "";
            lbapplicantsdata.Items.Clear();
            lblatestloan.Items.Clear();
            lbcomakersdata.Items.Clear();
            lbcomakerslatestloan.Items.Clear();

            if (cboemp.Text != "")
            {
                String[] c = cboemp.Text.ToString().Split('-');
                String id = c[1];
                Employee emp2 = new Employee();
                emp2.empid = id;

               applicant = emp2.SELECT_BY_ID();

                //GET LATEST BASIC SAL
                decimal BASIC_PAY = applicant.GET_BASIC_PAY();

                //emp1.SELECT_BY_ID();
                applicant.GET_IMAGE_BY_ID();

                String pos = (applicant.GET_CURRENT_POSITION() != "") ? applicant.position.ToString() : "NO_POSITION_INDICATED";
                lblemp.Text = applicant.lname.ToUpper() + ", " + applicant.fname.ToUpper() + " " + applicant.mname.ToUpper() + " - " + pos;

                //WHEN WAS THE EMPLOYEE BECAME REGULAR?
                DateTime regularization_date = applicant.GET_REGULAR_STATUS_DATE();
                int months_as_regular = Global.GetMonths(regularization_date, DateTime.Now);

                //DISPLAY REGULARIZATION DATE
                lbapplicantsdata.Items.Add("EMPLOYEE INFORMATION");
                lbapplicantsdata.Items.Add("BECAME REGULAR SINCE :" + regularization_date.ToShortDateString());
                lbapplicantsdata.Items.Add("TOTAL MONTHS_IN_SEVICE AS REGULAR : " + months_as_regular.ToString());
                lbapplicantsdata.Items.Add("BASIC SALARY : " + BASIC_PAY.ToString("#,##0.00"));

                //DETERMINE HOW MUCH LOAN IS ALLOWED FOR THIS CERTAIN EMPLOYEE
                //ACCORDING TO HIS/HER BASIC PAY
                //MessageBox.Show(months_as_regular + " - " + BASIC_PAY.ToString());
                if ((months_as_regular >= 6) && (months_as_regular <= 12))
                {
                    MAXIMUM_ALLOWED_LOAN = 2 * BASIC_PAY;
                    MAXIMUM_ALLOWED_AMORT_PERIOD = 6;

                    iteratesalary(BASIC_PAY, cboprincipal, 2);

                }
                else if ((months_as_regular > 12) && (months_as_regular <= 24))
                {
                    MAXIMUM_ALLOWED_LOAN = 4 * BASIC_PAY;
                    MAXIMUM_ALLOWED_AMORT_PERIOD = 24;
                    iteratesalary(BASIC_PAY, cboprincipal, 4);
                }
                else if (months_as_regular > 24)
                {
                    MAXIMUM_ALLOWED_LOAN = 6 * BASIC_PAY;
                    MAXIMUM_ALLOWED_AMORT_PERIOD = 24;
                    iteratesalary(BASIC_PAY, cboprincipal, 6);

                }

                //display latest loan

                l.empid = applicant.empid;

                Loan applicant_latest_loan = l.GET_LATEST_LOAN("SALARY");
                PREV_LOAN = applicant_latest_loan;
                // GET THE LATEST MICRO LOAN OF A MEMBER
                lblatestloan.Items.Add("LATEST MICRO LOAN");
                LATEST_SALARY_LOAN = (applicant_latest_loan != null) ? applicant_latest_loan.principal : 0;

                if (LATEST_SALARY_LOAN != 0)
                {
                    lblatestloan.Items.Add("APPLICATION NO : " + applicant_latest_loan.application_no);
                    lblatestloan.Items.Add("PRINCIPAL : PhP " + applicant_latest_loan.principal.ToString("#,##0.00"));
                    lblatestloan.Items.Add("INTEREST : PhP " + applicant_latest_loan.interest.ToString("#,##0.00"));
                    lblatestloan.Items.Add("MONTHLY AMORTIZATION: PhP " + (applicant_latest_loan.amortization_on_interest + applicant_latest_loan.amortization_on_principal).ToString("#,##0.00"));
                    lblatestloan.Items.Add("BALANCE: ---(under development)---");
                }
                else {
                    lblatestloan.Items.Add("Nothing found...");
                    lblatestloan.Items.Add("MAXIMUM ALLOWED LOAN :" + MAXIMUM_ALLOWED_LOAN.ToString("#,##0.00"));
                    lblatestloan.Items.Add("MAXIMUM AMORTIZATION PERIOD :" + MAXIMUM_ALLOWED_AMORT_PERIOD.ToString());
                }

                cboprincipal.Text = MAXIMUM_ALLOWED_LOAN.ToString("0.00");
               // lblloancategory.Text = "MAXIMUM_ALLOWED_AMOUNT : " + MAXIMUM_ALLOWED_LOAN.ToString("#,##0.00") + " MAXIMUM_AMORTIZATION_PERIOD : " + MAXIMUM_ALLOWED_AMORT_PERIOD.ToString();
                //nmamortperiod.Maximum = MAXIMUM_ALLOWED_AMORT_PERIOD;
                //nmamortperiod.Value = nmamortperiod.Maximum;

                if (applicant.pic != null)
                {
                    MemoryStream ms = new MemoryStream(applicant.pic);
                    pb.Image = Image.FromStream(ms);
                    pb.SizeMode = PictureBoxSizeMode.Zoom;
                }
                else
                {
                    pb.Image = Properties.Resources.noimagefound;
                    pb.SizeMode = PictureBoxSizeMode.Zoom;
                }
            }
        }
        private void frmCutoffAttendanceReport_Load(object sender, EventArgs e)
        {
            this.rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
            this.rptViewer.LocalReport.DataSources.Clear();

            string path = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString();
            var directory = System.IO.Path.GetDirectoryName(path);
            directory += "\\reports\\atttendance_cutoff.rdlc";

            //C:\projects\MMG-PIAPS\MMG-PIAPS\bin\Debug\reports\cutoff_attendance.rdlc
            //C:\projects\MMG-PIAPS\MMG-PIAPS\bin\Debug\reports\atttendance_cutoff.rdlc
            this.rptViewer.LocalReport.ReportPath = directory;

            //MessageBox.Show(directory);

            Employee emp = new Employee();
            emp.branch = "2";

            DataTable dt = emp.SELECT_BY_BRANCH();

            DataSet1 ds = new DataSet1();
            cutoffdt = ds.Tables["cutoffattendance"];

            //CREATE AN IMAGE COLUMN
            //SET THE IMAGE VALUE
            //THEN ADD TO DATASET FOR REPORT REFERENCE
            DataColumn colByteArray = new DataColumn("emp_img");
            colByteArray.DataType = System.Type.GetType("System.Byte[]");
            dt.Columns.Add(colByteArray);

            foreach (DataRow item in dt.Rows) {

                Employee e1 = new Employee();
                e1.empid = item["empid"].ToString();
                item["emp_img"] = e1.GET_IMAGE_BY_ID();

                //=====================================

                //FOR SUBREPORT DATASOURCE
                //POPULATE THE DATASET, FOR SUBREPORT USAGE
                //WITH THE EMPLOYEE'S ATTENDANCE FROM BIOMETRICS
                //THEN CHECKS THE ATTENDANCE WHETHER GOOD (IN,OUT,IN,OUT)
                //OR INAPPROPRIATE (IN ONLY, OR (IN, OUT, IN), OR (IN,OUT,OUT,IN,OUT)
                //AND OTHER IMPROPER ATTENDANCE LOGS
                int x = 1;
                foreach (DataRow cutoffitem in cutoffdetailsdt.Rows)
                {

                    DataRow c = cutoffdt.NewRow();

                    DateTime d = Convert.ToDateTime(cutoffitem["date_"].ToString());
                    c.BeginEdit();
                    c["empid"] = e1.empid;
                    c["no"] = x;
                    c["date_"] = d.ToString("MM/dd/yyyy");

                    //CRREATE A DYNAMIC CONNECTION TO DB
                    non_static_dbcon cn = new non_static_dbcon();

                    //COMPARE CUTOFF DATE WITH ATTENDANCE HERE
                    //==============================================
                    String attendance;

                    String status;

                    if (cn.CONNECT())
                    {
                        Attendance att = new Attendance();
                        att.empid = e1.empid;

                        attendance = att.SELECT_STR_BY_EMPID_BY_DATE(d, cn);

                        String[] attarr= attendance.Split(',');

                        if (attendance != "")
                        {
                            if ((attarr.Length == 3) || (attarr.Length > 4))
                            {
                                status = "INAPPROPRIATE";
                            }
                            else if ((attarr.Length == 2) || attarr.Length == 4)
                            {
                                status = "GOOD";
                            }
                            else {
                                status = "INAPPROPRIATE";
                            }
                        }
                        else {
                            status = "";
                        }

                    }
                    else {
                        attendance = "";
                        status = "";
                    }

                    cn.DISCONNECT();

                    c["attendance_"] = attendance;
                    //===============================================
                    c["day_type"] = cutoffitem["day_type"].ToString();

                    c["status_"] = status;
                    cutoffdt.Rows.Add(c);

                    x++;
                }

                //=====================================
            }//end foreach item in dt.rows
            ReportDataSource r = new ReportDataSource("DataSet1", dt);

            this.rptViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing);

            //SET REPORT PARAMETER
            ReportParameter from_date = new ReportParameter("cutoff_date_from", cutoff_date_from.ToString("MM/dd/yyyy"));
            ReportParameter to_date = new ReportParameter("cutoff_date_to", cutoff_date_to.ToString("MM/dd/yyyy"));

            rptViewer.LocalReport.SetParameters(from_date);
            rptViewer.LocalReport.SetParameters(to_date);

            this.rptViewer.LocalReport.DataSources.Add(r);

               // this.rptViewer.SetDisplayMode(DisplayMode.PrintLayout);
            this.rptViewer.RefreshReport();
        }
示例#4
0
        private void cboComaker_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbcomakersdata.Items.Clear();
            lbcomakerslatestloan.Items.Clear();

            if (cboComaker.Text != "")
            {
                String[] c = cboComaker.Text.ToString().Split('-');
                String id = c[1];
                Employee emp2 = new Employee();
                emp2.empid = id;

                comaker = emp2.SELECT_BY_ID();

                //GET LATEST BASIC SAL
                decimal BASIC_PAY = comaker.GET_BASIC_PAY();

                //emp1.SELECT_BY_ID();
                comaker.GET_IMAGE_BY_ID();

                String pos = (comaker.GET_CURRENT_POSITION() != "") ? comaker.position.ToString() : "NO_POSITION_INDICATED";
                lblcomaker.Text = comaker.lname.ToUpper() + ", " + comaker.fname.ToUpper() + " " + comaker.mname.ToUpper() + " - " + pos;

                //WHEN WAS THE EMPLOYEE BECAME REGULAR?
                DateTime regularization_date = comaker.GET_REGULAR_STATUS_DATE();
                int months_as_regular = Global.GetMonths(regularization_date, DateTime.Now);

                //DISPLAY REGULARIZATION DATE
                lbcomakersdata.Items.Add("EMPLOYEE INFORMATION");
                lbcomakersdata.Items.Add("BECAME REGULAR SINCE :" + regularization_date.ToShortDateString());
                lbcomakersdata.Items.Add("TOTAL MONTHS_IN_SEVICE AS REGULAR : " + months_as_regular.ToString());
                lbcomakersdata.Items.Add("BASIC SALARY : " + BASIC_PAY.ToString("#,##0.00"));

                //display latest loan

                l.empid = comaker.empid;

                Loan comakers_latest_loan = l.GET_LATEST_LOAN("SALARY");

                // GET THE LATEST MICRO LOAN OF A MEMBER
                lbcomakerslatestloan.Items.Add("LATEST MICRO LOAN");
                COMAKERS_LATEST_SALARY_LOAN = (comakers_latest_loan != null) ? comakers_latest_loan.principal : 0;

                if (COMAKERS_LATEST_SALARY_LOAN != 0)
                {
                    lbcomakerslatestloan.Items.Add("APPLICATION NO : " + comakers_latest_loan.application_no);
                    lbcomakerslatestloan.Items.Add("PRINCIPAL : PhP " + comakers_latest_loan.principal.ToString("#,##0.00"));
                    lbcomakerslatestloan.Items.Add("INTEREST : PhP " + comakers_latest_loan.interest.ToString("#,##0.00"));
                    lbcomakerslatestloan.Items.Add("MONTHLY AMORTIZATION: PhP " + (comakers_latest_loan.amortization_on_interest + comakers_latest_loan.amortization_on_principal).ToString("#,##0.00"));
                    lbcomakerslatestloan.Items.Add("BALANCE: ---(under development)---");
                }
                else
                {

                    lbcomakerslatestloan.Items.Add("Nothing found...");

                }

                //CHECK IF THIS COMAKER HAS BEEN A COMAKER FOR MORE THAN ONE(1) MEMBER_EMPLOYEE
                 //==========================================================================
                //-------> INSERT CODE HERE

                lbcomakerslatestloan.Items.Add("CURRENTLY COMAKER TO : ...{under development}...");
                //===========================================================================

                // LOAD EMPLOYEE PICTURE
                if (comaker.pic != null)
                {
                    MemoryStream ms = new MemoryStream(comaker.pic);
                    pbcomaker.Image = Image.FromStream(ms);
                    pbcomaker.SizeMode = PictureBoxSizeMode.Zoom;
                }
                else
                {
                    pbcomaker.Image = Properties.Resources.noimagefound;
                    pbcomaker.SizeMode = PictureBoxSizeMode.Zoom;
                }
            }
        }