コード例 #1
0
ファイル: Timesheet.cs プロジェクト: kimykunjun/test
        public DataTable ListTimesheetWithLateness(int nEmployeeID, Month aMonth, int aYear)
        {
            DateTime startDate, endDate;

            ACMSLogic.Staff.Ultis.DatesRange(out startDate, out endDate, aMonth, aYear);
            DataTable myRosterTable = ListTimesheet(nEmployeeID, startDate, endDate);

//			if (!myRosterTable.Columns.Contains("nRosterID"))
//				throw new Exception("Missing 'nRosterID' at Sv_Staff_Timesheet view.");

            //myRosterTable.PrimaryKey = new DataColumn[] {myRosterTable.Columns["nRosterID"]};
            myRosterTable.DefaultView.Sort = "dtDate";

            Lateness myLateness = new Lateness();

            myLateness.GetLateness(nEmployeeID, aMonth, aYear);
            DataTable myLatenessTable = myLateness.LatenessTable;

            foreach (DataRow rLateness in myLatenessTable.Rows)
            {
                if (Convert.ToDateTime(rLateness["dtDate"]) >= DateTime.Now)
                {
                    continue;
                }
                ////DataRow rRoster = myRosterTable.Rows.Find(rLateness["nRosterID"]);
                //DataRow[] rRoster = myRosterTable.Select("dtDate = '" +rLateness["dtDate"] +"'");
                DataRow[] rRoster = myRosterTable.Select("nRosterID = '" + rLateness["nRosterID"] + "'");
                //if (rRoster != null && rRoster.Length >= 1)
                foreach (DataRow r in rRoster)
                {
                    r.BeginEdit();
                    r["fLateness"]  = true;
                    r["nLateness"]  = ACMS.Convert.ToInt32(r["nLateness"]) + ACMS.Convert.ToInt32(rLateness["nLateness"]);
                    r["dtLateness"] = DateTime.Today.AddMinutes(ACMS.Convert.ToInt32(r["nLateness"]));
                    r.EndEdit();
                }
            }
            return(myRosterTable);
        }
コード例 #2
0
ファイル: frmManager.cs プロジェクト: kimykunjun/test
        private void gen_FirstRun(int nPayrollID)
        {
            //init Function
            string strSQL;
            DataSet _ds;
            int output;

                try
             {
             //Checking status of second run payroll

             output = 0;

             SqlHelper.ExecuteNonQuery(connection,"UP_tblPayroll",
                 new SqlParameter("@RET_VAL",output),
                 new SqlParameter("@CMD","I"),
                 new SqlParameter("@nPayrollID",nPayrollID),
                 new SqlParameter("@nMonth",Convert.ToInt32(comboBoxEditMTH.Text)),
                 new SqlParameter("@nYear",Convert.ToInt32(comboBoxEditYR.Text)),
                 new SqlParameter("@dtFirstRunDate",DateTime.Now.ToShortDateString()),
                 new SqlParameter("@nFirstRunStaff",employee.Id.ToString()),
                 new SqlParameter("@dtSecondRunDate",null),
                 new SqlParameter("@nSecondRunStaff",null)
                 );

             if (cbJob.SelectedIndex != 0)
             {
                 strSQL = "select nEmployeeID,fPartTime,strBranchCode from tblEmployee where nStatusID=1 and strJobPositionCode='" + cbJob.EditValue.ToString() + "'";
             }
             else
             {
                 strSQL = "select nEmployeeID,fPartTime,strBranchCode from tblEmployee where nStatusID=1 ";

             }
             _ds = new DataSet();
             SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );

             progressBarControl1.Properties.Minimum = 0;
             progressBarControl1.Properties.Maximum = _ds.Tables["table"].Rows.Count;
             progressBarControl1.Properties.Step = 1;
             progressBarControl1.Visible = true;

             foreach( DataRow dr in _ds.Tables["table"].Rows )
             {
                 Lateness myLateness = new Lateness();
                 myLateness.GetLateness(Convert.ToInt32(dr[0]), (Month)comboBoxEditMTH.SelectedIndex,
                     Convert.ToInt32(comboBoxEditYR.EditValue));
                 decimal totalLateness = 0;
                 foreach (DataRow row in myLateness.LatenessTable.Rows)
                 {
                     totalLateness += Convert.ToDecimal(row["nLateness"]);
                 }

                 SqlHelper.ExecuteNonQuery(connection,"UP_CALC_PAYROLL",
                     new SqlParameter("@RET_VAL",output),
                     new SqlParameter("@nPayrollID",nPayrollID),
                     new SqlParameter("@nEmployeeID",dr[0]),
                     new SqlParameter("@fparttime",dr[1]),
                     new SqlParameter("@nYear",Convert.ToInt32(comboBoxEditYR.Text)),
                     new SqlParameter("@nMonth",Convert.ToInt32(comboBoxEditMTH.Text)),
                     new SqlParameter("@TotalLateness", totalLateness)

                     );
                 progressBarControl1.PerformStep();
                 progressBarControl1.Update();

             }
             progressBarControl1.Visible = false;
             InitPayroll(1);

             }
             catch (Exception ex)
             {
             MessageBox.Show(ex.Message);
             }
        }
コード例 #3
0
ファイル: Timesheet.cs プロジェクト: kimykunjun/test
        public DataTable ListTimesheetWithLateness(int nEmployeeID, Month aMonth, int aYear)
        {
            DateTime startDate, endDate;
            ACMSLogic.Staff.Ultis.DatesRange(out startDate, out endDate, aMonth, aYear);
            DataTable myRosterTable = ListTimesheet(nEmployeeID, startDate, endDate);
            //			if (!myRosterTable.Columns.Contains("nRosterID"))
            //				throw new Exception("Missing 'nRosterID' at Sv_Staff_Timesheet view.");

            //myRosterTable.PrimaryKey = new DataColumn[] {myRosterTable.Columns["nRosterID"]};
            myRosterTable.DefaultView.Sort = "dtDate";

            Lateness myLateness = new Lateness();
            myLateness.GetLateness(nEmployeeID, aMonth, aYear);
            DataTable myLatenessTable = myLateness.LatenessTable;

            foreach (DataRow rLateness in myLatenessTable.Rows)
            {
                if (Convert.ToDateTime(rLateness["dtDate"]) >= DateTime.Now)
                    continue;
                ////DataRow rRoster = myRosterTable.Rows.Find(rLateness["nRosterID"]);
                //DataRow[] rRoster = myRosterTable.Select("dtDate = '" +rLateness["dtDate"] +"'");
                DataRow[] rRoster = myRosterTable.Select("nRosterID = '" + rLateness["nRosterID"] + "'");
                //if (rRoster != null && rRoster.Length >= 1)
                foreach (DataRow r in rRoster)
                {
                    r.BeginEdit();
                    r["fLateness"] = true;
                    r["nLateness"] = ACMS.Convert.ToInt32(r["nLateness"]) + ACMS.Convert.ToInt32(rLateness["nLateness"]);
                    r["dtLateness"] = DateTime.Today.AddMinutes(ACMS.Convert.ToInt32(r["nLateness"]));
                    r.EndEdit();
                }
            }
            return myRosterTable;
        }
コード例 #4
0
ファイル: frmStaff.cs プロジェクト: kimykunjun/test
        private void frmStaff_Load(object sender, System.EventArgs e)
        {
            barstaticCurrentLogin.Caption = string.Format(barstaticCurrentLogin.Caption, employee.StrEmployeeName, DateTime.Now.ToString("dd MMMM yyyy"));

            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
            connection = new SqlConnection(connectionString);

            myEmployeeInfo = Ultis.EmployeeInfo(employee.Id);
            myLeaveEmployeeInfo = myEmployeeInfo;

            TabStaff_init();

            int currentYear = DateTime.Now.Year;
            object[] years = new object[]{currentYear - 3, currentYear - 2, currentYear - 1, currentYear, currentYear + 1};
            cbServiceYear.Properties.Items.AddRange(years);
            cbServiceYear.EditValue = currentYear;
            cbServiceMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbSalesYear.Properties.Items.AddRange(years);
            cbSalesYear.EditValue = currentYear;
            cbSalesMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbTimesheetYear.Properties.Items.AddRange(years);
            cbTimesheetYear.EditValue = currentYear;
            cbTimesheetMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbAppointmentYear.Properties.Items.AddRange(years);
            cbAppointmentYear.EditValue = currentYear;
            cbAppointmentMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbOvertimeYear.Properties.Items.AddRange(years);
            cbOvertimeYear.EditValue = currentYear;
            cbOvertimeMonth.SelectedIndex = DateTime.Now.Month - 1;
            cbLatenessYear.Properties.Items.AddRange(years);
            cbLatenessYear.EditValue = currentYear;
            cbLatenessMonth.SelectedIndex = DateTime.Now.Month - 1;

            mySpaCommission = new CommissionSpaService();
            myPTCommission = new CommissionPTService();
            mySalesCommission = new SalesCommission();
            myCV = new ACMSLogic.Staff.CV();
            myMemo = new ACMSLogic.Staff.Memo();
            myReceipientGroup = new ACMSLogic.Staff.ReceipientGroup();
            myAppointment = new Appointment();
            myContacts = new Contacts();
            myTimesheet = new Timesheet();
            myLateness = new Lateness();
            myLeave = new Leave();

            timer1.Enabled = true;

            luedtSalesBranchCode.EditValue = terminalUser.Branch.Id;
            luedtCommissionServiceBranch.EditValue = terminalUser.Branch.Id;

            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtSalesBranchCode.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.BranchCodeLookupEditBuilder2(luedtCommissionServiceBranch.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtLeaveEmployeeID.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtMemoEmployeeID.Properties);
            new ACMS.XtraUtils.LookupEditBuilder.DepartmentLookupEditBuilder2(luedtCVAssignTo.Properties);

            //			employee.RightsLevel.Id = 103;
            if (employee.HasRight("AS_VIEW_ALL_CV"))
            {
                new ACMS.XtraUtils.LookupEditBuilder.EmployeeIDLookupEditBuilder(luedtCVSubmitter.Properties);
                //Add not filter row for Submiter
                DataTable tempTable = luedtCVSubmitter.Properties.DataSource as DataTable;
                DataRow tempRow = tempTable.NewRow();
                tempRow.BeginEdit();
                tempRow["nEmployeeID"] = DBNull.Value;
                tempRow["strEmployeeName"] = "<<No Filter>>";
                tempRow.EndEdit();
                tempTable.Rows.Add(tempRow);
                tempTable.AcceptChanges();
                luedtCVSubmitter.Visible = true;
                lblCVSubmitter.Visible = true;
            }
            else
            {
                luedtCVSubmitter.Visible = false;
                lblCVSubmitter.Visible = false;
            }
            //Add not filter row for AssignTo
            DataTable tempTable2 = luedtCVAssignTo.Properties.DataSource as DataTable;
            DataRow tempRow2 = tempTable2.NewRow();
            tempRow2.BeginEdit();
            tempRow2["nDepartmentID"] = DBNull.Value;
            tempRow2["strDescription"] = "<<No Filter>>";
            tempRow2.EndEdit();
            tempTable2.Rows.Add(tempRow2);
            tempTable2.AcceptChanges();

            startLeaveDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            luedtLeaveEmployeeID.EditValue = employee.Id;

            //			employee.RightsLevel.Id = 105;
            if (!employee.HasRight("AS_LEAVE_SUPER_RIGHT"))
            {
                lblLeaveEmployeeID.Visible = false;
                luedtLeaveEmployeeID.Visible = false;
            }

            isFinishedMemoInit = false;
            isFinishedCVInit = false;
            luedtMemoEmployeeID.EditValue = employee.Id;
            isFinishedMemoInit = true;

            //			employee.RightsLevel.Id = 106;
            if (!employee.HasRight("AS_MEMO_SUPER_RIGHT"))
            {
                lblMemoEmployeeID.Visible = false;
                luedtMemoEmployeeID.Visible = false;
            }
            ListMemo();
            ListReceipientGroup();
        }