Esempio n. 1
0
        public static void EvaluateValuesForViewBangThuTienRow(QLMamNon.Dao.QLMamNonDs.ViewBangThuTienRow row,
                                                               QLMamNon.Dao.QLMamNonDs.ViewBangThuTienRow bangThuTienThangTruocRow,
                                                               QLMamNon.Dao.QLMamNonDs.BangThuTienKhoanThuDataTable bTTKTDataTable,
                                                               QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable phieuThuDataTable,
                                                               bool ignoreTruyThu, bool isCalculateAnSangAnToi, bool isCalculateHocPhi)
        {
            evaluateValuesForAdditionalFields(row, bTTKTDataTable, isCalculateAnSangAnToi, isCalculateHocPhi);
            evaluateValuesForTienNop(row, phieuThuDataTable);

            if (!ignoreTruyThu)
            {
                row.SoTienTruyThu = BangThuTienUtil.CalculateTruyThu(row, bangThuTienThangTruocRow);
            }

            CalculateSummaryFields(row);
        }
Esempio n. 2
0
        public static void CalculateSummaryFields(QLMamNon.Dao.QLMamNonDs.ViewBangThuTienRow row)
        {
            BangThuTienGenHistoryTableAdapter bangThuTienGenHistoryTableAdapter = (BangThuTienGenHistoryTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterBangThuTienGenHistory);
            BangThuTienGenHistoryDataTable    bangThuTienGenHistoryDataTable    = bangThuTienGenHistoryTableAdapter.GetDataByLopAndNgay(row.LopId, row.NgayTinh);

            if (!ListUtil.IsEmpty(bangThuTienGenHistoryDataTable.Rows))
            {
                BangThuTienGenHistoryRow bangThuTienGenHistoryRow = bangThuTienGenHistoryDataTable[0];
                row.SoTienSXThangTruoc     = BangThuTienUtil.SXToSoTienSX(row.SXThangTruoc, (long)bangThuTienGenHistoryRow.SoTienAnChinh);
                row.SoTienAnSangThangTruoc = BangThuTienUtil.SXAnSangToSoTienAnSang(row.AnSangThangTruoc, (long)bangThuTienGenHistoryRow.SoTienAnSang);
                row.SoTienAnToiThangTruoc  = BangThuTienUtil.SXAnToiToSoTienAnToi(row.AnToiThangTruoc, (long)bangThuTienGenHistoryRow.SoTienAnToi);
            }

            row.SoTienAnSangConLai = row.SoTienAnSangThangNay - row.SoTienAnSangThangTruoc;
            row.SoTienAnToiConLai  = row.SoTienAnToiThangNay - row.SoTienAnToiThangTruoc;
            row.KhoanThuChinh      = row.TienAnSua + row.PhuPhi + row.BanTru + row.HocPhi;
            row.ThanhTien          = BangThuTienUtil.CalculateThanhTien(row);
        }
Esempio n. 3
0
        public static void RecalculateBangThuTienKhoanThuList(LopKhoiTableAdapter lopKhoiTableAdapter,
                                                              KhoanThuHangNamTableAdapter khoanThuHangNamTableAdapter,
                                                              QLMamNon.Dao.QLMamNonDs.ViewBangThuTienRow viewBangThuTienRow)
        {
            int khoiId = StaticDataUtil.GetKhoiIdByLopId(lopKhoiTableAdapter, viewBangThuTienRow.LopId).Value;

            int[] khoanThuIds = new int[] { BangThuTienConstant.KhoanThuIdBanTru, BangThuTienConstant.KhoanThuIdHocPhi, BangThuTienConstant.KhoanThuIdPhuPhi, BangThuTienConstant.KhoanThuIdTienAnSua, BangThuTienConstant.KhoanThuIdAnSang, BangThuTienConstant.KhoanThuIdAnToi };
            QLMamNon.Dao.QLMamNonDs.KhoanThuHangNamDataTable khoanThuHangNamTable = khoanThuHangNamTableAdapter.GetKhoanThuHangNamByParams(String.Join(",", khoanThuIds), khoiId, viewBangThuTienRow.NgayTinh);

            foreach (QLMamNon.Dao.QLMamNonDs.KhoanThuHangNamRow row in khoanThuHangNamTable)
            {
                long soTien = BangThuTienUtil.CalculateSoTienPhi(khoiId, viewBangThuTienRow.SXThangTruoc, row.SoTien, row.KhoanThuId);
                switch (row.KhoanThuId)
                {
                case BangThuTienConstant.KhoanThuIdTienAnSua:
                    viewBangThuTienRow.TienAnSua = soTien;
                    break;

                case BangThuTienConstant.KhoanThuIdPhuPhi:
                    viewBangThuTienRow.PhuPhi = soTien;
                    break;

                case BangThuTienConstant.KhoanThuIdBanTru:
                    viewBangThuTienRow.BanTru = soTien;
                    break;

                case BangThuTienConstant.KhoanThuIdHocPhi:
                    viewBangThuTienRow.HocPhi = soTien;
                    break;

                default:
                    break;
                }
            }

            viewBangThuTienRow.KhoanThuChinh = viewBangThuTienRow.TienAnSua + viewBangThuTienRow.PhuPhi + viewBangThuTienRow.BanTru + viewBangThuTienRow.HocPhi;
            viewBangThuTienRow.ThanhTien     = BangThuTienUtil.CalculateThanhTien(viewBangThuTienRow);
        }