Beispiel #1
0
        private void SetUnitPrice(HourType hourtype, int unitPrice)
        {
            switch (hourtype)
            {
            case HourType.EersteUur:
                UnitPrice = unitPrice;
                break;

            case HourType.TweedeUur:
                UnitPrice = HelperMethods.RoundtoFive(unitPrice * HoursInfo.secondHourPercentage);
                break;

            case HourType.OverUur:
                UnitPrice = HelperMethods.RoundtoFive(unitPrice * HoursInfo.restHourPercentage);
                break;

            case HourType.NachtUur:
                UnitPrice = HelperMethods.RoundtoFive(unitPrice * HoursInfo.nightHourPercentage);
                break;

            case HourType.VastePrijs:
                UnitPrice = unitPrice;
                break;
            }
        }
Beispiel #2
0
 public static HourTypeDTO HourTypeToDTO(HourType ht)
 {
     return(new HourTypeDTO()
     {
         Id = ht.Id, Name = ht.Name, ParentId = ht.ParentId
     });
 }
 public Timetable(Subject subject, string dayOfWeek, int startHour, int endHour, HourType typeHour, Room room)
 {
     subjectInstance = subject;
     day             = dayOfWeek;
     start           = startHour;
     end             = endHour;
     hour            = typeHour;
     roomInstance    = room;
 }
Beispiel #4
0
        private void llbNGTip_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left)
                {
                    NGTipForm form = new NGTipForm();
                    if (form.ShowDialog(this, this.NGTable, _remainHours, this.TodayIsHoliday) == DialogResult.OK)
                    {
                        DatabaseSet.工時Row row = form.DataRow;

                        string replace = row["取代編號"].ToString();

                        if (_dataTable.Select("取代編號 = '" + replace + "'").Length > 0)
                        {
                            throw new SWLHMSException("此筆重驗資料已存在");
                        }

                        DatabaseSet.工時Row newRow = _dataTable.New工時Row();

                        //MessageBox.Show("工時資料編號 " + form.SelectedHourDataID);

                        // Check the borrow line
                        string borrower = null;
                        if (ckbBorrowLine.Checked)
                        {
                            if (cbbBorrowLine.SelectedIndex == -1)
                            {
                                throw new SWLHMSException("請選擇借入產線");
                            }

                            borrower = (string)this.cbbBorrowLine.SelectedItem;
                        }

                        // hour type
                        HourType hourType = (HourType)cbxHourType.SelectedIndex;

                        newRow["品號"]   = row["品號"];
                        newRow["取代編號"] = row["取代編號"];
                        newRow.FillRow(this.SelectedLaborNumber, dtpDate.Value, row["工作單號"].ToString(), (decimal)row["工時"], (int)row["待驗數量"], borrower, row["QCN"].ToString(), (int)row["工品編號"], hourType);
                        newRow.新舊        = "*";
                        newRow["工時類型名稱"] = hourType.ToString();
                        _dataTable.Rows.Add(newRow);

                        dgvHoursData.AutoResizeColumns();
                        UpdateRemainHour();
                        UpdateRemainAmount();
                    }
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
        }
Beispiel #5
0
        public float GetTotalHours(HourType type)
        {
            float RunningTotal = 0;

            for (int x = 0; x < 14; x++)
            {
                RunningTotal += _days[x].GetHours(type);
            }

            return RunningTotal;
        }
        public void TestHourType()
        {
            string type      = "Eerste uur";
            int    nrOfHours = 1;
            int    price     = 300;

            HourType hourType = new HourType("Eerste uur", 1, 300);

            hourType.Type.Should().BeEquivalentTo(type);
            hourType.NrOfHours.Should().Be(nrOfHours);
            hourType.TotalPrice.Should().Be(price);
        }
Beispiel #7
0
        public float GetHours(DateTime date, HourType type)
        {
            DateTime TempDate = TrimDay(date);

            for (int x = 0; x < 14; x++)
            {
                if (TempDate.Equals(_days[x].GetDate()))
                {
                    return _days[x].GetHours(type);
                }
                TempDate.AddDays(1);
            }
            throw new ArgumentOutOfRangeException("date", "The provided date was not found within the TimeCard");
        }
Beispiel #8
0
        /// <summary>
        /// ShowMessage
        /// </summary>
        /// <returns></returns>
        public async Task <DateTimeOffset> ShowTimeDialog(string title, HourType type = HourType.TwelveHour)
        {
            var tcs        = new TaskCompletionSource <DateTimeOffset>();
            var timeDialog = new TimePickerDialog(CrossCurrentActivity.Current.Activity, Resource.Style.AppCompatDialogStyle,
                                                  (sender, args) =>
            {
                if (args == null)
                {
                    tcs.TrySetResult(DateTime.Now);
                    return;
                }

                var time = DateTime.Today.Add(new TimeSpan(args.HourOfDay, args.Minute, 0));
                tcs.TrySetResult(time);
            }, DateTime.Now.Hour, DateTime.Now.Minute, type == HourType.TwentyFourHour);

            timeDialog.SetTitle(title);
            timeDialog.SetCancelable(true);
            timeDialog.Show();
            return(await tcs.Task);
        }
Beispiel #9
0
        /// <summary>
        /// Диалоговое окно с выбором времени
        /// </summary>
        /// <returns></returns>
        public async Task <DateTimeOffset> ShowTimeDialog(string title, HourType type)
        {
            var tcs         = new TaskCompletionSource <DateTimeOffset>();
            var window      = UIApplication.SharedApplication.KeyWindow;
            var vc          = window.RootViewController;
            var alertDialog = UIAlertController.Create(title, "\n\n\n\n\n\n\n\n\n", UIAlertControllerStyle.Alert);
            var pickerFrame = new CGRect(5, 45, 255, 150);
            var picker      = new UIDatePicker(pickerFrame)
            {
                Mode = UIDatePickerMode.Time
            };

            alertDialog.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, button =>
            {
                tcs.TrySetResult(DateTimeOffset.Parse(NsDateToDateTime(picker.Date).ToString("hh:mm tt", CultureInfo.InvariantCulture)));
            }));
            alertDialog.Add(picker);
            vc.PresentViewController(alertDialog, true, null);

            return(await tcs.Task);
        }
        protected override void BeforeExport()
        {
            LoadNP();

            LineLaborHourReportSourceTableAdapter adapter = new LineLaborHourReportSourceTableAdapter();

            //取得基本報表資料
            ReportDataSet.LineLaborHourReportSourceDataTable srcTable = adapter.GetData(_startDate, _endDate);

            //建立報表_table
            CreateReportTable();

            ////取得指定日期範圍內的工作單號
            //OleDbCommand cmd = new OleDbCommand();
            //cmd.CommandText = "SELECT DISTINCT(單號) FROM 工作單 WHERE 單據日期 > #" + _startDate.ToString("yyyy/MM/dd") + "# AND 單據日期 < #" + _endDate.ToString("yyyy/MM/dd") + "#";
            //cmd.Connection = adapter.Connection;

            //DataTable wsNumTable = new DataTable();
            //wsNumTable.Columns.Add(new DataColumn("單號", typeof(string)));

            //OleDbDataAdapter wsNumAdapter = new OleDbDataAdapter();
            //wsNumAdapter.SelectCommand = cmd;
            //wsNumAdapter.Fill(wsNumTable);

            //List<string> wsNumList = new List<string>();
            //foreach (DataRow row in wsNumTable.Rows)
            //    wsNumList.Add(row["單號"].ToString());

            //讀取非生產資料


            //建立分組table(產線,員工)
            DataTable groupTable = DataTableHelper.SelectDistinct(srcTable, "產線", "借入產線", "員工姓名");

            /* 1.08.4
             * //取得LaborWage資料
             * LaborWageHelper lwHelper = new LaborWageHelper();
             * //LaborWage員工工時Table lwTable = lwHelper.GetDataGroupByLabor(wsNumList);
             * LaborWage員工工時Table lwTable = lwHelper.GetDataGroupByDate(_startDate, _endDate);
             *
             * //Union lw table
             * foreach (DataRow r in lwTable.Rows)
             * {
             * string name = r["員工姓名"].ToString();
             *
             * DataRow[] rs = groupTable.Select("借入產線 IS NULL AND 員工姓名 = '" + name + "'");
             * if (rs.Length == 0)
             * {
             * DataRow[] laborRow = DatabaseSet.員工Table.Select("姓名 ='" + name + "'");
             * if (laborRow.Length != 0)
             * {
             * DataRow nr = groupTable.NewRow();
             * nr["產線"] = laborRow[0]["產線"];
             * nr["員工姓名"] = name;
             * groupTable.Rows.Add(nr);
             * }
             * }
             * }
             */

            //Re order
            groupTable.DefaultView.Sort = "產線, 借入產線, 員工姓名";
            groupTable = groupTable.DefaultView.ToTable();

            //對每個分組進行數據填入
            foreach (DataRow groupRow in groupTable.Rows)
            {
                string selFilter = "產線='" + groupRow["產線"] + "' AND 員工姓名 = '" + groupRow["員工姓名"] + "'";

                DataRow newRow = _table.NewRow();

                if (groupRow.IsNull("借入產線"))
                {
                    newRow["產線"] = groupRow["產線"];
                    selFilter   += " AND 借入產線 IS NULL ";
                }
                else
                {
                    newRow["產線"] = groupRow["借入產線"];
                    newRow["借入"] = groupRow["產線"];
                    selFilter   += " AND 借入產線 = '" + groupRow["借入產線"] + "'";
                }

                DataRow[] rows = srcTable.Select(selFilter);

                newRow["員工名稱"] = groupRow["員工姓名"].ToString();

                decimal npHour = 0;
                Dictionary <HourType, decimal> pHours = new Dictionary <HourType, decimal>();
                foreach (HourType hourType in Enum.GetValues(typeof(HourType)))
                {
                    pHours.Add(hourType, 0);
                }

                //對屬於該分組的Row進行填入
                foreach (DataRow srcRow in rows)
                {
                    int     np   = (int)srcRow["非生產編號"];
                    decimal hour = (decimal)srcRow["工時"];

                    //為生產工時
                    if (np == -1)
                    {
                        HourType hourType = (HourType)srcRow["工時類型"];

                        pHours[hourType] += hour;
                    }
                    else
                    {
                        //非生產工時
                        if (NpDic.ContainsKey(np))
                        {
                            if (NpDic[np] != "np請假")
                            {
                                npHour += hour;
                            }

                            newRow[NpDic[np]] = (decimal)newRow[NpDic[np]] + hour;
                        }
                    }
                }
                decimal ttlHour = npHour;
                foreach (decimal val in pHours.Values)
                {
                    ttlHour += val;
                }

                newRow["生產工時"] = pHours[HourType.一般工時];
                foreach (HourType hourType in Enum.GetValues(typeof(HourType)))
                {
                    if (hourType != HourType.一般工時)
                    {
                        newRow[hourType.ToString()] = pHours[hourType];
                    }
                }

                /* 1.08.4
                 * DataRow[] lwRows = lwTable.Select("員工姓名 = '" + groupRow["員工姓名"].ToString() + "'");
                 * if (lwRows.Length > 0)
                 * newRow["外包工時"] = (decimal)lwRows[0]["工時"];
                 */

                _table.Rows.Add(newRow);
            }

            base.BeforeExport();
        }
Beispiel #11
0
 public OffSetInfo( int minutesOffset )
 {
     this.MinutesOffset = minutesOffset;
     this.HourType = HourType.NotApplicable;
 }
Beispiel #12
0
 public OffSetInfo( int minutesOffset, HourType hourType )
 {
     this.MinutesOffset = minutesOffset;
     this.HourType = hourType;
 }
Beispiel #13
0
 public Hour(HourType hourType, int period, int unitPrice)
 {
     HourType = hourType;
     Period   = period;
     SetUnitPrice(HourType, unitPrice);
 }
Beispiel #14
0
        public void SetHours(DateTime date, HourType type, float hours)
        {
            Boolean SomethingSet = false;
            DateTime TempDate = TrimDay(date);

            for (int x = 0; x < 14; x++)
            {
                if (TempDate.Equals(_days[x].GetDate()))
                {
                    _days[x].SetHours(type, hours);
                    SomethingSet = true;
                }
                TempDate.AddDays(1);
            }
            if (!SomethingSet)
            {
                throw new ArgumentOutOfRangeException("date", "The provided date was not found within the TimeCard");
            }
        }
Beispiel #15
0
 public static OffSetInfo FromHours( int hours, HourType hourType )
 {
     return new OffSetInfo( hours * 60, hourType );
 }
Beispiel #16
0
 public Course(string name, HourType hour)
 {
     Name     = name;
     HourType = hour;
 }
Beispiel #17
0
        private void btnAddList_Click(object sender, EventArgs e)
        {
            try
            {
                decimal hour = decimal.Parse(tbxHour.Text);
                if (_remainHours >= hour || ckbOvertime.Checked || this.TodayIsHoliday)
                {
                    DatabaseSet.工時Row newRow = _dataTable.New工時Row();

                    if (rbProduce.Checked)
                    {
                        //if (dgvPart.CurrentRow != null)
                        if (cbbPart.SelectedIndex != -1)
                        {
                            //string worksheetNumber = dgvPart.CurrentRow.Cells["col單號"].Value.ToString();
                            //string partNumber = dgvPart.CurrentRow.Cells["col品號"].Value.ToString();

                            DataRowView selectedRow     = (DataRowView)cbbPart.SelectedItem;
                            string      worksheetNumber = selectedRow["單號"].ToString();
                            string      partNumber      = selectedRow["品號"].ToString();
                            int         wpID            = (int)selectedRow["編號"];

                            // Check whether finish date is set
                            if (selectedRow["實際完成日"] != DBNull.Value && dtpDate.Value >= (DateTime)selectedRow["實際完成日"])
                            {
                                throw new SWLHMSException("填寫時間 " + dtpDate.Value.ToString("yyyy/MM/dd") + " 已在品號 '" + partNumber + "' 完成日之後");
                            }

                            string borrower = null;

                            // Check the borrow line
                            if (ckbBorrowLine.Checked)
                            {
                                if (cbbBorrowLine.SelectedIndex == -1)
                                {
                                    throw new SWLHMSException("請選擇借入產線");
                                }

                                borrower = (string)this.cbbBorrowLine.SelectedItem;
                            }

                            // Check the number of done
                            if (txtNum.Text.Trim() == string.Empty)
                            {
                                throw new SWLHMSException("未輸入完成數量");
                            }
                            int num = int.Parse(txtNum.Text);


                            /* Only for 1.08.15 below
                             *
                             * // Check whether part number is duplicated
                             * string checkExpr = "工品編號 = '" + wpID + "' AND 工作單號 ='" + worksheetNumber + "'";
                             * if(borrower != null)
                             *      checkExpr += " AND 借入產線 = '" + borrower + "'";
                             * else
                             *      checkExpr += " AND 借入產線 IS NULL ";
                             * if ((int)_dataTable.Compute("Count(品號)", checkExpr) > 0)
                             *      throw new SWLHMSException("品號 '" + partNumber + "' 已存在");
                             */

                            // Check the remain amount
                            if (_remainAmount < num)
                            {
                                throw new SWLHMSException("輸入數量超過剩餘數量");
                            }

                            // hour type
                            HourType hourType = (HourType)cbxHourType.SelectedIndex;

                            string QCN = txtQCN.Text;

                            newRow.FillRow(this.SelectedLaborNumber, dtpDate.Value, worksheetNumber, hour, num, borrower, QCN, wpID, hourType);
                            newRow.新舊        = "*";
                            newRow["品號"]     = partNumber;
                            newRow["工時類型名稱"] = hourType.ToString();

                            _dataTable.Rows.Add(newRow);

                            //if (ckbFinishDate.Checked)
                            //{
                            //    DateTime date = dateFinishDate.Value;
                            //    _finishDateList.Add(newRow, date);
                            //}

                            txtNum.Text = "0";
                            txtQCN.Text = null;
                        }
                    }
                    else
                    {
                        if (cbbNonProduce.SelectedIndex != -1)
                        {
                            if ((int)cbbNonProduce.SelectedValue == Global.NonProduct_Other && tbxRemark.Text == string.Empty)
                            {
                                throw new SWLHMSException("非生產項目為 其他 時,備註欄不得為空");
                            }

                            string borrower = null;
                            // Check the borrow line
                            if (ckbBorrowLine.Checked)
                            {
                                if (cbbBorrowLine.SelectedIndex == -1)
                                {
                                    throw new SWLHMSException("請選擇借入產線");
                                }

                                borrower = (string)this.cbbBorrowLine.SelectedItem;
                            }

                            newRow.FillRow(cbxLaborNumber.SelectedValue.ToString(), dtpDate.Value, hour, (int)cbbNonProduce.SelectedValue, cbbNonProduce.Text, tbxRemark.Text, borrower);
                            newRow.新舊        = "*";
                            newRow["工時類型名稱"] = HourType.一般工時.ToString();
                            _dataTable.Rows.Add(newRow);
                        }
                    }

                    dgvHoursData.AutoResizeColumns();
                    UpdateRemainHour();
                    UpdateRemainAmount();
                }
                else
                {
                    throw new SWLHMSException("填寫時數超過剩餘時數");
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
        }
Beispiel #18
0
            public void FillRow(string 員工編號, DateTime 日期, string 工作單號, decimal 工時, int 數量, string 借入產線, string QCN, int 工品編號, HourType 工時類型)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                if (員工編號 == null || 員工編號.Trim() == string.Empty)
                    sb.AppendLine("員工編號不得為空值");

                if (工作單號 == null || 工作單號.Trim() == string.Empty)
                    sb.AppendLine("工作單號不得為空值");

                //if (品號 == null || 品號.Trim() == string.Empty)
                //    sb.AppendLine("品號不得為空值");

                if (QCN == null || QCN.Trim() == string.Empty && 數量 > 0)
                    sb.AppendLine("QC#不得為空值");

                if (工時 < 0)
                    sb.AppendLine("工時必須為一個正整數");

                // For 1.03
                if (數量 < 0)
                    sb.AppendLine("數量必須為一個正整數");

                if (sb.Length > 0)
                    throw new SWLHMSException(sb.ToString());

                this.編號 = Global.GenerateUniqueNumber();
                this.員工編號 = 員工編號;
                this.日期 = 日期;
                this.工作單號 = 工作單號;
                //this.品號 = 品號;
                this.工時 = 工時;
                this.非生產編號 = -1;
                if (this.Table.Columns.IndexOf("待驗數量") != -1)
                    this["待驗數量"] = 數量;
                else
                    this.數量 = 數量;
                this.借入產線 = 借入產線;
                this.QCN = QCN;
                this.工品編號 = 工品編號;
                this.工時類型 = (int)工時類型;

                this["備註"] = DBNull.Value;
            }