예제 #1
0
        private void checkedListBoxEmployee_DoubleClick(object sender, EventArgs e)
        {
            listBoxHelp.Visible = false;
            int            mon       = Row.TableMonth;
            int            dayCount  = MyFunction.DayCountOfMonth(mon);
            DayOfWeek      dayOfWeek = (new DateTime(MyFunction.IntHeaderYear, mon, 1)).DayOfWeek;
            CheckedListBox box       = sender as CheckedListBox;

            if (checkedListBoxEmployee.SelectedItem == null)
            {
                return;
            }

            tempHR temp  = checkedListBoxEmployee.SelectedItem as tempHR;
            Panel  panel = CreatePanel(temp, dayOfWeek, dayCount);

            panel.BorderStyle = BorderStyle.Fixed3D;
            temp.Pan          = panel;
            panel.Tag         = temp;
            m_HRList.Add(temp);
            int i = m_HRList.IndexOf(temp);

            panel.Location = new Point(3, i * 80 + 3);
            panelBase.Controls.Add(panel);

            checkedListBoxEmployee.Items.Remove(temp);
        }
예제 #2
0
        private void comboBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box = sender as ComboBox;
            int      i   = box.SelectedIndex;

            if (i > 0 && i <= 12)
            {
                int count = MyFunction.DayCountOfMonth(i);
                foreach (DataGridViewColumn co in dgvShift.Columns)
                {
                    string name = co.Name;
                    if (name.Substring(0, 3).Equals(strDay))
                    {
                        int d = 0;
                        try
                        {
                            d = Convert.ToInt32(name.Substring(3, 2));
                            if (d <= count)
                            {
                                co.Visible = true;
                            }
                            else
                            {
                                co.Visible = false;
                            }
                        }
                        catch { }
                    }
                }
            }
        }
예제 #3
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            if (MyFunction.LockAll)
            {
                MessageBox.Show("鎖定中,新增無用");
            }
            int m = MyFunction.MaxNoInDB("ID", m_DataSet.Expense);

            MyFunction.SetCellMaxNo("columnID", expenseDataGridView, m);
            int month = comboBoxMonth.SelectedIndex;
            int mon;

            if (month >= 1 && month <= 12)
            {
                mon = month;
            }
            else
            {
                mon = DateTime.Now.Month;
            }
            DateTime        t   = new DateTime(MyFunction.IntHeaderYear, mon, MyFunction.DayCountOfMonth(mon));
            DataGridViewRow row = expenseDataGridView.CurrentRow;

            // DataGridView和textBox都設定, 以免日期是空白,日期排序,會跑到最前面
            row.Cells["applyTime"].Value = applyTimeTextBox.Text = t.ToShortDateString();

            MessageBox.Show("申請日期己暫時設定, 請設成正確日期!");
            if (this.cbSelectBank.SelectedIndex > 0)
            {
                bankAccountIDComboBox.SelectedValue = cbSelectBank.SelectedIndex;
            }
            lockedCheckBox.Checked = false;
        }
예제 #4
0
        private void comboBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box   = (ComboBox)sender;
            int      month = box.SelectedIndex;

            if (month == 0)
            {
                DayFilter = null;
            }
            else
            {
                if (month < 1 || month > 12)
                {
                    return;
                }
                string toStr = MyFunction.DayCountOfMonth(month).ToString("d2");
                string y = "#" + MyFunction.HeaderYear + "/";
                string m1, m2;
                m1        = y + month.ToString("d2") + "/01#";
                m2        = y + month.ToString("d2") + "/" + toStr + "#";
                DayFilter = "(Day>=" + m1 + ") AND (Day<=" + m2 + ")";
            }
            SetFilter(DayFilter, BankFilter);
            dgvBankDetail.Focus();
        }
예제 #5
0
//        OrderItemAdapter m_OrderItemAdapter = new OrderItemAdapter();



        void Calc()
        {
            int year  = Revenue.Year;
            int month = comboBoxMonth.SelectedIndex + 1;

            if (month < 1 || month > 12)
            {
                MessageBox.Show("所選月份不對!");
                return;
            }
            int count = MyFunction.DayCountOfMonth(month);

            progressBar1.Minimum = 0;
            progressBar1.Maximum = count;
            progressBar1.Value   = 0;
            progressBar1.Visible = true;
            List <MonthlyReportData> list = new List <MonthlyReportData>();

            for (int i = 1; i <= count; i++)
            {
                if (Revenue.LoadData(basicDataSet1, year, month, i, checkBoxUse12.Checked))
                {
                    list.Add(Revenue.Statics(basicDataSet1));
                }
                progressBar1.Value = i;
                Application.DoEvents();
            }
            dgViewMonthly.DataSource = list;
            progressBar1.Visible     = false;
            MonthlyReportData total = new MonthlyReportData();

            foreach (MonthlyReportData d in list)
            {
                total.Revenue       += d.Revenue;
                total.OrderCount    += d.OrderCount;
                total.Cash          += d.Cash;
                total.CreditCard    += d.CreditCard;
                total.CreditFee     += d.CreditFee;
                total.CreditNet     += d.CreditNet;
                total.TwentyPDCount += d.TwentyPDCount;
                total.TwentyPDMoney += d.TwentyPDMoney;
            }
            labelCash.Text       = total.Cash.ToString();
            labelCredit.Text     = total.CreditCard.ToString();
            labelOrderCount.Text = total.OrderCount.ToString();
            labelRevenue.Text    = total.Revenue.ToString();
            labelCreditFee.Text  = total.CreditFee.ToString();
            labelCreditNet.Text  = total.CreditNet.ToString();
        }
예제 #6
0
        MonthlyReportData CalcRevenue(int month)
        {
            int year = Revenue.Year;

            if (month < 1 || month > 12)
            {
                MessageBox.Show("所選月份不對!");
                return(null);
            }
            Message("計算 " + month.ToString() + "月營業額");
            if (RevenueCache[month - 1] != null)
            {
                return(RevenueCache[month - 1]);
            }
            int count = MyFunction.DayCountOfMonth(month);

            progressBar1.Minimum = 0;
            progressBar1.Maximum = count;
            progressBar1.Value   = 0;
            progressBar1.Visible = true;
            List <MonthlyReportData> list = new List <MonthlyReportData>();

            for (int i = 1; i <= count; i++)
            {
                if (Revenue.LoadData(m_OrderSet, month, i))
                {
                    list.Add(Revenue.Statics(m_OrderSet));
                }
                progressBar1.Value = i;
                Application.DoEvents();
            }
            progressBar1.Visible = false;
            MonthlyReportData total = new MonthlyReportData();

            foreach (MonthlyReportData d in list)
            {
                total.Revenue    += d.Revenue;
                total.OrderCount += d.OrderCount;
                total.Cash       += d.Cash;
                total.CreditCard += d.CreditCard;
            }
            RevenueCache[month - 1] = total;       // 存到Cache裏
            return(total);
        }
예제 #7
0
        // RevenueCalc需要Header.Date 己經在FormLoad時給值
        MonthlyReportData CalcRevenue(int month, out List <MonthlyReportData> reportList)
        {
            int year = m_Revenue.Year;

            reportList = null;
            if (month < 1 || month > 12)
            {
                MessageBox.Show("所選月份不對!");
                return(null);
            }
            labelMessage.Text = "計算 " + month.ToString() + "月營業額";
            //if (RevenueCache[month - 1] != null)    // 不能用Cache了
            //    return RevenueCache[month - 1];
            int count = MyFunction.DayCountOfMonth(month);

            progressBar1.Minimum = 0;
            progressBar1.Maximum = count;
            progressBar1.Value   = 0;
            progressBar1.Visible = true;
            List <MonthlyReportData> list = new List <MonthlyReportData>();

            for (int i = 1; i <= count; i++)
            {
                if (m_Revenue.LoadData(damaiDataSet, month, i))
                {
                    list.Add(m_Revenue.Statics(damaiDataSet));
                }
                progressBar1.Value = i;
                Application.DoEvents();
            }
            progressBar1.Visible = false;
            MonthlyReportData total = new MonthlyReportData();

            foreach (MonthlyReportData d in list)
            {
                total.Revenue    += d.Revenue;
                total.OrderCount += d.OrderCount;
                total.Cash       += d.Cash;
                total.CreditCard += d.CreditCard;
                total.Alipay     += d.Alipay;
            }
            reportList = list;
            return(total);
        }
예제 #8
0
        private void comboBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box = (ComboBox)sender;

            int month = box.SelectedIndex;

            if (month == 0)
            {
                this.accVoucherBindingSource.Filter = null;
                this.accVoucherDataGridView.Focus();
                return;
            }
            if (month < 1 || month > 12)
            {
                return;
            }
            SetDayFilter(month, 1, MyFunction.DayCountOfMonth(month));
            this.accVoucherDataGridView.Focus();
        }
예제 #9
0
        private void cbBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box   = (ComboBox)sender;
            int      month = box.SelectedIndex;

            if (month < 0 || month >= 12)
            {
                return;
            }

            int count = MyFunction.DayCountOfMonth(month + 1);

            cbBoxDay.Items.Clear();
            int result;

            for (int i = 1; i <= count; i++)
            {
                result = cbBoxDay.Items.Add(i.ToString() + "日");
            }
            cbBoxDay.SelectedIndex = 0;
        }
예제 #10
0
        private bool addNew(int month, int productClass)
        {
            int ma = MyFunction.MaxNoInDB("ID", damaiDataSet.Shipment);
            int i  = MyFunction.SetCellMaxNo("ColumnID", shipmentDataGridView, ma);

            if (i > 0)
            {
                this.iDLabel1.Text = i.ToString();

                //removedCheckBox.Checked = false;                           // 只有對DateTime的Binding會受影響, bool不會,所以可以放ResetBindings前
                //checkedCheckBox.Checked = false;
                // 這行加了會把stockTimeTextBox.Text和entryTimeTextBox.Text給清成空白,所以放前面
                if (CreateNewShipmentDetailDataTable(i, productClass).Count == 0)
                {
                    return(false);
                }
                foreach (var item in CreateNewShipmentDetailDataTable(i, productClass))
                {
                    DamaiDataSet.ShipmentDetailRow r;
                    r = item;
                    this.damaiDataSet.ShipmentDetail.ImportRow(r);
                }
                this.shipmentBindingSource.ResetBindings(false);
                this.shipmentDetailBindingSource.ResetBindings(false);   // 有id了,可以刷新下面的detail表
                removedCheckBox.Checked   = false;
                checkedCheckBox.Checked   = false;
                this.shipCodeTextBox.Text = GetShipCode(month);
                // 初始時間, 放在ResetBindings後面
                int      year = MyFunction.IntHeaderYear;
                DateTime t    = DateTime.Now;
                disableDateTimePicker      = true;
                this.dateTimePicker1.Value = new DateTime(year, month, 1);     // 代入的是資料庫的年份,選的月份
                disableDateTimePicker      = false;
                // 有選月份時,先強設日期,否則在當月看不到
                DateTime stockTime = new DateTime(year, month, MyFunction.DayCountOfMonth(month));   // 資料月份,設成該月最後一天
                shipTimeTextBox.Text = stockTime.ToShortDateString();
                return(true);
            }
            return(false);
        }
예제 #11
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            if (MyFunction.LockAll)
            {
                MessageBox.Show("鎖定中,新增無用");
            }
            int m = MyFunction.MaxNoInDB("ID", m_DataSet.AccVoucher);

            MyFunction.SetCellMaxNo("columnID", accVoucherDataGridView, m);
            int month = comboBoxMonth.SelectedIndex;
            int mon;

            if (month >= 1 && month <= 12)
            {
                mon = month;
            }
            else
            {
                mon = DateTime.Now.Month;
            }
            DateTime        t   = new DateTime(DateTime.Now.Year, mon, MyFunction.DayCountOfMonth(mon));
            DataGridViewRow row = accVoucherDataGridView.CurrentRow;

            // DataGridView和textBox都設定, 以免日期是空白,日期排序,會跑到最前面
            row.Cells["columnAccVoucherTime"].Value = accVoucherTimeTextBox.Text = t.ToShortDateString();
            try
            {
                DataRowView rv = row.DataBoundItem as DataRowView;
                var         d  = (MyAccVoucherRow)rv.Row;
                d.IsDebt0 = true;
                d.IsDebt1 = d.IsDebt2 = d.IsDebt3 = false;
                SetAllDebtCreditBtn(d);
                CalcTotal(d);
            }
            catch { }


            MessageBox.Show("日期己暫時設定, 請設成正確日期!");
            lockedCheckBox.Checked = false;
        }
예제 #12
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            if (MyFunction.LockAll)
            {
                MessageBox.Show("鎖定中,新增無用");
            }
            int month = comboBoxMonth.SelectedIndex;

            if (month < 1 || month > 12)
            {
                month = DateTime.Now.Month;
                MessageBox.Show("你未選擇月份, 電腦設定新增為<" + month.ToString() + "月>單子!");
            }

//            int count=this.voucherBindingNavigator.PositionItem.
            int ma = MyFunction.MaxNoInDB("ID", m_DataSet.Voucher);
            int i  = MyFunction.SetCellMaxNo("columnID", dgvVoucher, ma);

            if (i > 0)
            {
                this.iDTextBox.Text = i.ToString();
                this.voucherBindingSource.ResetBindings(false);                 // 這行加了會把stockTimeTextBox.Text和entryTimeTextBox.Text給清成空白,所以放前面
                this.voucherVoucherDetailSqlBindingSource.ResetBindings(false); // 有id了,可以刷新下面的detail表

                lockedCheckBox.Checked = false;                                 // 只有對DateTime的Binding會受影響, bool不會,所以可以放ResetBindings前
                // 初始時間, 放在ResetBindings後面
                int      year = MyFunction.IntHeaderYear;
                DateTime t    = DateTime.Now;
                entryTimeTextBox.Text      = t.ToString();
                disableDateTimePicker      = true;
                this.dateTimePicker1.Value = new DateTime(year, month, 1);     // 代入的是資料庫的年份,選的月份
                disableDateTimePicker      = false;
                // 有選月份時,先強設日期,否則在當月看不到
                DateTime stockTime = new DateTime(year, month, MyFunction.DayCountOfMonth(month));   // 資料月份,設成該月最後一天
                stockTimeTextBox.Text = stockTime.ToShortDateString();
                MessageBox.Show("進貨日期己暫時設定, 請設成正確日期!");
            }
        }
예제 #13
0
        private void cbBoxMonthTo_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box   = (ComboBox)sender;
            int      month = box.SelectedIndex;

            if (month < 1 || month > 12)
            {
                return;
            }
            int count = MyFunction.DayCountOfMonth(month);

            cbBoxTo.Items.Clear();
            for (int i = 1; i <= count; i++)
            {
                cbBoxTo.Items.Add(i.ToString() + "日");
            }
            cbBoxTo.SelectedIndex = count - 1;
            if (month < cbBoxMonth.SelectedIndex)
            {
                cbBoxMonth.SelectedIndex = month;
            }
            btnPrint.Enabled = false;
        }
예제 #14
0
        private void comboBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box = (ComboBox)sender;

            int month = box.SelectedIndex;

            if (month == 0)
            {
                DayFilter             = null;
                m_DisableIndexChanged = true;
                SetFilter(DayFilter, BankFilter);
                CalcTotal();
                this.expenseDataGridView.Focus();
                return;
            }
            if (month < 1 || month > 12)
            {
                return;
            }

            int count = MyFunction.DayCountOfMonth(month);

            cbBoxFrom.Items.Clear();
            cbBoxTo.Items.Clear();
            for (int i = 1; i <= count; i++)
            {
                cbBoxFrom.Items.Add(i.ToString() + "日");
                cbBoxTo.Items.Add(i.ToString() + "日");
            }
            m_DisableIndexChanged   = true;
            cbBoxFrom.SelectedIndex = 0;
            cbBoxTo.SelectedIndex   = count - 1;
            m_DisableIndexChanged   = false;
            SetDayFilter(month, 1, count);
            SetAccTitleFilter();
            this.expenseDataGridView.Focus();
        }
예제 #15
0
        //List<CNameIDForComboBox> GetApartmentList()
        //{
        //    List<CNameIDForComboBox> list = new List<CNameIDForComboBox>();
        //    if (m_DataSet.Apartment.Rows.Count > 1)               // 多於一個才有全部這個選項
        //    {
        //        list.Add(new CNameIDForComboBox(0, " "));
        //        comboBoxApartment.Enabled = true;
        //    }
        //    else
        //        comboBoxApartment.Enabled = false;
        //    foreach (var row in m_DataSet.Apartment)
        //    {
        //        if (row.IsApartmentNameNull()) continue;
        //        list.Add(new CNameIDForComboBox(row.ApartmentID, row.ApartmentName));
        //    }
        //    return list;
        //}

        private void dgvOnDutyEmployee_SelectionChanged(object sender, EventArgs e)
        {
            DataGridView view = sender as DataGridView;
            MyHRRow      hRRow;

            try
            {
                DataRowView rv = view.CurrentRow.DataBoundItem as DataRowView;
                hRRow = rv.Row as MyHRRow;
            }
            catch
            {
                return;
            }
            if (hRRow == null)
            {
                return;
            }
            if (hRRow.IsFingerPintNoNull())
            {
                return;
            }
            if (hRRow.IsEmployeeNameNull())
            {
                return;
            }
//            if (hRRow.IsFingerprintmachineNull()) return;

            labelName.Text = hRRow.EmployeeName;
            int dutyCode = hRRow.FingerPintNo;
            int month    = comboBoxMonth.SelectedIndex + 1;
            int count    = MyFunction.DayCountOfMonth(month);

            string[] str = new string[count];
            for (int i = 0; i < count; i++)
            {
                str[i] = (i + 1).ToString("d2") + "日";
            }

            int d, h;

            EnumerableRowCollection <DamaiDataSet.OnDutyDataRow> rows;

            if (hRRow.IsFingerprintmachineNull())
            {
                rows = from r in m_DataSet.OnDutyData
                       where (r.OnDutyCode == hRRow.FingerPintNo)
                       select r;
            }
            else
            {
                rows = from r in m_DataSet.OnDutyData
                       where (r.Fingerprintmachine == hRRow.Fingerprintmachine) && (r.OnDutyCode == hRRow.FingerPintNo)
                       select r;
            }
            foreach (var row in rows)
            {
                try
                {
                    DateTime t = row.TimeMark;
                    if (t.Month == month)
                    {
                        d = t.Day - 1;
                        h = t.Hour;
                        if (h < 4)
                        {
                            d--;
                        }
                        if (d < 0)
                        {
                            continue;
                        }
                    }
                    else if (t.Month == (month + 1))    // 下個月4點前的算到上個月去
                    {
                        d = t.Day - 1;
                        if (d != 0)
                        {
                            continue;
                        }
                        h = t.Hour;
                        if (h < 4)
                        {
                            continue;
                        }
                        d = count - 1;
                    }
                    else
                    {
                        continue;
                    }
                    str[d] += " " + h.ToString("d2") + ":" + t.Minute.ToString("d2") + " ";
                }
                catch { }
            }
            checkedListBox1.Items.Clear();
            foreach (string s in str)
            {
                checkedListBox1.Items.Add(s);
            }
        }
예제 #16
0
        private decimal CalcSaleList(int month)
        {
            if (month < 1 || month > 12)
            {
                MessageBox.Show("所選月份<" + month.ToString() + ">不對!");
                return(0);
            }
            int count = m_SaleList.Count;

            if (count <= 1)
            {
                return(0);
            }
            int year = MyFunction.IntHeaderYear;
            int to   = MyFunction.DayCountOfMonth(month);

            if (month == 2 && DateTime.IsLeapYear(year))
            {
                to = 29;
            }
            LoadData(month, 1, to);    // 一律稅控制
            foreach (CSaleItem m in m_SaleList)
            {
                m.Total  = 0;
                m.Volume = 0;
            }
            bool[] debug = new bool[count];   // items code會重複, 不知為何 ,只好用此辦法
            foreach (var row in m_OrderSet.Order)
            {
                var items = row.GetOrderItemRows();
                for (int i = 0; i < count; i++)
                {
                    debug[i] = false;
                }
                foreach (var it in items)
                {
                    for (int i = 0; i < m_SaleList.Count; i++)
                    {
                        CSaleItem m = m_SaleList[i];
                        if (m.ProductID == it.ProductID)
                        {
                            if (debug[i])
                            {
                                break;                  // 重複算了二次, items存入有bug,只好先跳掉
                            }
                            debug[i]  = true;
                            m.Volume += it.No;
                            if (it.Discount)
                            {
                                m.Total += it.Price * it.No * 0.88m;
                            }
                            else
                            {
                                m.Total += it.Price * it.No;
                            }
                            break;
                        }
                    }
                }
            }
            decimal sum = 0;

            foreach (CSaleItem item in m_SaleList)
            {
                sum += item.Total;
            }
            return(sum);

            //            materialBindingSource.ResetBindings(false);
            //            Text = "物料統計 " + month.ToString() + "月 " + from.ToString() + "日 至 " + to.ToString() + "日";
            //            if (ckBoxUse12.Checked) Text += "  稅控制";
        }
예제 #17
0
        void Calc()
        {
            int year  = Revenue.Year;
            int month = comboBoxMonth.SelectedIndex + 1;

            if (month < 1 || month > 12)
            {
                MessageBox.Show("所選月份不對!");
                return;
            }
            comboBoxMonth.Enabled = false;  // 為避免計算時間過長,使用者重複選取. Reentrant會出錯
//            Application.DoEvents();
            int count = MyFunction.DayCountOfMonth(month);

            progressBar1.Minimum = 0;
            progressBar1.Maximum = count;
            progressBar1.Value   = 0;
            progressBar1.Visible = true;
            List <MonthlyReportData> list = new List <MonthlyReportData>();

            for (int i = 1; i <= count; i++)
            {
                if (Revenue.LoadData(m_DataSet, month, i))
                {
                    list.Add(Revenue.Statics(m_DataSet));
                }
                progressBar1.Value = i;
                Application.DoEvents();
            }
            dgViewMonthly.DataSource = list;
            progressBar1.Visible     = false;
            MonthlyReportData total = new MonthlyReportData();

            foreach (MonthlyReportData d in list)
            {
                total.Revenue        += d.Revenue;
                total.OrderCount     += d.OrderCount;
                total.Cash           += d.Cash;
                total.CreditCard     += d.CreditCard;
                total.CreditFee      += d.CreditFee;
                total.CreditNet      += d.CreditNet;
                total.Alipay         += d.Alipay;
                total.Wxpay          += d.Wxpay;
                total.CouponA        += d.CouponA;
                total.CouponB        += d.CouponB;
                total.DeletedCount   += d.DeletedCount;
                total.DeletedMoney   += d.DeletedMoney;
                total.TwentyPDCount  += d.TwentyPDCount;
                total.TwentyPDMoney  += d.TwentyPDMoney;
                total.FifteenPDCount += d.FifteenPDCount;
                total.FifteenPDMoney += d.FifteenPDMoney;
                total.TenPDCount     += d.TenPDCount;
                total.TenPDMoney     += d.TenPDMoney;
            }
            try
            {
                //if (total.Coupond == 0)
                //{
                //    dgViewMonthly.Columns["Coupond"].Visible = false;
                //}
                if (total.DeletedCount == 0)
                {
                    dgViewMonthly.Columns["DeletedCount"].Visible = false;
                    dgViewMonthly.Columns["DeletedMoney"].Visible = false;
                }
                if (total.TwentyPDCount == 0)
                {
                    dgViewMonthly.Columns["TwentyPDCount"].Visible = false;
                    dgViewMonthly.Columns["TwentyPDMoney"].Visible = false;
                }
                if (total.FifteenPDCount == 0)
                {
                    dgViewMonthly.Columns["FifteenPDCount"].Visible = false;
                    dgViewMonthly.Columns["FifteenPDMoney"].Visible = false;
                }
                if (total.TenPDCount == 0)
                {
                    dgViewMonthly.Columns["TenPDCount"].Visible = false;
                    dgViewMonthly.Columns["TenPDMoney"].Visible = false;
                }
            }
            catch { }
            labelCash.Text        = total.Cash.ToString();
            labelCredit.Text      = total.CreditCard.ToString();
            labelOrderCount.Text  = total.OrderCount.ToString();
            labelRevenue.Text     = total.Revenue.ToString();
            labelCreditFee.Text   = total.CreditFee.ToString();
            labelCreditNet.Text   = total.CreditNet.ToString();
            comboBoxMonth.Enabled = true;
        }
예제 #18
0
        private void FormShiftDetail_Load(object sender, EventArgs e)
        {
            if (Row != null)
            {
                Text = Row.TableMonth.ToString() + "月" + Row.TableName;
            }
            if (Row.IsTableMonthNull())
            {
                MessageBox.Show("錯誤!沒有月份");
                Close();
                return;
            }

            foreach (var hr in m_DataSet.HR)
            {
                if (hr.IsInPositionNull() || (!hr.InPosition))
                {
                    continue;
                }
                checkedListBoxEmployee.Items.Add(new tempHR(hr.EmployeeID, hr.EmployeeName));
            }

            int mon = Row.TableMonth;

            m_DayCount  = MyFunction.DayCountOfMonth(mon);
            m_DayOfWeek = (new DateTime(MyFunction.IntHeaderYear, mon, 1)).DayOfWeek;
            var rows = Row.GetShiftDetailRows();

//            var rows = from r in m_DataSet.ShiftDetail where r.ShiftID == Row.ShiftID select r;
            if (rows.Count() != 0)
            {
                listBoxHelp.Visible = false;
            }
            foreach (var ro in rows)
            {
                tempHR hr = null;
                foreach (object o in checkedListBoxEmployee.Items)
                {
                    tempHR h = o as tempHR;
                    if (h.ID == ro.EmpolyeeID)
                    {
                        hr = h;
                        break;
                    }
                }
                if (hr == null)
                {
                    foreach (var h in m_DataSet.HR)              // 找不在職的
                    {
                        if (h.IsInPositionNull() || h.InPosition)
                        {
                            continue;                                        // InPosition 己經在m_HRList
                        }
                        if (h.EmployeeID != ro.EmpolyeeID)
                        {
                            continue;
                        }
                        hr = new tempHR(h.EmployeeID, h.EmployeeName);
                        break;
                    }
                    if (hr == null)
                    {
                        hr = new tempHR(ro.EmpolyeeID, "員工" + ro.EmpolyeeID.ToString());
                    }
                }
                MoveOne(m_DayCount, m_DayOfWeek, hr);
                ShiftDetail2PanelData(ro, hr);
                // UpdateTotal(hr); 代碼可能變更意思,進去不算
            }
        }