コード例 #1
0
        private void loadAllInformation()
        {
            //Generate Field
            var listInput           = productInputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == Month && u.Date.Value.Year == Year, u => u.PaymentInputs);
            var listOutput          = productOutputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == Month && u.Date.Value.Year == Year, u => u.PaymentOutputs);
            var listEmployeePayment = employeePaymentBO.GetData((u => u.isDelete == false && u.DATE.Value.Month == Month && u.DATE.Value.Year == Year));
            var listTimekeeping     = timekeepingBO.GetData((u => u.isDelete == false));

            // Weight
            txtProductInputWeight.Text  = listInput.Sum(u => u.ProductWeight) != 0? listInput.Sum(u => u.ProductWeight).ToString("#,###"):"0";
            txtProductOutputWeight.Text = listOutput.Sum(u => u.ProductWeight) != 0? listOutput.Sum(u => u.ProductWeight).ToString("#,###"):"0";
            //Amount
            txtProductInputAmount.Text  = listInput.Sum(u => u.TotalAmount) != 0? listInput.Sum(u => u.TotalAmount).ToString("#,###"):"0";
            txtProductOutputAmount.Text = listOutput.Sum(u => u.TotalAmount) != 0? listOutput.Sum(u => u.TotalAmount).ToString("#,###"):"0";
            //Payed
            txtInputPay.Text    = listInput.Sum(u => u.Payed) != 0? listInput.Sum(u => u.Payed).ToString("#,###"):"0";
            txtOutputPayed.Text = listOutput.Sum(u => u.Payed) != 0? listOutput.Sum(u => u.Payed).ToString("#,###"):"0";
            //Residue
            txtInputResidue.Text  = (listInput.Sum(u => u.TotalAmount) - listInput.Sum(u => u.Payed)) != 0? (listInput.Sum(u => u.TotalAmount) - listInput.Sum(u => u.Payed)).ToString("#,###"):"0";
            txtOutputResidue.Text = (listOutput.Sum(u => u.TotalAmount) - listOutput.Sum(u => u.Payed)) != 0? (listOutput.Sum(u => u.TotalAmount) - listOutput.Sum(u => u.Payed)).ToString("#,###"):"0";
            //Wage
            txtWage.Text = listEmployeePayment.Sum(u => u.PAY) != 0? listEmployeePayment.Sum(u => u.PAY).ToString("#,###"):"0";
            //Profitable
            txtProfitable.Text      = (listOutput.Sum(u => u.Payed) - listInput.Sum(u => u.Payed) - listEmployeePayment.Sum(u => u.PAY)) != 0 ? (listOutput.Sum(u => u.Payed) - listInput.Sum(u => u.Payed) - listEmployeePayment.Sum(u => u.PAY)).ToString("#,###") : "0";
            txtProfitableTotal.Text = (listOutput.Sum(u => u.TotalAmount) - listInput.Sum(u => u.TotalAmount) - listEmployeePayment.Sum(u => u.PAY)) != 0 ? (listOutput.Sum(u => u.Payed) - listInput.Sum(u => u.Payed) - listEmployeePayment.Sum(u => u.PAY)).ToString("#,###") : "0";
            //percent
            var listInputMonthAgo  = productInputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == Month - 1 && u.Date.Value.Year == Year);
            var listOutputMonthAgo = productOutputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == Month - 1 && u.Date.Value.Year == Year);

            if (Month == 1)
            {
                listInputMonthAgo  = productInputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == 12 && u.Date.Value.Year == Year - 1);
                listOutputMonthAgo = productOutputBO.GetData(u => u.isDelete == false && u.Date.Value.Month == 12 && u.Date.Value.Year == Year - 1);
            }
            double TotalInput    = productInputBO.GetData(u => u.isDelete == false && u.Date.Value.Year == Year).Sum(u => u.TotalWeight);
            double TotalOutput   = productOutputBO.GetData(u => u.isDelete == false && u.Date.Value.Year == Year).Sum(u => u.TotalWeight);
            float  InputPercent  = ((float)((listInput.Sum(u => u.TotalWeight) * 100) / (float)TotalInput) - ((float)(listInputMonthAgo.Sum(u => u.TotalWeight) * 100) / (float)TotalInput));
            float  OutputPercent = ((float)listOutput.Sum(u => u.TotalWeight) * 100 / (float)TotalOutput - (float)listOutputMonthAgo.Sum(u => u.TotalWeight) * 100 / (float)TotalOutput);

            if (InputPercent >= 0)
            {
                txtInputPercent.Text      = InputPercent.ToString("0.0") + "%";
                pictureInputPercent.Image = Properties.Resources.arrow_up_icon;
            }
            if (InputPercent < 0)
            {
                txtInputPercent.Text      = (InputPercent * (-1)).ToString("0.0") + "%";
                pictureInputPercent.Image = Properties.Resources.arrow_down_icon;
            }
            if (OutputPercent >= 0)
            {
                txtOutputPercent.Text      = OutputPercent.ToString("0.0") + "%";
                pictureOutputPercent.Image = Properties.Resources.arrow_up_icon;
            }
            if (OutputPercent < 0)
            {
                txtOutputPercent.Text      = (OutputPercent * (-1)).ToString("0.0") + "%";
                pictureOutputPercent.Image = Properties.Resources.arrow_down_icon;
            }
        }
コード例 #2
0
ファイル: MCPayment.cs プロジェクト: TeamHCM/PlasticFactory
        private void loadDetail()
        {
            //Load for DataGrid
            string MSNV   = txtMSNV.Text;
            var    listDB = timekeepingBO.GetData(u => u.isDelete == false && u.Date.Value.Month == Month && u.Date.Value.Year == Year && u.MSNV == MSNV).ToList();

            dataDetailWork.Rows.Clear();
            for (int i = 0; i < listDB.Count(); i++)
            {
                dataDetailWork.Rows.Add();
                //color
                if (payment.pay > 0 && listEpay.Where(u => u.MonthOfPay == Month && u.YearOfPay == Year).Count() != 0)
                {
                    dataDetailWork.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.Orange;
                }
                if (payment.pay < 0)
                {
                    //kiem tra da luu hoa dơn chua nợ chưa
                    int tCount = listEpay.Where(u => u.MonthOfPay == Month && u.YearOfPay == Year).Count();
                    if (tCount != 0)
                    {
                        dataDetailWork.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.Green;
                    }
                }
                if (payment.pay == 0 && listEpay.Where(u => u.MonthOfPay == Month && u.YearOfPay == Year).Count() != 0)
                {
                    dataDetailWork.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.Green;
                }
                //.endcolor
                dataDetailWork.Rows[i].Cells[0].Value = listDB[i].Date.Value.Day + "/" + listDB[i].Date.Value.Month;
                dataDetailWork.Rows[i].Cells[1].Value = listDB[i].TimeStart + " - " + listDB[i].TimeEnd;
                dataDetailWork.Rows[i].Cells[2].Value = listDB[i].Time;
                dataDetailWork.Rows[i].Cells[3].Value = listDB[i].TotalWeight;
                dataDetailWork.Rows[i].Cells[4].Value = listDB[i].AdvancePayment;
                dataDetailWork.Rows[i].Cells[5].Value = listDB[i].Food;
                dataDetailWork.Rows[i].Cells[6].Value = listDB[i].Bunus;
                dataDetailWork.Rows[i].Cells[7].Value = listDB[i].Punish;
                dataDetailWork.Rows[i].Cells[8].Value = listDB[i].Note;
            }
            txtDayWork.Text = listDB.Count().ToString();
        }
コード例 #3
0
ファイル: Management.cs プロジェクト: TeamHCM/PlasticFactory
        public void LoadDataDS(DateTime date)
        {
            try
            {
                dataDS.Columns.Clear();
                #region DataGridView
                dataDS.ColumnCount      = 12;
                dataDS.Columns[0].Name  = "MSNV";
                dataDS.Columns[1].Name  = "Họ tên";
                dataDS.Columns[2].Name  = "Ngày";
                dataDS.Columns[3].Name  = "Thời gian(h)";
                dataDS.Columns[4].Name  = "Số bao";
                dataDS.Columns[5].Name  = "Loại bao(KG)";
                dataDS.Columns[6].Name  = "Số lượng";
                dataDS.Columns[7].Name  = "Tiền ứng";
                dataDS.Columns[8].Name  = "Tiền cơm";
                dataDS.Columns[9].Name  = "Tiền phạt";
                dataDS.Columns[10].Name = "Tiền thưởng";
                dataDS.Columns[11].Name = "Ngày làm";

                dataDS.Columns[0].Width  = 80;
                dataDS.Columns[1].Width  = 150;
                dataDS.Columns[2].Width  = 110;
                dataDS.Columns[3].Width  = 100;
                dataDS.Columns[4].Width  = 100;
                dataDS.Columns[5].Width  = 100;
                dataDS.Columns[6].Width  = 100;
                dataDS.Columns[7].Width  = 120;
                dataDS.Columns[8].Width  = 100;
                dataDS.Columns[9].Width  = 100;
                dataDS.Columns[10].Width = 100;
                dataDS.Columns[11].Width = 100;
                #endregion
                var ListEmployee = employeeBO.GetData(u => u.isDelete == false);
                var listData     = timekeepingBO.GetData(u => u.isDelete == false && u.Date.Value.Month == int.Parse(txtMonth.Text) && u.Date.Value.Year == int.Parse(txtYear.Text));
                txtCountWork.Visible = false;
                int i = 0;
                foreach (var item in ListEmployee)
                {
                    var ListDB = timekeepingBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.Date.Value.Month == date.Month && u.Date.Value.Year == date.Year).ToList();
                    if (ListDB.Count != 0)
                    {
                        foreach (var itemType in ListDB.Select(u => u.Type).Distinct())
                        {
                            dataDS.Rows.Add();
                            if (i % 2 == 0)
                            {
                                dataDS.Rows[i].Cells[0].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[1].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[2].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[3].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[4].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[5].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[6].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[7].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[8].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[9].Style.BackColor  = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[10].Style.BackColor = System.Drawing.Color.Gainsboro;
                                dataDS.Rows[i].Cells[11].Style.BackColor = System.Drawing.Color.Gainsboro;
                            }
                            else
                            {
                                dataDS.Rows[i].Cells[0].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[1].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[2].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[3].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[4].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[5].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[6].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[7].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[8].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[9].Style.BackColor  = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[10].Style.BackColor = System.Drawing.Color.WhiteSmoke;
                                dataDS.Rows[i].Cells[11].Style.BackColor = System.Drawing.Color.WhiteSmoke;
                            }
                            dataDS.Rows[i].Cells[0].Value  = item.MSNV;
                            dataDS.Rows[i].Cells[1].Value  = timekeepingBO.GetNameEmployee(item.MSNV);
                            dataDS.Rows[i].Cells[2].Value  = ListDB.First().Date.Value.Month + "/" + ListDB.First().Date.Value.Year;
                            dataDS.Rows[i].Cells[3].Value  = ListDB.Sum(u => u.Time);
                            dataDS.Rows[i].Cells[4].Value  = ListDB.Where(u => u.Type == itemType).Sum(u => u.Weight) == 0 ? "0" : ListDB.Where(u => u.Type == itemType).Sum(u => u.Weight).ToString("#,###");
                            dataDS.Rows[i].Cells[5].Value  = itemType;//Type sack
                            dataDS.Rows[i].Cells[6].Value  = ListDB.Where(u => u.Type == itemType).Sum(u => u.TotalWeight) == 0 ? "0" : ListDB.Where(u => u.Type == itemType).Sum(u => u.TotalWeight).ToString("#,###");
                            dataDS.Rows[i].Cells[7].Value  = ListDB.Sum(u => u.AdvancePayment) == 0 ? "0" : ListDB.Sum(u => u.AdvancePayment).ToString("#,###");
                            dataDS.Rows[i].Cells[8].Value  = ListDB.Sum(u => u.Food) == 0 ? "0" : ListDB.Sum(u => u.Food).ToString("#,###");
                            dataDS.Rows[i].Cells[9].Value  = ListDB.Sum(u => u.Punish) == 0 ? "0" : ListDB.Sum(u => u.Punish).ToString("#,###");
                            dataDS.Rows[i].Cells[10].Value = ListDB.Sum(u => u.Bunus) == 0 ? "0" : ListDB.Sum(u => u.Bunus).ToString("#,###");
                            dataDS.Rows[i].Cells[11].Value = ListDB.Count() - ListDB.Count(u => u.isRest == true);
                            i++;
                        }
                    }
                }
                lbCashAdvance.Text = listData.Sum(u => u.AdvancePayment) == 0 ? "0" : string.Format("{0:0,0 (VNĐ)}", listData.Sum(u => u.AdvancePayment));
                lbTotalWeight.Text = listData.Sum(u => u.TotalWeight) == 0 ? "0" : string.Format("{0:0,0 (KG)}", listData.Sum(u => u.TotalWeight));
                txtTotalTime.Text  = listData.Sum(u => u.Time) == 0 ? "0" : ((double)listData.Sum(u => u.Time)).ToString();
                txtFood.Text       = listData.Sum(u => u.Food).ToString("#,###") == string.Empty ? "0" : ((double)listData.Sum(u => u.Food)).ToString("#,###") + "VNĐ";
                txtPunish.Text     = listData.Sum(u => u.Punish).ToString("#,###") == string.Empty ? "0" : listData.Sum(u => u.Punish).ToString("#,###") + "VNĐ";
                txtBonus.Text      = listData.Sum(u => u.Bunus).ToString("#,###") == string.Empty ? "0" : listData.Sum(u => u.Bunus).ToString("#,###") + "VNĐ";
            }
            catch { }
        }
コード例 #4
0
        public void LoadDataDS(DateTime date)
        {
            var ListDB = timekeepingBO.GetData(u => u.isDelete == false && u.Date.Value.Month == date.Month && u.Date.Value.Year == date.Year);

            LoadDataGird(ListDB);
        }
コード例 #5
0
        private void loadDG()
        {
            ResetForm();
            dataDS.Rows.Clear();
            if (txtMSNV.Text == "All")
            {
                dataDS.Columns.Clear();
                #region Columns DataGridView
                dataDS.ColumnCount     = 4;
                dataDS.Columns[0].Name = "MSNV";
                dataDS.Columns[1].Name = "Họ và tên";
                dataDS.Columns[2].Name = "Tiền đã thanh toán";
                dataDS.Columns[3].Name = "Chấm công";

                dataDS.Columns[0].Width = 100;
                dataDS.Columns[1].Width = 150;
                dataDS.Columns[2].Width = 900;
                dataDS.Columns[3].Width = 100;
                #endregion
                var listEmployee = employeeBO.GetData(u => u.isDelete == false);
                int i            = 0;
                foreach (var item in listEmployee)
                {
                    dataDS.Rows.Add();
                    if (i % 2 == 0)
                    {
                        dataDS.Rows[i].Cells[0].Style.BackColor = Color.Gainsboro;
                        dataDS.Rows[i].Cells[1].Style.BackColor = Color.Gainsboro;
                        dataDS.Rows[i].Cells[2].Style.BackColor = Color.Gainsboro;
                        dataDS.Rows[i].Cells[3].Style.BackColor = Color.Gainsboro;
                    }
                    else
                    {
                        dataDS.Rows[i].Cells[0].Style.BackColor = Color.WhiteSmoke;
                        dataDS.Rows[i].Cells[1].Style.BackColor = Color.WhiteSmoke;
                        dataDS.Rows[i].Cells[2].Style.BackColor = Color.WhiteSmoke;
                        dataDS.Rows[i].Cells[3].Style.BackColor = Color.WhiteSmoke;
                    }
                    var ListDB = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.DATE.Value.Month == int.Parse(txtMonth.Text) && u.DATE.Value.Year == int.Parse(txtYear.Text));
                    dataDS.Rows[i].Cells[0].Value = item.MSNV;
                    dataDS.Rows[i].Cells[1].Value = item.Hoten;
                    dataDS.Rows[i].Cells[2].Value = ListDB.Sum(u => u.PAY) != 0? ListDB.Sum(u => u.PAY).ToString("#,###"):"0";
                    string timekeeping = "";
                    int    t           = 0;
                    foreach (var itemTime in employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV).Select(u => u.MonthOfPay).Distinct())
                    {
                        if (t == 0)
                        {
                            timekeeping = itemTime.ToString();
                        }
                        if (t > 0)
                        {
                            timekeeping += "+" + itemTime.ToString();
                        }
                        t++;
                    }
                    dataDS.Rows[i].Cells[3].Value           = timekeeping;
                    dataDS.Rows[i].Cells[3].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    i++;
                }
                var listAllPayment = employeePaymentBO.GetData(u => u.isDelete == false && u.DATE.Value.Month == Month && u.DATE.Value.Year == Year);
                txtPayed.Text = listAllPayment.Sum(u => u.PAY) != 0 ? listAllPayment.Sum(u => u.PAY).ToString("#,###") : "0";
            }
            else
            {
                dataDS.Columns.Clear();
                #region Columns DataGridView
                dataDS.ColumnCount      = 13;
                dataDS.Columns[0].Name  = "MSTT";
                dataDS.Columns[1].Name  = "Ngày lập";
                dataDS.Columns[2].Name  = "MSNV";
                dataDS.Columns[3].Name  = "Họ và tên";
                dataDS.Columns[4].Name  = "Thời gian";
                dataDS.Columns[5].Name  = "Sản phẩm";
                dataDS.Columns[6].Name  = "Tiền nợ trước";
                dataDS.Columns[7].Name  = "Tiền ứng";
                dataDS.Columns[8].Name  = "Tiền cơm";
                dataDS.Columns[9].Name  = "Tiền thưởng";
                dataDS.Columns[10].Name = "Tiền phạt";
                dataDS.Columns[11].Name = "Tiền đã thanh toán";
                dataDS.Columns[12].Name = "Chấm công";

                dataDS.Columns[0].Width  = 100;
                dataDS.Columns[1].Width  = 150;
                dataDS.Columns[2].Width  = 100;
                dataDS.Columns[3].Width  = 150;
                dataDS.Columns[4].Width  = 100;
                dataDS.Columns[5].Width  = 100;
                dataDS.Columns[6].Width  = 150;
                dataDS.Columns[7].Width  = 150;
                dataDS.Columns[8].Width  = 100;
                dataDS.Columns[9].Width  = 100;
                dataDS.Columns[10].Width = 100;
                dataDS.Columns[11].Width = 150;
                dataDS.Columns[12].Width = 100;
                #endregion
                payment = new Payment();
                double debtAgo      = 0;
                int    Time         = (int)listTime.Sum(u => u.Time);
                int    Product      = (int)listTime.Sum(u => long.Parse(u.TotalWeight.ToString()));
                int    ProductPrice = 0;
                int    TimePrice    = 0;
                int    priceCount   = listEpay.Where(u => u.DATE.Value.Month == Month && u.DATE.Value.Year == Year).Count();
                if (priceCount != 0)
                {
                    ProductPrice = listEpay.Where(u => u.DATE.Value.Month == Month && u.DATE.Value.Year == Year).First().ProductPrice;
                    TimePrice    = listEpay.Where(u => u.DATE.Value.Month == Month && u.DATE.Value.Year == Year).First().TimePrice;
                }
                payment.cash  = (double)listTime.Sum(u => u.AdvancePayment);
                payment.payed = listEpay.Where(u => u.DATE.Value.Month == Month && u.DATE.Value.Year == Year).Sum(u => u.PAY);
                //GetTime month ago =>Debt
                if (Month == 1)
                {
                    int count = listEpay.Where(u => u.DATE.Value.Month == 12 && u.DATE.Value.Year == Year - 1).Count();
                    if (count != 0)
                    {
                        payment.debtAgo = listEpay.Where(u => u.DATE.Value.Month == 12 && u.DATE.Value.Year == Year - 1).First().NEBT;
                    }
                }
                else
                {
                    int count = listEpay.Where(u => u.DATE.Value.Month == Month - 1 && u.DATE.Value.Year == Year).Count();
                    if (count != 0)
                    {
                        payment.debtAgo = listEpay.Where(u => u.DATE.Value.Month == Month - 1 && u.DATE.Value.Year == Year).First().NEBT;
                    }
                }
                payment.pay = Time * TimePrice + Product * ProductPrice - payment.cash - payment.debtAgo - payment.payed;
                var listDB = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == msnv && u.DATE.Value.Month == Month && u.DATE.Value.Year == Year).ToList();
                int i      = 0;
                foreach (var item in listDB)
                {
                    dataDS.Rows.Add();
                    var ListDB = timekeepingBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.Date.Value.Month == item.MonthOfPay && u.Date.Value.Year == item.YearOfPay);
                    dataDS.Rows[i].Cells[0].Value = "TT" + item.ID.ToString("D6");
                    dataDS.Rows[i].Cells[1].Value = item.DATE.Value.ToShortDateString();
                    dataDS.Rows[i].Cells[2].Value = item.MSNV;
                    dataDS.Rows[i].Cells[3].Value = employeeBO.GetNameByID(item.MSNV);
                    dataDS.Rows[i].Cells[4].Value = Math.Round(ListDB.Sum(u => u.Time), 1);
                    dataDS.Rows[i].Cells[5].Value = ListDB.Sum(u => u.TotalWeight);
                    //GetTime month ago =>Debt
                    if (Month == 1)
                    {
                        int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV).Where(u => u.DATE.Value.Month == 12 && u.DATE.Value.Year == Year - 1).Count();
                        if (count != 0)
                        {
                            debtAgo = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV).Where(u => u.DATE.Value.Month == 12 && u.DATE.Value.Year == Year - 1).First().NEBT;
                        }
                    }
                    else
                    {
                        int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV).Where(u => u.DATE.Value.Month == Month - 1 && u.DATE.Value.Year == Year).Count();
                        if (count != 0)
                        {
                            debtAgo = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV).Where(u => u.DATE.Value.Month == Month - 1 && u.DATE.Value.Year == Year).First().NEBT;
                        }
                    }
                    dataDS.Rows[i].Cells[6].Value  = debtAgo;
                    dataDS.Rows[i].Cells[7].Value  = item.Cash != 0? item.Cash.ToString("#,###"):"0";
                    dataDS.Rows[i].Cells[8].Value  = ListDB.Sum(u => u.Food) != 0? ListDB.Sum(u => u.Food).ToString("#,###"):"0";
                    dataDS.Rows[i].Cells[9].Value  = ListDB.Sum(u => u.Bunus) != 0? ListDB.Sum(u => u.Bunus).ToString("#,###"):"0";
                    dataDS.Rows[i].Cells[10].Value = ListDB.Sum(u => u.Punish) != 0? ListDB.Sum(u => u.Punish).ToString("#,###"):"0";
                    dataDS.Rows[i].Cells[11].Value = item.PAY != 0? item.PAY.ToString("#,###"):"0";
                    dataDS.Rows[i].Cells[12].Value = item.MonthOfPay + "/" + item.YearOfPay;
                    i++;
                }
                var listAllPayment = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == txtMSNV.Text && u.DATE.Value.Month == Month && u.DATE.Value.Year == Year);
                txtPayed.Text = listAllPayment.Sum(u => u.PAY) != 0 ? listAllPayment.Sum(u => u.PAY).ToString("#,###") : "0";
            }
        }