コード例 #1
0
 public void UpdateGiaoDich(
     decimal ip_dc_id_giao_dich
     , string ip_str_SKNKTNN
     , string ip_str_SKNCQTC
     , string ip_str_SDNKTNN
     , string ip_str_SDNCQTC
     )
 {
     try
     {
         using (BKI_QLDTEntities db = new BKI_QLDTEntities())
         {
             GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH gd
                 = db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH.FirstOrDefault(x => x.ID == ip_dc_id_giao_dich);
             gd.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC = CIPConvert.ToDecimal(ip_str_SKNKTNN.Replace(",", "").Replace(".", "").Trim());
             gd.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH = CIPConvert.ToDecimal(ip_str_SKNCQTC.Replace(",", "").Replace(".", "").Trim());
             gd.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC = CIPConvert.ToDecimal(ip_str_SDNKTNN.Replace(",", "").Replace(".", "").Trim());
             gd.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH = CIPConvert.ToDecimal(ip_str_SDNCQTC.Replace(",", "").Replace(".", "").Trim());
             db.SaveChanges();
         }
     }
     catch (Exception v_e)
     {
         Context.Response.Output.Write("Loi: "+v_e.Message);
     }
 }
コード例 #2
0
 public void deleteItem(decimal ip_dc_id_giao_dich)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var gd = db.GD_DU_TOAN_THU_CHI_PHI_PHA.First(x => x.ID == ip_dc_id_giao_dich);
     if (gd == null) return;
     db.GD_DU_TOAN_THU_CHI_PHI_PHA.Remove(gd);
     db.SaveChanges();
 }
コード例 #3
0
 public void UpdateAll(string ip_str_arr)
 {
     JavaScriptSerializer js = new JavaScriptSerializer();
     KhoiLuongItem[] ip_arr = js.Deserialize<KhoiLuongItem[]>(ip_str_arr);
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     for (int i = 0; i < ip_arr.Length; i++)
     {
         decimal v_dc_id = ip_arr[i].ID;
         var gd = db.GD_KHOI_LUONG.FirstOrDefault(x => x.ID == v_dc_id);
         if (gd == null) continue;
         gd.SO_TIEN_DA_NGHIEM_THU = Convert.ToDecimal(ip_arr[i].GIA_TRI_THUC_HIEN_QBT.Replace(",", "").Replace(".", ""));
         gd.SO_TIEN_DA_NGHIEM_THU_NS = Convert.ToDecimal(ip_arr[i].GIA_TRI_THUC_HIEN_NS.Replace(",", "").Replace(".", ""));
         gd.NHU_CAU_VON_KY_TIEP_THEO =Convert.ToDecimal(ip_arr[i].NHU_CAU_VON_KY_TIEP_THEO.Replace(",", "").Replace(".", ""));
         db.SaveChanges();
     }
 }
コード例 #4
0
 public void insertFormTemplateToGdPL01(BKI_QLDTEntities ip_db, decimal ip_dc_id_don_vi, int ip_i_nam)
 {
     var lst_temp_pl01 = ip_db.TP_PL01.OrderBy(x=>x.ID).ToList();
     foreach (var tp in lst_temp_pl01)
     {
         GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI gd = new GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI();
         gd.CAP = tp.CAP;
         gd.CHI_TIEU = tp.CHI_TIEU;
         gd.CONG_THUC = tp.CONG_THUC;
         gd.ID_DON_VI =ip_dc_id_don_vi;
         gd.MA_SO = tp.MA_SO;
         gd.MA_SO_PARENT = tp.MA_SO_PARENT;
         gd.NAM = ip_i_nam;
         gd.SO_BAO_CAO = 0;
         gd.SO_XET_DUYET = 0;
         ip_db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI.Add(gd);
         ip_db.SaveChanges();
     }
 }
コード例 #5
0
 public void update_giao_dich(decimal ip_dc_id_giao_dich, string ip_str_so_bao_cao, string ip_str_so_xet_duyet)
 {
     try
     {
         using (BKI_QLDTEntities db = new BKI_QLDTEntities())
         {
             GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI gd =
                 db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI.Where(x => x.ID == ip_dc_id_giao_dich).FirstOrDefault();
             if (gd != null)
             {
                 gd.SO_BAO_CAO = CIPConvert.ToDecimal(ip_str_so_bao_cao.Replace(",", "").Replace(".", ""));
                 gd.SO_XET_DUYET = CIPConvert.ToDecimal(ip_str_so_xet_duyet.Replace(",", "").Replace(".", ""));
                 db.SaveChanges();
                 Context.Response.Output.Write("true");
             }
             else Context.Response.Output.Write("false");
         }
     }
     catch (Exception)
     {
         Context.Response.Output.Write("false");
     }
 }
コード例 #6
0
 public void DeleteGiaoDich(decimal ip_dc_id_giao_dich)
 {
     try
     {
         using (BKI_QLDTEntities db = new BKI_QLDTEntities())
         {
             GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN gd = db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.First(x => x.ID == ip_dc_id_giao_dich);
             if (gd != null)
             {
                 db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.Remove(gd);
                 db.SaveChanges();
                 Context.Response.Output.Write("true");
             }
             else
             {
                 Context.Response.Output.Write("false");
             }
         }
     }
     catch (Exception)
     {
         Context.Response.Output.Write("false");
     }
 }
コード例 #7
0
        public void UpdateGiaoDich(
            decimal ip_dc_id_giao_dich
            , string ip_str_ma_loai
            , string ip_str_ma_khoan
            , string ip_str_ma_muc
            , string ip_str_ma_tieu_muc
            , string ip_str_so_bao_cao
            , string ip_str_so_xet_duyet
            , string ip_str_noi_dung_chi
            , string ip_str_loai
            , decimal ip_dc_id_don_vi
            , decimal ip_dc_nam)
        {
            try
            {
                using (BKI_QLDTEntities db = new BKI_QLDTEntities())
                {
                    GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN gd;
                    if (ip_dc_id_giao_dich < 0)
                    {
                        gd = new GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN();
                    }
                    else
                    {
                        gd = db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.Where(x => x.ID == ip_dc_id_giao_dich).FirstOrDefault();
                    }
                    gd.MA_LOAI = ip_str_ma_loai;
                    gd.MA_KHOAN = ip_str_ma_khoan;
                    gd.MA_MUC = ip_str_ma_muc;
                    gd.MA_TIEU_MUC = ip_str_ma_tieu_muc;
                    gd.NOI_DUNG_CHI = ip_str_noi_dung_chi;
                    gd.ID_DON_VI = ip_dc_id_don_vi;
                    gd.NAM = ip_dc_nam;
                    gd.LOAI = ip_str_loai;
                    gd.SO_BAO_CAO = CIPConvert.ToDecimal(ip_str_so_bao_cao.Replace(",", "").Replace(".", ""));
                    gd.SO_XET_DUYET = CIPConvert.ToDecimal(ip_str_so_xet_duyet.Replace(",", "").Replace(".", ""));
                    if (ip_dc_id_giao_dich < 0)
                    {
                        db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.Add(gd);
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #8
0
        private void InsertFromTemplate(decimal ip_dc_id_don_vi, decimal ip_dc_nam)
        {
            using (BKI_QLDTEntities db = new BKI_QLDTEntities())
            {
                var lst_Pl03_template = db.TP_PL03.ToList();
                var lst_gdPL03 = db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH
                    .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                && x.NAM == ip_dc_nam)
                    .ToList();
                //Insert to GD_PL03 from Templete PL03 if do not have
                foreach (var temp in lst_Pl03_template)
                {
                    if (lst_gdPL03
                        .Where(x => x.MA_SO.Trim() == temp.MA_SO.Trim()
                                    && x.NOI_DUNG.Trim() == temp.NOI_DUNG.Trim()
                                    && x.MA_SO_PARENT == temp.MA_SO_PARENT)
                        .ToList().Count < 1)
                    {
                        GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH gd = new GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH();
                        gd.MA_SO = temp.MA_SO;
                        gd.ID_DON_VI = ip_dc_id_don_vi;
                        gd.MA_SO_PARENT = temp.MA_SO_PARENT;
                        gd.NAM = ip_dc_nam;
                        gd.NOI_DUNG = temp.NOI_DUNG;
                        gd.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH = temp.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH;
                        gd.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC = temp.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC;
                        gd.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH = temp.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH;
                        gd.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC = temp.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC;
                        gd.TT = temp.TT;
                        db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH.Add(gd);
                        db.SaveChanges();
                    }

                    //Delete from GD_PL03 if not exist in Templete PL03
                    foreach (var gd in lst_gdPL03)
                    {
                        if (lst_Pl03_template
                            .Where(x => x.MA_SO.Trim() == gd.MA_SO.Trim()
                                    && x.NOI_DUNG.Trim() == gd.NOI_DUNG.Trim()
                                    && x.MA_SO_PARENT == gd.MA_SO_PARENT)
                        .ToList().Count < 1)
                        {
                            lst_gdPL03.Remove(gd);
                            db.SaveChanges();
                        }
                    }
                }

            }
        }
コード例 #9
0
        private List<GD_KHOI_LUONG> load_data_to_grid_by_nguon(
            string ip_str_nguon_ns
            , decimal ip_dc_id_don_vi
            , DateTime ip_dat_ngay_nhap_khoi_luong
            , BKI_QLDTEntities ip_db
            )
        {
            //Tính toán các biến sử dụng
            DateTime v_dat_dau_nam = CCommonFunction.getDate_dau_nam_from_date(ip_dat_ngay_nhap_khoi_luong);
            DateTime v_dat_cuoi_nam = CCommonFunction.getDate_cuoi_nam_form_date(ip_dat_ngay_nhap_khoi_luong);

            //Get list GD_GIAO_KH của năm
            var v_lst_gd_giao_kh = ip_db.GD_CHI_TIET_GIAO_KH
                                        .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                            && x.DM_QUYET_DINH.NGAY_THANG >= v_dat_dau_nam
                                            && x.DM_QUYET_DINH.NGAY_THANG <= v_dat_cuoi_nam)
                                        .ToList();

            //Get list GD_KHOI_LUONG cua ngày nhập
            var v_lst_gd_khoi_luong = ip_db.GD_KHOI_LUONG
                                            .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                                && x.NGAY_THANG == ip_dat_ngay_nhap_khoi_luong.Date)
                                            .ToList();

            //Sao chép Công trình, dự án (Khoản, mục) từ GD_GIAO_KH sang GD_KHOI_LUONG
            foreach (var kh in v_lst_gd_giao_kh)
            {
                //Nếu chưa có trong GD_KHOI_LUONG thì insert vào GD_KHOI_LUONG
                if (kh.ID_CONG_TRINH != null)
                {
                    if (v_lst_gd_khoi_luong
                        .Where(x => x.ID_CONG_TRINH == kh.ID_CONG_TRINH
                            && x.ID_DU_AN == kh.ID_DU_AN).Count() == 0)
                    {
                        var gd_kl = new GD_KHOI_LUONG();
                        gd_kl.ID_DON_VI = ip_dc_id_don_vi;
                        gd_kl.ID_LOAI_NHIEM_VU = (decimal)kh.ID_LOAI_NHIEM_VU;
                        gd_kl.NGAY_THANG = ip_dat_ngay_nhap_khoi_luong.Date;
                        gd_kl.ID_CONG_TRINH = kh.ID_CONG_TRINH;
                        gd_kl.ID_DU_AN = kh.ID_DU_AN;
                        gd_kl.SO_TIEN_DA_NGHIEM_THU = 0;
                        gd_kl.SO_TIEN_DA_NGHIEM_THU_NS = 0;
                        gd_kl.NHU_CAU_VON_KY_TIEP_THEO = 0;
                        ip_db.GD_KHOI_LUONG.Add(gd_kl);
                        ip_db.SaveChanges();

                        //reload list khối lượng
                        v_lst_gd_khoi_luong = ip_db.GD_KHOI_LUONG
                                            .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                                && x.NGAY_THANG == ip_dat_ngay_nhap_khoi_luong.Date)
                                            .ToList();
                    }
                }
                else if (kh.ID_KHOAN != null)
                {
                    if (v_lst_gd_khoi_luong
                        .Where(x => x.ID_KHOAN == kh.ID_KHOAN
                            && x.ID_MUC == kh.ID_MUC
                            && x.ID_TIEU_MUC == x.ID_TIEU_MUC).Count() == 0)
                    {
                        var gd_kl = new GD_KHOI_LUONG();
                        gd_kl.ID_LOAI_NHIEM_VU = (decimal)kh.ID_LOAI_NHIEM_VU;
                        gd_kl.ID_DON_VI = ip_dc_id_don_vi;
                        gd_kl.NGAY_THANG = ip_dat_ngay_nhap_khoi_luong.Date;
                        gd_kl.ID_CHUONG = kh.ID_CHUONG;
                        gd_kl.ID_KHOAN = kh.ID_KHOAN;
                        gd_kl.ID_MUC = kh.ID_MUC;
                        gd_kl.ID_TIEU_MUC = kh.ID_TIEU_MUC;
                        gd_kl.SO_TIEN_DA_NGHIEM_THU = 0;
                        gd_kl.SO_TIEN_DA_NGHIEM_THU_NS = 0;
                        gd_kl.NHU_CAU_VON_KY_TIEP_THEO = 0;
                        ip_db.GD_KHOI_LUONG.Add(gd_kl);
                        ip_db.SaveChanges();

                        //reload list khối lượng
                        v_lst_gd_khoi_luong = ip_db.GD_KHOI_LUONG
                                            .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                                && x.NGAY_THANG == ip_dat_ngay_nhap_khoi_luong.Date)
                                            .ToList();
                    }
                }
            }

            //Xoá bỏ những Công trình, dự án (Khoản, mục) của GD_KHOI_LUONG mà không có trong GD_GIAO_KH
            foreach (var kl in v_lst_gd_khoi_luong)
            {
                if (kl.ID_CONG_TRINH != null)
                {
                    if (v_lst_gd_giao_kh.Where(x => x.ID_CONG_TRINH == kl.ID_CONG_TRINH
                        && x.ID_DU_AN == kl.ID_DU_AN).Count() == 0)
                    {
                        ip_db.GD_KHOI_LUONG.Remove(kl);
                        ip_db.SaveChanges();
                    }
                }
                else if (kl.ID_KHOAN != null)
                {
                    if (v_lst_gd_giao_kh.Where(x => x.ID_KHOAN == kl.ID_KHOAN
                        && x.ID_MUC == kl.ID_MUC
                        && x.ID_TIEU_MUC == kl.ID_TIEU_MUC).Count() == 0)
                    {
                        ip_db.GD_KHOI_LUONG.Remove(kl);
                        ip_db.SaveChanges();
                    }
                }
            }
            //reload list khối lượng
            v_lst_gd_khoi_luong = ip_db.GD_KHOI_LUONG
                                .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                    && x.NGAY_THANG == ip_dat_ngay_nhap_khoi_luong.Date)
                                .ToList();
            //Load dữ liệu theo Nguồn: Ngân sách hoặc Quỹ bảo trì
            List<GD_CHI_TIET_GIAO_KH> v_lst_giao_kh_theo_nguon = new List<GD_CHI_TIET_GIAO_KH>();
            //Lấy list giao kh, chứa id_Cong_trinh/id_du_an (id_khoan/id_muc, id_tieu_muc) theo nguồn
            if (ip_str_nguon_ns == "N")
            {
                v_lst_giao_kh_theo_nguon = v_lst_gd_giao_kh.Where(x => x.SO_TIEN_NS == 0).ToList();

            }
            else if (ip_str_nguon_ns == "Y")
            {
                v_lst_giao_kh_theo_nguon = v_lst_gd_giao_kh.Where(x => x.SO_TIEN_QUY_BT == 0).ToList();
            }
            //Load những đầu mục GD_KHOI_LUONG theo nguồn
            return v_lst_gd_khoi_luong
                            .Where(x => (x.ID_KHOAN != null
                                        && v_lst_giao_kh_theo_nguon.Where(y => y.ID_KHOAN == x.ID_KHOAN
                                                                    && y.ID_MUC == x.ID_MUC
                                                                    && y.ID_TIEU_MUC == x.ID_TIEU_MUC).Count() > 0)
                                        || (x.ID_CONG_TRINH != null
                                        && v_lst_giao_kh_theo_nguon.Where(y => y.ID_CONG_TRINH == x.ID_CONG_TRINH
                                                                    && y.ID_DU_AN == x.ID_DU_AN).Count() > 0)
                            ).ToList();
        }
コード例 #10
0
 public void UpdateGiaoDich(
     decimal ip_dc_id_giao_dich
     , string ip_str_ten_loai_nhiem_vu
     , string ip_str_cong_trinh
     , string ip_str_du_an
     , string ip_str_GTDTCongTrinhDuocDuyet
     , string ip_str_GiaTriQuyetToan
     , string ip_str_GTCTHTNamTruocConNoChuyenSangNamNay
     , string ip_str_GTCTHTNamNay
     , string ip_str_GTDNQTTrongNam
     , string ip_str_GTCTHTDQTLKDenNamBaoCao
     )
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var lst_lnv = db.CM_DM_TU_DIEN.Where(x => x.ID_LOAI_TU_DIEN == ID_LOAI_TU_DIEN.LOAI_NHIEM_VU || x.ID_LOAI_TU_DIEN == ID_LOAI_TU_DIEN.LOAI_NHIEM_VU_NS).ToList();
     GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN gd = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN.FirstOrDefault(x => x.ID == ip_dc_id_giao_dich);
     gd.TT = lst_lnv.FirstOrDefault(x => x.TEN.ToUpper() == ip_str_ten_loai_nhiem_vu.Trim().ToUpper()).GHI_CHU;
     gd.TEN_LOAI_NHIEM_VU = ip_str_ten_loai_nhiem_vu.Trim();
     gd.CONG_TRINH = ip_str_cong_trinh.Trim();
     gd.DU_AN = ip_str_du_an.Trim();
     gd.GIA_TRI_DU_TOAN_CONG_TRINH_DUOC_DUYET = CIPConvert.ToDecimal(ip_str_GTDTCongTrinhDuocDuyet.Trim().Replace(",", "").Replace(".", ""));
     gd.GIA_TRI_CTHT_NAM_TRUOC_CON_NO_CHUYEN_NAM_NAY = CIPConvert.ToDecimal(ip_str_GTCTHTNamTruocConNoChuyenSangNamNay.Trim().Replace(",", "").Replace(".", ""));
     gd.GIA_TRI_CTHT_NAM_NAY = CIPConvert.ToDecimal(ip_str_GTCTHTNamNay.Trim().Replace(",", "").Replace(".", ""));
     gd.GIA_TRI_DE_NGHI_QUYET_TOAN_TRONG_NAM = CIPConvert.ToDecimal(ip_str_GTDNQTTrongNam.Trim().Replace(",", "").Replace(".", ""));
     gd.GIA_TRI_CTHT_DA_QUYET_TOAN_LK_DEN_NAM_BAO_CAO = CIPConvert.ToDecimal(ip_str_GTCTHTDQTLKDenNamBaoCao.Trim().Replace(",", "").Replace(".", ""));
     gd.GIA_TRI_QUYET_TOAN = CIPConvert.ToDecimal(ip_str_GiaTriQuyetToan.Trim().Replace(",", "").Replace(".", ""));
     db.SaveChanges();
 }
コード例 #11
0
        public void UpdateAll(string ip_str_arr)
        {
            try
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                ItemF104[] ip_arr = js.Deserialize<ItemF104[]>(ip_str_arr);
                BKI_QLDTEntities db = new BKI_QLDTEntities();
                for (int i = 0; i < ip_arr.Length; i++)
                {
                    decimal id_gd = ip_arr[i].ID;
                    var gd = db.GD_CHI_TIET_GIAO_KH.FirstOrDefault(x => x.ID == id_gd);
                    if (gd == null) continue;
                    //xu ly du lieu so km
                    decimal v_so_km = 0;
                    decimal.TryParse(ip_arr[i].SO_KM.Replace(",", ""), out v_so_km);
                    gd.GHI_CHU_2 = v_so_km.ToString();

                    gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG = Convert.ToDecimal(ip_arr[i].KP_NAM_TRUOC_CHUYEN_SANG_QBT.Trim().Replace(",", "").Replace(".", ""));
                    gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS = Convert.ToDecimal(ip_arr[i].KP_NAM_TRUOC_CHUYEN_SANG_NS.Trim().Replace(",", "").Replace(".", ""));
                    gd.SO_TIEN_NS = Convert.ToDecimal(ip_arr[i].KP_NGAN_SACH.Trim().Replace(",", "").Replace(".", ""));
                    gd.SO_TIEN_QUY_BT = Convert.ToDecimal(ip_arr[i].KP_QUY_BT.Trim().Replace(",", "").Replace(".", ""));
                    gd.TONG_MUC_DAU_TU = Convert.ToDecimal(ip_arr[i].TONG_MUC_DAU_TU.Trim().Replace(",", "").Replace(".", ""));
                    gd.THOI_GIAN_THUC_HIEN = Convert.ToDecimal(ip_arr[i].THOI_GIAN_THUC_HIEN.Trim().Replace(",", "").Replace(".", ""));

                    db.SaveChanges();
                }
            }
            catch (Exception v_e)
            {
                Context.Response.Write(v_e.Message);
            }
        }
コード例 #12
0
 public void DeleteGiaoDich(decimal ip_dc_ID)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var gd = db.GD_CHI_TIET_GIAO_KH.FirstOrDefault(x => x.ID == ip_dc_ID);
     if (gd == null) return;
     db.GD_CHI_TIET_GIAO_KH.Remove(gd);
     db.SaveChanges();
 }
コード例 #13
0
        public void InsertItem(decimal ip_dc_id_quyet_dinh
            , decimal ip_dc_id_don_vi
            , decimal ip_dc_id_parent
            , string ip_str_tt
            , string ip_str_hang_muc
            , string ip_str_kinh_phi_giao
            , string ip_str_KLTH_QUY_I
            , string ip_str_KLTH_QUY_II
            , string ip_str_KLTH_QUY_III
            , string ip_str_KLTH_QUY_IV
            , string ip_str_GHI_CHU_GIAO_KH
            , string ip_str_GHI_CHU_QUY_I
            , string ip_str_GHI_CHU_QUY_II
            , string ip_str_GHI_CHU_QUY_III
            , string ip_str_GHI_CHU_QUY_IV
            , string ip_str_PHAN_BO_QUI_I
            , string ip_str_PHAN_BO_QUY_II
            , string ip_str_PHAN_BO_QUY_III
            , string ip_str_PHAN_BO_QUY_IV
            , string ip_str_GHI_CHU_PHAN_BO_QUY_I
            , string ip_str_GHI_CHU_PHAN_BO_QUY_II
            , string ip_str_GHI_CHU_PHAN_BO_QUY_III
            , string ip_str_GHI_CHU_PHAN_BO_QUY_IV
            )
        {
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            var qd = db.DM_QUYET_DINH.FirstOrDefault(x => x.ID == ip_dc_id_quyet_dinh);
            var gd_parent = db.GD_DU_TOAN_THU_CHI_PHI_PHA.FirstOrDefault(x => x.ID == ip_dc_id_parent);
            var lst_children = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                    .Where(x => x.ID_QUYET_DINH == ip_dc_id_quyet_dinh
                                            && x.ID_DON_VI == ip_dc_id_don_vi
                                            && x.MA_SO_PARENT == gd_parent.MA_SO)
                                    .ToList();
            GD_DU_TOAN_THU_CHI_PHI_PHA gd = new GD_DU_TOAN_THU_CHI_PHI_PHA();
            gd.ID_DON_VI = ip_dc_id_don_vi;
            gd.ID_QUYET_DINH = ip_dc_id_quyet_dinh;
            gd.MA_SO = getMaSoChildrenByMaSoParent(gd_parent.MA_SO, lst_children);
            gd.MA_SO_PARENT = gd_parent.MA_SO; ;
            gd.TT = ip_str_tt;
            gd.HANG_MUC = ip_str_hang_muc;
            gd.KINH_PHI_GIAO_KH = getMoney_number(ip_str_kinh_phi_giao.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_I = getMoney_number(ip_str_KLTH_QUY_I.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_II = getMoney_number(ip_str_KLTH_QUY_II.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_III = getMoney_number(ip_str_KLTH_QUY_III.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_IV = getMoney_number(ip_str_KLTH_QUY_IV.Replace(",", "").Replace(".", ""));
            gd.GHI_CHU_GIAO_KH = ip_str_GHI_CHU_GIAO_KH;
            gd.GHI_CHU_QUY_I = ip_str_GHI_CHU_QUY_I;
            gd.GHI_CHU_QUY_II = ip_str_GHI_CHU_QUY_II;
            gd.GHI_CHU_QUY_III = ip_str_GHI_CHU_QUY_III;
            gd.GHI_CHU_QUY_IV = ip_str_GHI_CHU_QUY_IV;

            gd.PHAN_BO_QUI_I = getMoney_number(ip_str_PHAN_BO_QUI_I.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_II = getMoney_number(ip_str_PHAN_BO_QUY_II.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_III = getMoney_number(ip_str_PHAN_BO_QUY_III.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_IV = getMoney_number(ip_str_PHAN_BO_QUY_IV.Replace(",", "").Replace(".", "")); ;
            gd.GHI_CHU_PHAN_BO_QUY_I = ip_str_GHI_CHU_PHAN_BO_QUY_I;
            gd.GHI_CHU_PHAN_BO_QUY_II = ip_str_GHI_CHU_PHAN_BO_QUY_II;
            gd.GHI_CHU_PHAN_BO_QUY_III = ip_str_GHI_CHU_PHAN_BO_QUY_III;
            gd.GHI_CHU_PHAN_BO_QUY_IV = ip_str_GHI_CHU_PHAN_BO_QUY_IV;

            gd.NAM = (decimal)qd.NGAY_THANG.Year;
            gd.IS_FIX = false;
            //gd.ID_PHA==?;
            db.GD_DU_TOAN_THU_CHI_PHI_PHA.Add(gd);
            db.SaveChanges();
        }
コード例 #14
0
        public void UpdateAll(string ip_str_arr)
        {
            try
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                ItemF505[] ip_arr = js.Deserialize<ItemF505[]>(ip_str_arr);
                BKI_QLDTEntities db = new BKI_QLDTEntities();
                for (int i = 0; i < ip_arr.Length; i++)
                {
                    decimal id_gd = ip_arr[i].ip_dc_id_giao_dich;
                    var gd = db.GD_DU_TOAN_THU_CHI_PHI_PHA.FirstOrDefault(x => x.ID == id_gd);
                    if (gd == null) continue;
                    gd.TT = ip_arr[i].ip_str_tt;
                    gd.HANG_MUC = ip_arr[i].ip_str_hang_muc;
                    gd.KINH_PHI_GIAO_KH = convertToDecimal(ip_arr[i].ip_str_kinh_phi_giao);
                    gd.KLTH_QUY_I = convertToDecimal(ip_arr[i].ip_str_KLTH_QUY_I);
                    gd.KLTH_QUY_II = convertToDecimal(ip_arr[i].ip_str_KLTH_QUY_II);
                    gd.KLTH_QUY_III = convertToDecimal(ip_arr[i].ip_str_KLTH_QUY_III);
                    gd.KLTH_QUY_IV = convertToDecimal(ip_arr[i].ip_str_KLTH_QUY_IV);
                    gd.GHI_CHU_GIAO_KH = ip_arr[i].ip_str_GHI_CHU_GIAO_KH;
                    gd.GHI_CHU_QUY_I = ip_arr[i].ip_str_GHI_CHU_QUY_I;
                    gd.GHI_CHU_QUY_II = ip_arr[i].ip_str_GHI_CHU_QUY_II;
                    gd.GHI_CHU_QUY_III = ip_arr[i].ip_str_GHI_CHU_QUY_III;
                    gd.GHI_CHU_QUY_IV = ip_arr[i].ip_str_GHI_CHU_QUY_IV;

                    gd.PHAN_BO_QUI_I = convertToDecimal(ip_arr[i].ip_str_PHAN_BO_QUY_I); ;
                    gd.PHAN_BO_QUY_II = convertToDecimal(ip_arr[i].ip_str_PHAN_BO_QUY_II); ;
                    gd.PHAN_BO_QUY_III = convertToDecimal(ip_arr[i].ip_str_PHAN_BO_QUY_III); ;
                    gd.PHAN_BO_QUY_IV = convertToDecimal(ip_arr[i].ip_str_PHAN_BO_QUY_IV); ;
                    gd.GHI_CHU_PHAN_BO_QUY_I = ip_arr[i].ip_str_GHI_CHU_PHAN_BO_QUY_I;
                    gd.GHI_CHU_PHAN_BO_QUY_II = ip_arr[i].ip_str_GHI_CHU_PHAN_BO_QUY_II;
                    gd.GHI_CHU_PHAN_BO_QUY_III = ip_arr[i].ip_str_GHI_CHU_PHAN_BO_QUY_III;
                    gd.GHI_CHU_PHAN_BO_QUY_IV = ip_arr[i].ip_str_GHI_CHU_PHAN_BO_QUY_IV;
                    db.SaveChanges();
                }
            }
            catch (Exception v_e)
            {
                Context.Response.Write(v_e.Message);
            }
        }
コード例 #15
0
        public void SaveItem(decimal ip_dc_id_quyet_dinh
            , decimal ip_dc_id_don_vi
            , decimal ip_dc_id_giao_dich
            , string ip_str_tt
            , string ip_str_hang_muc
            , string ip_str_kinh_phi_giao
            , string ip_str_KLTH_QUY_I
            , string ip_str_KLTH_QUY_II
            , string ip_str_KLTH_QUY_III
            , string ip_str_KLTH_QUY_IV
            , string ip_str_GHI_CHU_GIAO_KH
            , string ip_str_GHI_CHU_QUY_I
            , string ip_str_GHI_CHU_QUY_II
            , string ip_str_GHI_CHU_QUY_III
            , string ip_str_GHI_CHU_QUY_IV
            , string ip_str_PHAN_BO_QUI_I
            , string ip_str_PHAN_BO_QUY_II
            , string ip_str_PHAN_BO_QUY_III
            , string ip_str_PHAN_BO_QUY_IV
            , string ip_str_GHI_CHU_PHAN_BO_QUY_I
            , string ip_str_GHI_CHU_PHAN_BO_QUY_II
            , string ip_str_GHI_CHU_PHAN_BO_QUY_III
            , string ip_str_GHI_CHU_PHAN_BO_QUY_IV)
        {
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            var gd = db.GD_DU_TOAN_THU_CHI_PHI_PHA.First(x => x.ID == ip_dc_id_giao_dich);
            if (gd == null) return;
            gd.TT = ip_str_tt;
            gd.HANG_MUC = ip_str_hang_muc;
            gd.KINH_PHI_GIAO_KH = getMoney_number(ip_str_kinh_phi_giao.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_I = getMoney_number(ip_str_KLTH_QUY_I.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_II = getMoney_number(ip_str_KLTH_QUY_II.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_III = getMoney_number(ip_str_KLTH_QUY_III.Replace(",", "").Replace(".", ""));
            gd.KLTH_QUY_IV = getMoney_number(ip_str_KLTH_QUY_IV.Replace(",", "").Replace(".", ""));
            gd.GHI_CHU_GIAO_KH = ip_str_GHI_CHU_GIAO_KH;
            gd.GHI_CHU_QUY_I = ip_str_GHI_CHU_QUY_I;
            gd.GHI_CHU_QUY_II = ip_str_GHI_CHU_QUY_II;
            gd.GHI_CHU_QUY_III = ip_str_GHI_CHU_QUY_III;
            gd.GHI_CHU_QUY_IV = ip_str_GHI_CHU_QUY_IV;

            gd.PHAN_BO_QUI_I = getMoney_number(ip_str_PHAN_BO_QUI_I.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_II = getMoney_number(ip_str_PHAN_BO_QUY_II.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_III = getMoney_number(ip_str_PHAN_BO_QUY_III.Replace(",", "").Replace(".", "")); ;
            gd.PHAN_BO_QUY_IV = getMoney_number(ip_str_PHAN_BO_QUY_IV.Replace(",", "").Replace(".", "")); ;
            gd.GHI_CHU_PHAN_BO_QUY_I = ip_str_GHI_CHU_PHAN_BO_QUY_I;
            gd.GHI_CHU_PHAN_BO_QUY_II = ip_str_GHI_CHU_PHAN_BO_QUY_II;
            gd.GHI_CHU_PHAN_BO_QUY_III = ip_str_GHI_CHU_PHAN_BO_QUY_III;
            gd.GHI_CHU_PHAN_BO_QUY_IV = ip_str_GHI_CHU_PHAN_BO_QUY_IV;
            db.SaveChanges();
        }
コード例 #16
0
        public void genGrid(decimal ip_dc_id_don_vi, int ip_i_nam)
        {
            List<GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN> lst_pl02;
            List<QuyetToan.PL02_kinh_phi_su_dung_quyet_toan.ItemCLKM> lst_clkm;
            List<string> lst_NDC;
            lst_NDC = new List<string>();
            lst_NDC.Add("I. Kinh phí năm quyết toán năm nay:");
            lst_NDC.Add("II. KP năm trước chưa QT, quyết toán năm nay");
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            //load list Chuong loai khoan muc tieu muc
            lst_clkm = db
                       .DM_CHUONG_LOAI_KHOAN_MUC
                       .Select(x => new
                       QuanLyDuToan.QuyetToan.PL02_kinh_phi_su_dung_quyet_toan.ItemCLKM
                       {
                           MaSo = x.MA_SO
                           ,
                           Ten = x.TEN
                           ,
                           IdLoai = x.ID_LOAI
                           ,
                           MaSoParent = x.DM_CHUONG_LOAI_KHOAN_MUC_PARENT.MA_SO
                       })
                       .ToList();

            //Sao chep du lieu Muc, Tieu muc tu GD_GIAO_KH sang
            DateTime v_dat_dau_nam = new DateTime(ip_i_nam, 1, 1);
            DateTime v_dat_cuoi_nam = new DateTime(ip_i_nam + 1, 1, 1);
            var lst_gd_giao_kh = db.GD_CHI_TIET_GIAO_KH
                                    .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                        && x.DM_QUYET_DINH.NGAY_THANG >= v_dat_dau_nam
                                        && x.DM_QUYET_DINH.NGAY_THANG <= v_dat_cuoi_nam
                                        && x.ID_CHUONG != null)
                                    .ToList();
            lst_pl02 = db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN
                        .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.NAM == ip_i_nam)
                        .ToList();
            //Sao chep muc, tieu muc KHONG co trong PL02
            foreach (var kh in lst_gd_giao_kh)
            {
                if (!lst_pl02.Exists(x=>x.MA_KHOAN==kh.DM_CHUONG_LOAI_KHOAN_MUC_KHOAN.MA_SO
                    &&x.MA_MUC==kh.DM_CHUONG_LOAI_KHOAN_MUC_MUC.MA_SO
                    &&x.MA_TIEU_MUC==kh.DM_CHUONG_LOAI_KHOAN_MUC_TIEU_MUC.MA_SO))
                {
                    GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN gd = new GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN();
                    gd.ID_DON_VI = ip_dc_id_don_vi;
                    gd.LOAI = lst_NDC[0];
                    gd.MA_KHOAN = kh.DM_CHUONG_LOAI_KHOAN_MUC_KHOAN.MA_SO;
                    gd.MA_LOAI = kh.DM_CHUONG_LOAI_KHOAN_MUC_KHOAN.DM_CHUONG_LOAI_KHOAN_MUC_PARENT.MA_SO;
                    gd.MA_MUC = kh.DM_CHUONG_LOAI_KHOAN_MUC_MUC.MA_SO;
                    gd.MA_TIEU_MUC = kh.DM_CHUONG_LOAI_KHOAN_MUC_TIEU_MUC.MA_SO;
                    gd.NAM = ip_i_nam;
                    gd.SO_BAO_CAO = 0;
                    gd.SO_XET_DUYET = 0;
                    db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.Add(gd);
                    db.SaveChanges();
                    //reload list PL02
                    lst_pl02 = db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN
                        .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.NAM == ip_i_nam)
                        .ToList();
                }
            }
            //Xoa nhung muc, tieu muc KHONG co trong GD_GIAO_KH
            foreach (var pl02 in lst_pl02.Where(x => x.LOAI.Contains("I. Kinh phí năm quyết toán năm nay")).ToList())
            {
                if (!lst_gd_giao_kh.Exists(x=>x.DM_CHUONG_LOAI_KHOAN_MUC_KHOAN.MA_SO==pl02.MA_KHOAN
                    &&x.DM_CHUONG_LOAI_KHOAN_MUC_MUC.MA_SO==pl02.MA_MUC
                    &&x.DM_CHUONG_LOAI_KHOAN_MUC_TIEU_MUC.MA_SO==pl02.MA_TIEU_MUC))
                {
                    db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN.Remove(pl02);
                    db.SaveChanges();
                }
            }
            //reload list PL02
            lst_pl02 = db.GD_PL02_KINH_PHI_DA_SU_DUNG_DE_NGHI_QUYET_TOAN
                .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.NAM == ip_i_nam)
                .ToList();
            string v_str_grid = "";
            v_str_grid = UserControls.QT_QBT_GRID_PL02.RenderToString(lst_pl02, lst_NDC, lst_clkm);
            Context.Response.Output.Write(v_str_grid);
        }
コード例 #17
0
        public void UpdateGiaoDich(
            decimal ip_dc_ID
            , decimal ip_dc_ID_QUYET_DINH
            , decimal ip_dc_ID_DON_VI
            , string ip_str_CONG_TRINH
            , decimal ip_dc_TONG_MUC_DAU_TU
            , decimal ip_dc_THOI_GIAN_THUC_HIEN
            , decimal ip_dc_SO_TIEN_QUY_BT
            , decimal ip_dc_SO_TIEN_NS
            , decimal ip_dc_ID_CHUONG
            , decimal ip_dc_ID_KHOAN
            , decimal ip_dc_ID_MUC
            , string ip_str_GHI_CHU
            , decimal ip_dc_ID_TIEU_MUC
            , decimal ip_dc_SO_TIEN_NAM_TRUOC_CHUYEN_SANG_QBT
            , decimal ip_dc_SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS
            , decimal ip_dc_ID_LOAI_NHIEM_VU
            , string ip_str_DU_AN
            , string ip_str_TU_CHU_YN
            , string ip_str_GHI_CHU_1
            , string ip_str_GHI_CHU_2
            , string ip_str_GHI_CHU_3
            , string ip_str_GHI_CHU_4
            )
        {
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            GD_CHI_TIET_GIAO_KH gd;
            if (ip_dc_ID == -1)
            {
                gd = new GD_CHI_TIET_GIAO_KH();
            }
            else
                gd = db.GD_CHI_TIET_GIAO_KH.FirstOrDefault(x => x.ID == ip_dc_ID);
            if (gd == null) return;
            gd.ID_QUYET_DINH = ip_dc_ID_QUYET_DINH;
            gd.ID_DON_VI = ip_dc_ID_DON_VI;
            gd.SO_TIEN_QUY_BT = ip_dc_SO_TIEN_QUY_BT;
            gd.SO_TIEN_NS = ip_dc_SO_TIEN_NS;
            gd.TONG_MUC_DAU_TU = ip_dc_TONG_MUC_DAU_TU;
            gd.THOI_GIAN_THUC_HIEN = ip_dc_THOI_GIAN_THUC_HIEN;
            if (ip_dc_ID_CHUONG == -1) gd.ID_CHUONG = null;
            else gd.ID_CHUONG = ip_dc_ID_CHUONG;
            if (ip_dc_ID_KHOAN == -1) gd.ID_KHOAN = null;
            else gd.ID_KHOAN = ip_dc_ID_KHOAN;
            if (ip_dc_ID_MUC == -1) gd.ID_MUC = null;
            else gd.ID_MUC = ip_dc_ID_MUC;
            gd.GHI_CHU = ip_str_GHI_CHU.Equals("-1") ? null : ip_str_GHI_CHU;
            if (ip_dc_ID_TIEU_MUC == -1) gd.ID_TIEU_MUC = null;
            else gd.ID_TIEU_MUC = ip_dc_ID_TIEU_MUC;
            gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG = ip_dc_SO_TIEN_NAM_TRUOC_CHUYEN_SANG_QBT;
            gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS = ip_dc_SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS;
            gd.ID_LOAI_NHIEM_VU = ip_dc_ID_LOAI_NHIEM_VU;

            if (!ip_str_CONG_TRINH.Trim().Equals(""))
            {
                //Xu ly du lieu, lay id cong trinh, id du an
                DM_CONG_TRINH_DU_AN_GOI_THAU v_cong_trinh = db.DM_CONG_TRINH_DU_AN_GOI_THAU
                    .FirstOrDefault(x => x.TEN.Trim() == ip_str_CONG_TRINH.Trim());
                //&& x.DM_CONG_TRINH_DU_AN_GOI_THAU_CHILDREN.Where(y => y.TEN == ip_str_DU_AN
                //).Count() > 0)
                ;

                //Neu cong trinh khong co trong csdl thi insert vao
                if (v_cong_trinh == null)
                {
                    v_cong_trinh = new DM_CONG_TRINH_DU_AN_GOI_THAU();
                    v_cong_trinh.ID_DON_VI = ip_dc_ID_DON_VI;
                    v_cong_trinh.ID_LOAI = WebUS.ID_LOAI_CONG_TRINH_DU_AN_GOI_THAU.CONG_TRINH;
                    v_cong_trinh.TEN = ip_str_CONG_TRINH;
                    db.DM_CONG_TRINH_DU_AN_GOI_THAU.Add(v_cong_trinh);
                    db.SaveChanges();
                    v_cong_trinh = db.DM_CONG_TRINH_DU_AN_GOI_THAU.FirstOrDefault(x => x.TEN.Trim() == ip_str_CONG_TRINH.Trim());
                }
                DM_CONG_TRINH_DU_AN_GOI_THAU v_du_an = db.DM_CONG_TRINH_DU_AN_GOI_THAU
                    .FirstOrDefault(x => x.TEN.Trim() == ip_str_DU_AN.Trim()
                        && x.ID_CHA == v_cong_trinh.ID
                        );
                if (v_du_an == null)
                {
                    v_du_an = new DM_CONG_TRINH_DU_AN_GOI_THAU();
                    v_du_an.ID_CHA = v_cong_trinh.ID;
                    v_du_an.TEN = ip_str_DU_AN;
                    v_du_an.ID_LOAI = WebUS.ID_LOAI_CONG_TRINH_DU_AN_GOI_THAU.DU_AN;
                    db.DM_CONG_TRINH_DU_AN_GOI_THAU.Add(v_du_an);
                    db.SaveChanges();
                    v_du_an = db.DM_CONG_TRINH_DU_AN_GOI_THAU.FirstOrDefault(x => x.TEN.Trim() == ip_str_DU_AN.Trim());
                }
                gd.ID_CONG_TRINH = v_cong_trinh.ID;
                gd.ID_DU_AN = v_du_an.ID;
                gd.TU_CHU_YN = (ip_str_TU_CHU_YN.Equals("-1") ? null : ip_str_TU_CHU_YN);
                gd.GHI_CHU_1 = (ip_str_GHI_CHU_1.Equals("-1") ? null : ip_str_GHI_CHU_1);
                //Xu ly du lieu so KM
                decimal v_so_km = 0;
                decimal.TryParse(ip_str_GHI_CHU_2.Replace(",", ""), out v_so_km);
                gd.GHI_CHU_2 = v_so_km.ToString();

                gd.GHI_CHU_3 = (ip_str_GHI_CHU_3.Equals("-1") ? null : ip_str_GHI_CHU_3);
                gd.GHI_CHU_4 = (ip_str_GHI_CHU_4.Equals("-1") ? null : ip_str_GHI_CHU_4);
                if (ip_dc_ID == -1)
                {
                    db.GD_CHI_TIET_GIAO_KH.Add(gd);
                }
                db.SaveChanges();
            }
        }
コード例 #18
0
        public List<GD_CHI_TIET_GIAO_KH> InsertDataDuToanToQuyetToan(decimal ip_dc_id_don_vi, decimal ip_dc_nam_quyet_toan)
        {
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            DateTime v_dat_dau_nam = new DateTime(Int16.Parse(ip_dc_nam_quyet_toan.ToString()), 1, 1);
            DateTime v_dat_cuoi_nam = CCommonFunction.getDate_cuoi_nam_form_date(v_dat_dau_nam);
            var lst_giao_kh = db.GD_CHI_TIET_GIAO_KH
                                        .Where(x => x.DM_QUYET_DINH.NGAY_THANG >= v_dat_dau_nam
                                                    && x.DM_QUYET_DINH.NGAY_THANG <= v_dat_cuoi_nam
                                                    && x.ID_DON_VI == ip_dc_id_don_vi
                                                    && x.ID_CHUONG == null)
                                        .ToList();
            List<GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN> lst_pl04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                        .Where(x => x.NAM == ip_dc_nam_quyet_toan
                                            && x.ID_DON_VI == ip_dc_id_don_vi)
                                        .ToList();

            //Insert gd_pl04 từ gd_chi_tiet_giao
            foreach (var gd_giao_kh in lst_giao_kh)
            {
                if (lst_pl04
                    .Where(x => x.TEN_LOAI_NHIEM_VU.Trim().ToUpper() == gd_giao_kh.CM_DM_TU_DIEN_LOAI_NHIEM_VU.TEN.Trim().ToUpper()
                            && x.CONG_TRINH.Trim().ToUpper() == gd_giao_kh.DM_CONG_TRINH_DU_AN_GOI_THAU_CONG_TRINH.TEN.Trim().ToUpper()
                            && x.DU_AN.Trim().ToUpper() == gd_giao_kh.DM_CONG_TRINH_DU_AN_GOI_THAU_DU_AN.TEN.Trim().ToUpper()
                            )
                    .Count() < 1
                    )
                {
                    GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN gd = new GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN();
                    gd.CONG_TRINH = gd_giao_kh.DM_CONG_TRINH_DU_AN_GOI_THAU_CONG_TRINH.TEN.Trim();
                    gd.TEN_LOAI_NHIEM_VU = gd_giao_kh.CM_DM_TU_DIEN_LOAI_NHIEM_VU.TEN.Trim();
                    gd.DU_AN = gd_giao_kh.DM_CONG_TRINH_DU_AN_GOI_THAU_DU_AN.TEN.Trim();
                    gd.ID_DON_VI = ip_dc_id_don_vi;
                    gd.NAM = ip_dc_nam_quyet_toan;
                    gd.TT = gd_giao_kh.CM_DM_TU_DIEN_LOAI_NHIEM_VU.GHI_CHU.ToUpper();
                    gd.GIA_TRI_CTHT_DA_QUYET_TOAN_LK_DEN_NAM_BAO_CAO = 0;
                    gd.GIA_TRI_CTHT_NAM_NAY = 0;
                    gd.GIA_TRI_CTHT_NAM_TRUOC_CON_NO_CHUYEN_NAM_NAY = 0;
                    gd.GIA_TRI_DE_NGHI_QUYET_TOAN_TRONG_NAM = 0;
                    gd.GIA_TRI_DU_TOAN_CONG_TRINH_DUOC_DUYET = 0;
                    db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN.Add(gd);
                    db.SaveChanges();

                    //refress list gd_pl04
                    lst_pl04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                        .Where(x => x.NAM == ip_dc_nam_quyet_toan
                                            && x.ID_DON_VI == ip_dc_id_don_vi)
                                        .ToList();
                }
            }

            //Xoá gd_pl04 nếu không có trong gd_chi_tiet_giao_kh
            foreach (var gd_pl04 in lst_pl04)
            {
                if (lst_giao_kh
                    .Where(x => x.CM_DM_TU_DIEN_LOAI_NHIEM_VU.TEN.Trim().ToUpper() == gd_pl04.TEN_LOAI_NHIEM_VU.Trim().ToUpper()
                            && x.DM_CONG_TRINH_DU_AN_GOI_THAU_CONG_TRINH.TEN.Trim().ToUpper() == gd_pl04.CONG_TRINH.Trim().ToUpper()
                            && x.DM_CONG_TRINH_DU_AN_GOI_THAU_DU_AN.TEN.Trim().ToUpper() == gd_pl04.DU_AN.Trim().ToUpper()
                            )
                    .Count() < 1
                    )
                {
                    db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN.Remove(gd_pl04);
                    db.SaveChanges();
                }
            }

            return db.GD_CHI_TIET_GIAO_KH
                                        .Where(x => x.DM_QUYET_DINH.NGAY_THANG >= v_dat_dau_nam
                                                    && x.DM_QUYET_DINH.NGAY_THANG <= v_dat_cuoi_nam
                                                    && x.ID_DON_VI == ip_dc_id_don_vi
                                                    && x.ID_CHUONG == null)
                                        .ToList();
        }
コード例 #19
0
        public void CopyItemFromQuyetDinh(
            decimal ip_dc_id_don_vi
            , decimal ip_dc_id_quyet_dinh_1
            , decimal ip_dc_id_quyet_dinh_2)
        {
            /*Copy Cong trinh/Du an (Khoan/Muc, Tieu muc) tu 'Quyet dinh 1' sang 'Quyet dinh 2'*/
            BKI_QLDTEntities db = new BKI_QLDTEntities();
            var lst_gd_qd_1 = db.GD_CHI_TIET_GIAO_KH
                                .Where(x => x.ID_QUYET_DINH == ip_dc_id_quyet_dinh_1
                                    && x.ID_DON_VI == ip_dc_id_don_vi)
                                .ToList();
            var lst_gd_qd_2 = db.GD_CHI_TIET_GIAO_KH
                                .Where(x => x.ID_QUYET_DINH == ip_dc_id_quyet_dinh_2
                                    && x.ID_DON_VI == ip_dc_id_don_vi)
                                .ToList();
            //Duyet tung du an, muc-tieu muc cua Quyet dinh 1
            foreach (var gd_qd1 in lst_gd_qd_1)
            {
                //Neu la cong trinh
                if (gd_qd1.ID_CONG_TRINH != null)
                {
                    //Kiem tra xem da co trong Giao Ke hoach cua Quyet dinh 2 chua
                    if (lst_gd_qd_2.Where(x => x.ID_CONG_TRINH == gd_qd1.ID_CONG_TRINH
                                            && x.ID_DU_AN == gd_qd1.ID_DU_AN
                                            && x.ID_LOAI_NHIEM_VU == gd_qd1.ID_LOAI_NHIEM_VU)
                                            .ToList()
                                            .Count == 0)
                    //Neu chua co thi them vao Giao Ke hoach voi so tien NS, QBT, NTCS =0
                    {
                        GD_CHI_TIET_GIAO_KH v_gd = new GD_CHI_TIET_GIAO_KH();
                        v_gd.ID_DON_VI = ip_dc_id_don_vi;
                        v_gd.ID_QUYET_DINH = ip_dc_id_quyet_dinh_2;
                        v_gd.ID_LOAI_NHIEM_VU = gd_qd1.ID_LOAI_NHIEM_VU;
                        v_gd.ID_CONG_TRINH = gd_qd1.ID_CONG_TRINH;
                        v_gd.ID_DU_AN = gd_qd1.ID_DU_AN;
                        //so km
                        v_gd.GHI_CHU_2 = gd_qd1.GHI_CHU_2;

                        v_gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG = 0;
                        v_gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS = 0;
                        v_gd.SO_TIEN_NS = 0;
                        v_gd.SO_TIEN_QUY_BT = 0;
                        v_gd.TONG_MUC_DAU_TU = 0;
                        v_gd.THOI_GIAN_THUC_HIEN = 0;
                        db.GD_CHI_TIET_GIAO_KH.Add(v_gd);
                        db.SaveChanges();
                        lst_gd_qd_2 = db.GD_CHI_TIET_GIAO_KH
                                .Where(x => x.ID_QUYET_DINH == ip_dc_id_quyet_dinh_2
                                    && x.ID_DON_VI == ip_dc_id_don_vi)
                                .ToList();
                    }
                    //Neu da co roi thi bo qua
                    else
                    {
                    }
                }
                //Neu la muc-tieu muc
                else
                {
                    //Kiem tra xem da co trong Giao Ke hoach cua Quyet dinh 2 chua
                    if (lst_gd_qd_2.Where(x => x.ID_KHOAN == gd_qd1.ID_KHOAN
                                            && x.ID_MUC == gd_qd1.ID_MUC
                                            && x.ID_TIEU_MUC == gd_qd1.ID_TIEU_MUC
                                            && x.ID_LOAI_NHIEM_VU == gd_qd1.ID_LOAI_NHIEM_VU)
                                            .ToList()
                                            .Count == 0)
                    //Neu chua co thi them vao Giao Ke hoach voi so tien NS, QBT, NTCS =0
                    {
                        GD_CHI_TIET_GIAO_KH v_gd = new GD_CHI_TIET_GIAO_KH();
                        v_gd.ID_DON_VI = ip_dc_id_don_vi;
                        v_gd.ID_QUYET_DINH = ip_dc_id_quyet_dinh_2;
                        v_gd.ID_LOAI_NHIEM_VU = gd_qd1.ID_LOAI_NHIEM_VU;
                        v_gd.ID_KHOAN = gd_qd1.ID_KHOAN;
                        v_gd.ID_MUC = gd_qd1.ID_MUC;
                        v_gd.ID_TIEU_MUC = gd_qd1.ID_TIEU_MUC;

                        //noi dung du toan
                        v_gd.GHI_CHU_1 = gd_qd1.GHI_CHU_1;

                        v_gd.TU_CHU_YN = gd_qd1.TU_CHU_YN;
                        v_gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG = 0;
                        v_gd.SO_TIEN_NAM_TRUOC_CHUYEN_SANG_NS = 0;
                        v_gd.SO_TIEN_NS = 0;
                        v_gd.SO_TIEN_QUY_BT = 0;
                        v_gd.TONG_MUC_DAU_TU = 0;
                        v_gd.THOI_GIAN_THUC_HIEN = 0;
                        db.GD_CHI_TIET_GIAO_KH.Add(v_gd);
                        db.SaveChanges();
                        lst_gd_qd_2 = db.GD_CHI_TIET_GIAO_KH
                                .Where(x => x.ID_QUYET_DINH == ip_dc_id_quyet_dinh_2
                                    && x.ID_DON_VI == ip_dc_id_don_vi)
                                .ToList();
                    }
                    //Neu da co roi thi bo qua
                    else
                    {
                    }
                }

            }
        }