Exemple #1
0
 private void yearComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(firstLoad, false, false)))
     {
         MdlTimeManagement.populateEndPeriod();
     }
 }
Exemple #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var cIn  = Convert.ToDateTime(clockInDateTimePicker.Value.ToShortDateString() + " " + clockInTimePicker.Value.ToShortTimeString());
            var cOut = Convert.ToDateTime(clockoOutDateTimePicker.Value.ToShortDateString() + " " + clockOutTimePicker.Value.ToShortTimeString());

            if (string.IsNullOrEmpty(modifiedByTextBox.Text) | reasonNewEntryComboBox.SelectedIndex == -1)
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (reasonNewEntryComboBox.SelectedItem.Equals("Other") & string.IsNullOrEmpty(RichTextBox1.Text))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (clockOutCheckBox.Checked & cIn > cOut)
            {
                MdlControllerModifier.warning("Wrong time", editEntryTitleLabel);
            }
            else
            {
                int selectedItemD = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.CurrentCell.RowIndex;
                int selectedItemS = My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.CurrentCell.RowIndex;
                if (shiftTypeComboBox.SelectedItem.Equals("Hourly") & My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[7].Value.Equals("Crew") & workDoneListView.CheckedIndices.Count == 0 & clockOutCheckBox.Checked)
                {
                    MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
                }
                else
                {
                    MdlTimeManagement.updatePunchInfo();
                    int userId = Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[7].Value.Equals("Crew"));
                    MdlTimeManagement.populateDetails(Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[6].Value));
                    MdlControllerModifier.clearFields();
                    Close();
                }
            }
        }
Exemple #3
0
        private void FrmDetailedEntry_Load(object sender, EventArgs e)
        {
            int selectedEntry = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.CurrentCell.RowIndex;
            int punchID       = Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.Rows[selectedEntry].Cells[6].Value);

            MdlTimeManagement.getEntryDetails();
        }
Exemple #4
0
 private void FrmTimeManagement_Load(object sender, EventArgs e)
 {
     summaryBunifuDataGridView.InitializeLifetimeService();
     MdlOptionsManagement.getTimeManagementAllowedFunctionalities();
     payMethodComboBox.SelectedIndex = 0;
     MdlTimeManagement.populateMonthDropDown();
 }
Exemple #5
0
 private void endPeriodComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     // MdlControllerModifier.deactivateButtons(detailedEntryButton, editEntryButton, editEntryButton, deleteEntryButton)
     // payMethodComboBox.SelectedIndex = 0
     MdlTimeManagement.populateTimeSheetList();
     firstLoad = false;
 }
Exemple #6
0
        private void summaryListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            // MdlControllerModifier.deactivateButtons(detailedEntryButton, editEntryButton, editEntryButton, deleteEntryButton)

            // '      clearDataGrid(detailsBunifuDataGridView)
            detailsBunifuDataGridView.Rows.Clear();
            if (issearch == false)
            {
                if (summaryBunifuDataGridView.SelectedRows.Count > 0)
                {
                    int    selectedRow = summaryBunifuDataGridView.CurrentCell.RowIndex;
                    string aliastName  = Conversions.ToString(summaryBunifuDataGridView.Rows[selectedRow].Cells[1].Value);
                    string lastName    = Conversions.ToString(summaryBunifuDataGridView.Rows[selectedRow].Cells[2].Value);
                    int    employeeID  = Conversions.ToInteger(summaryBunifuDataGridView.Rows[selectedRow].Cells[6].Value);
                    detailsLabel.Text = "Details - " + aliastName + " " + lastName;
                    detailsLabel.Update();
                    MdlTimeManagement.populateDetails(employeeID);
                    indexChanged = true;
                }
            }
            else
            {
                issearch = false;
            }
        }
Exemple #7
0
        private void entryDetailsDataGrid_SelectionChanged(object sender, EventArgs e)
        {
            int selectedEntry = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.CurrentCell.RowIndex;
            int punchID       = Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.Rows[selectedEntry].Cells[6].Value);

            MdlTimeManagement.populateEntryDetails(punchID);
        }
Exemple #8
0
 private void BunifuTextBox1_TextChanged(object sender, EventArgs e)
 {
     if (!findEmployee.Text.Equals(""))
     {
         string condition = " where Alias like '%" + findEmployee.Text + "%' or First_Name Like '%" + findEmployee.Text + "%' or Last_Name Like '%" + findEmployee.Text + "%' order by alias";
         MdlTimeManagement.populateCreateEmployeeEntryList(condition);
     }
 }
Exemple #9
0
        private void createNewEntryButton_Click(object sender, EventArgs e)
        {
            var employeeType = default(string);
            int selectedRow  = createEntyDataGrid.CurrentRow.Index;

            if (createEntyDataGrid.SelectedRows.Count > 0)
            {
                employeeType = Conversions.ToString(createEntyDataGrid.Rows[selectedRow].Cells[4].Value);
            }

            if (string.IsNullOrEmpty(newEntrymodifiedByTextBox.Text) | reasonNewEntryComboBox.SelectedIndex == -1 | shiftTypeComboBox.SelectedIndex == -1 | siteLocationComboBox.SelectedIndex == -1)
            {
            }
            else if (createEntyDataGrid.SelectedRows.Count == 0 | clockInCheckBox.Checked == false)
            {
                MdlControllerModifier.warning("no item selected", editEntryTitleLabel);
            }
            else if (reasonNewEntryComboBox.SelectedItem.Equals("Other") & string.IsNullOrEmpty(RichTextBox1.Text))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (employeeType.Equals("Crew") & workDoneListView.CheckedItems.Count == 0 & shiftTypeComboBox.SelectedItem.Equals("Piece Work"))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (employeeType.Equals("Crew") & workDoneListView.CheckedItems.Count == 0 & shiftTypeComboBox.SelectedItem.Equals("Hourly") & clockOutCheckBox.Checked)
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (clockOutCheckBox.Checked & newEntryclockInTimePicker.Value > newEntryclockOutTimePicker.Value)
            {
                MdlControllerModifier.warning("Wrong time", editEntryTitleLabel);
            }
            else
            {
                MdlTimeManagement.createNewPunch(newEntryDatePicker, newEntryclockInTimePicker, newEntryclockOutTimePicker);
                editEntryTitleLabel.Text = "Success!";
                editEntryTitleLabel.Update();
                if (createEntyDataGrid.SelectedRows.Count > 0)
                {
                    if (My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.SelectedRows.Count > 0)
                    {
                        int selectedEmployee = Conversions.ToInteger(createEntyDataGrid.Rows[selectedRow].Cells[3].Value);
                        MdlTimeManagement.populateDetails(selectedEmployee);
                    }
                    else
                    {
                        MdlTimeManagement.populateTimeSheetList();
                    }

                    Close();
                }

                My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.SelectedIndex = My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.SelectedIndex;
            }
        }
Exemple #10
0
 private void FrmAddNewEntry_Load(object sender, EventArgs e)
 {
     findEmployee.Text                = "";
     editEntryTitleLabel.Text         = "Select employee and entries to be created";
     newEntryDatePicker.Value         = DateTime.Now;
     newEntryclockInTimePicker.Value  = DateTime.Now;
     newEntryclockOutTimePicker.Value = DateTime.Now;
     newEntrymodifiedByTextBox.Text   = My.MyProject.Forms.FrmLoginWindow._employeeName;
     MdlTimeManagement.populateWorks(workDoneListView);
     findEmployee.Select();
 }
Exemple #11
0
        private void FrmEditEntry_Load(object sender, EventArgs e)
        {
            modifiedByTextBox.Text   = My.MyProject.Forms.FrmLoginWindow._employeeName;
            clockInTimePicker.Value  = DateTime.Now;
            clockOutTimePicker.Value = DateTime.Now;
            int    selectedItem = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.CurrentCell.RowIndex;
            string dateE;
            string startTimeStr;
            {
                var withBlock = My.MyProject.Forms.FrmTimeSheet;
                dateE        = Conversions.ToString(withBlock.detailsBunifuDataGridView.Rows[selectedItem].Cells[0].Value);
                startTimeStr = Conversions.ToString(withBlock.detailsBunifuDataGridView.Rows[selectedItem].Cells[1].Value);
            }

            var startTime = Convert.ToDateTime(dateE + " " + startTimeStr);

            clockInTimePicker.Value = startTime;
            Panel2.Show();
            MdlTimeManagement.populateWorks(workDoneListView);
        }
Exemple #12
0
        private void deleteEntryButton_Click(object sender, EventArgs e)
        {
            int selectedItemD = detailsBunifuDataGridView.CurrentCell.RowIndex;
            int selectedItemS = summaryBunifuDataGridView.CurrentCell.RowIndex;
            int employeeID    = Conversions.ToInteger(summaryBunifuDataGridView.Rows[selectedItemS].Cells[6].Value);
            // Dim selectedEmployee As Integer = Convert.ToUInt32(summaryListView.FocusedItem.Index.ToString)
            int _punchID = Convert.ToInt32(detailsBunifuDataGridView.Rows[selectedItemD].Cells[6].Value);
            var result   = MessageBox.Show("Are you sure you want to delete this entry? This can not be undone", "Delete Entry", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                db.deleteEntry(_punchID);
                MdlTimeManagement.populateDetails(employeeID);
                if (detailsBunifuDataGridView.Rows.Count == 0)
                {
                    MdlTimeManagement.populateTimeSheetList();
                }
                // MdlControllerModifier.deactivateButtons(detailedEntryButton, editEntryButton, editEntryButton, deleteEntryButton)
            }
        }
Exemple #13
0
        private void Button1_Click(object sender, EventArgs e)
        {
            bool completeTimeSheet = true;

            if (summaryBunifuDataGridView.SelectedRows.Count > 0)
            {
                if (completeTimeSheet == true)
                {
                    MdlControllerModifier.clearFields();
                    MdlTimeManagement.exportCSV();
                }
                else
                {
                    MdlControllerModifier.warning("timesheet not complete", titleTimeManagementLabel);
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected", titleTimeManagementLabel);
            }
        }
Exemple #14
0
        private void findText()
        {
            for (int i = 0, loopTo = summaryBunifuDataGridView.Rows.Count - 1; i <= loopTo; i++)
            {
                if (summaryBunifuDataGridView.Rows[i].Cells[1].Value.ToString().Contains(searchBunifuTextBox1.Text.ToUpper()) || summaryBunifuDataGridView.Rows[i].Cells[2].Value.ToString().Contains(searchBunifuTextBox1.Text.ToUpper()))
                {
                    // cell.Style.BackColor = Color.Yellow
                    // summaryBunifuDataGridView.Rows(i).Selected = True
                    issearch = true;
                    summaryBunifuDataGridView.CurrentCell = summaryBunifuDataGridView.Rows[i].Cells[1];
                    int    selectedRow = summaryBunifuDataGridView.CurrentCell.RowIndex;
                    string aliastName  = Conversions.ToString(summaryBunifuDataGridView.Rows[selectedRow].Cells[1].Value);
                    string lastName    = Conversions.ToString(summaryBunifuDataGridView.Rows[selectedRow].Cells[2].Value);
                    int    employeeID  = Conversions.ToInteger(summaryBunifuDataGridView.Rows[selectedRow].Cells[6].Value);
                    MdlTimeManagement.populateDetails(employeeID);
                    detailsLabel.Text = "Details - " + aliastName + " " + lastName;
                    return;
                }
            }

            detailsLabel.Update();
        }
Exemple #15
0
 private void monthComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     MdlTimeManagement.populateEndPeriod();
 }
Exemple #16
0
 private void addEntryButton_Click(object sender, EventArgs e)
 {
     MdlTimeManagement.populateCreateEmployeeEntryList("order by Alias");
     MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddNewEntry, this);
 }
Exemple #17
0
 private void editEntryButton_Click(object sender, EventArgs e)
 {
     MdlTimeManagement.fillModifyEntryFields();
     MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditEntry, this);
 }
Exemple #18
0
 private void showAllEmployeesCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     MdlTimeManagement.populateTimeSheetList();
 }
Exemple #19
0
        private void PrintDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            if (summaryIsPrinted == false)
            {
                HH = 80;
                e.Graphics.DrawString(Conversions.ToString(Operators.AddObject("Summary time sheet for period ending ", endPeriodComboBox.SelectedItem)), new Font("Times New Roman", 16f), Brushes.Black, 150f, HH);
                HH += 50;
                e.Graphics.DrawString("Name", new Font("Times New Roman", 14f), Brushes.Black, 80f, HH);
                e.Graphics.DrawString("Total Hours", new Font("Times New Roman", 14f), Brushes.Black, 500f, HH);
                LineNumber += 4;
                HH         += 30;
                for (int i = I_Start, loopTo = summaryBunifuDataGridView.Rows.Count - 1; i <= loopTo; i++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(summaryBunifuDataGridView.Rows[i].Cells[0].Value, true, false)))
                    {
                        decimal hours   = Convert.ToInt32(summaryBunifuDataGridView.Rows[i].Cells[4].Value.ToString().Split(':')[0]);
                        decimal minutes = Convert.ToInt32(summaryBunifuDataGridView.Rows[i].Cells[4].Value.ToString().Split(':')[1]);
                        decimal r       = hours + minutes / 60m;
                        decimal result  = decimal.Round(r, 2, MidpointRounding.AwayFromZero);

                        // e.Graphics.DrawRectangle(New Pen(Color.Black), New System.Drawing.Rectangle(0, HH - 30, 100, 35))
                        e.Graphics.DrawString(Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(summaryBunifuDataGridView.Rows[i].Cells[3].Value, " "), summaryBunifuDataGridView.Rows[i].Cells[2].Value), " ("), summaryBunifuDataGridView.Rows[i].Cells[1].Value), ")")), new Font("Times New Roman", 12f), Brushes.Black, 80f, HH);
                        e.Graphics.DrawString(result.ToString(), new Font("Times New Roman", 12f), Brushes.Black, 505f, HH);
                        e.Graphics.DrawString(Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject("(", summaryBunifuDataGridView.Rows[i].Cells[4].Value.ToString().Replace(":", "hrs ")), "min"), ")")), new Font("Times New Roman", 12f), Brushes.Black, 560f, HH);
                        HH         += 25;
                        LineNumber += 1;
                    }

                    I_Start += 1;
                    if (HH > 1050)
                    {
                        e.HasMorePages   = true;
                        summaryIsPrinted = false;
                        HH = 0;
                        // summaryListView.Items(I_Start).Checked = True
                        summaryBunifuDataGridView.Rows[I_Start].Cells[0].Value = true;
                        // I_Start_Items += 1
                        break;
                    }
                    else
                    {
                    }

                    if (I_Start == summaryBunifuDataGridView.Rows.Count)
                    {
                        e.HasMorePages   = true;
                        summaryIsPrinted = true;
                        I_Start_Items    = 0;
                        break;
                    }
                }
            }
            else
            {
                HH = 50;
                bool    goToNextPage = false;
                decimal h            = 0m;
                decimal m            = 0m;
                for (int j = I_Start_Items, loopTo1 = summaryBunifuDataGridView.Rows.Count - 1; j <= loopTo1; j++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[0].Value, true, false)))
                    {
                        MdlTimeManagement.populateDetails(Conversions.ToInteger(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[6].Value));
                        HH += 30;
                        e.Graphics.DrawString(Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[3].Value, " "), summaryBunifuDataGridView.Rows[I_Start_Items].Cells[2].Value), " ("), summaryBunifuDataGridView.Rows[I_Start_Items].Cells[1].Value), ")")), new Font("Times New Roman", 12f), Brushes.Black, 80f, HH);
                        HH += 30;
                        e.Graphics.DrawString(Conversions.ToString(Operators.AddObject("Time Sheet for period ending ", endPeriodComboBox.SelectedItem)), new Font("Times New Roman", 16f), Brushes.Black, 200f, HH);
                        HH += 40;
                        e.Graphics.DrawString("Date", new Font("Times New Roman", 12.5f), Brushes.Black, 80f, HH);
                        e.Graphics.DrawString("Start Time", new Font("Times New Roman", 12.5f), Brushes.Black, 190f, HH);
                        e.Graphics.DrawString("End Time", new Font("Times New Roman", 12.5f), Brushes.Black, 290f, HH);
                        e.Graphics.DrawString("Pay Method", new Font("Times New Roman", 12.5f), Brushes.Black, 380f, HH);
                        e.Graphics.DrawString("Job Description", new Font("Times New Roman", 12.5f), Brushes.Black, 490f, HH);
                        e.Graphics.DrawString("Hours Worked", new Font("Times New Roman", 12.5f), Brushes.Black, 635f, HH);
                        var detailsListView = MdlTimeManagement.detailedEntires;
                        HH += 30;
                        for (int i = listViewIndex, loopTo2 = detailsListView.Items.Count - 1; i <= loopTo2; i++)
                        {
                            decimal hours;
                            decimal minutes;
                            object  r;
                            object  result;
                            if (!detailsListView.Items[i].SubItems[3].Text.Equals(""))
                            {
                                hours   = Convert.ToInt32(detailsListView.Items[i].SubItems[3].Text.Split(':')[0]);
                                minutes = Convert.ToInt32(detailsListView.Items[i].SubItems[3].Text.Split(':')[1]);
                                r       = hours + minutes / 60m;
                                result  = decimal.Round(Conversions.ToDecimal(r), 2, MidpointRounding.AwayFromZero);
                            }

                            // date
                            e.Graphics.DrawString(detailsListView.Items[i].SubItems[0].Text, new Font("Times New Roman", 12f), Brushes.Black, 80f, HH);
                            // clock in
                            e.Graphics.DrawString(detailsListView.Items[i].SubItems[1].Text, new Font("Times New Roman", 12f), Brushes.Black, 195f, HH);
                            // clock out
                            e.Graphics.DrawString(detailsListView.Items[i].SubItems[2].Text, new Font("Times New Roman", 12f), Brushes.Black, 295f, HH);
                            //
                            e.Graphics.DrawString(detailsListView.Items[i].SubItems[5].Text, new Font("Times New Roman", 12f), Brushes.Black, 385f, HH);
                            detailsListView.Items[i].Focused = true;
                            foreach (DataRow entry in db.getSelectedEntry(Convert.ToInt32(detailsListView.Items[i].SubItems[4].Text)).Rows)
                            {
                                punchID = Conversions.ToInteger(detailsListView.Items[i].SubItems[4].Text);
                                MdlTimeManagement.getWorkDone(punchID, Conversions.ToString(entry["Type"]), Conversions.ToString(entry["Punch_Type"]), Conversions.ToString(entry["Job_Description"]));
                            }

                            string check = MdlTimeManagement.workDone;
                            e.Graphics.DrawString(MdlTimeManagement.workDone, new Font("Times New Roman", 8.5f), Brushes.Black, 495f, HH);
                            if (!detailsListView.Items[i].SubItems[3].Text.Equals(""))
                            {
                                e.Graphics.DrawString(detailsListView.Items[i].SubItems[3].Text.Replace(":", "hrs ") + "min", new Font("Times New Roman", 12f), Brushes.Black, 640f, HH);
                            }
                            else
                            {
                                e.Graphics.DrawString("N/A", new Font("Times New Roman", 12f), Brushes.Black, 640f, HH);
                            }

                            // e.Graphics.DrawString("(" + result.ToString + ")",
                            // New System.Drawing.Font("Times New Roman", 12), Brushes.Black, 680, HH)

                            HH            += 70;
                            listViewIndex += 1;
                            if (HH > 1050)
                            {
                                break;
                            }
                        }

                        if (HH > 1050)
                        {
                            e.HasMorePages   = true;
                            summaryIsPrinted = true;
                            HH = 0;
                            summaryBunifuDataGridView.Rows[I_Start_Items].Cells[0].Value = true;
                            // I_Start_Items += 1
                            break;
                        }
                        else
                        {
                            decimal hour       = Convert.ToInt32(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[4].Value.ToString().Split(':')[0]);
                            decimal minute     = Convert.ToInt32(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[4].Value.ToString().Split(':')[1]);
                            decimal rs         = hour + minute / 60m;
                            decimal resulTotal = decimal.Round(rs, 2, MidpointRounding.AwayFromZero);
                            e.Graphics.DrawString("Total Hours:", new Font("Times New Roman", 12f), Brushes.Black, 510f, HH);
                            e.Graphics.DrawString(Conversions.ToString(Operators.AddObject(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[4].Value.ToString().Replace(":", "hrs "), "min")), new Font("Times New Roman", 12f), Brushes.Black, 640f, HH);
                            HH          += 40;
                            goToNextPage = true;
                        }
                    }

                    I_Start_Items += 1;
                    listViewIndex  = 0;
                    if (goToNextPage == true)
                    {
                        if (I_Start_Items < summaryBunifuDataGridView.Rows.Count)
                        {
                            e.HasMorePages = true;
                            if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(summaryBunifuDataGridView.Rows[I_Start_Items].Cells[0].Value, true, false)))
                            {
                                e.HasMorePages = true;
                            }
                        }

                        summaryIsPrinted = true;
                        HH = 0;
                        // summaryListView.Items(I_Start_Items).Checked = True
                        break;
                    }
                }
            }
        }