// Hiển thị toàn bộ các thanh toán của đợt thanh toán này
 private void load_data_2_grid(string ip_str_ma_dot_tt)
 {
     if (ip_str_ma_dot_tt == "")
     {
         m_lbl_thong_bao1.Visible = true;
         m_lbl_thong_bao1.Text    = "Chưa có đợt thanh toán nào đã thanh toán xong";
         return;
     }
     else
     {
         US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
         DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
         // Hiển thị toàn bộ các thanh toán trong đợt thanh toán đang chọn
         v_us_gd_thanh_toan.f501_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt(ip_str_ma_dot_tt, 0, v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));
         //v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = N'" + ip_str_ma_dot_tt+"' ORDER BY ID");
         if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
         {
             m_lbl_thong_bao1.Visible = true;
             m_lbl_thong_bao1.Text    = "Chưa có Thanh toán nào ứng với Đợt thanh toán này";
         }
         m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
         m_grv_danh_sach_du_toan.DataBind();
         m_lbl_loc_du_lieu.Text = "Danh sách thanh toán trong đợt này: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " thanh toán";
         if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count > 0)
         {
             m_grv_danh_sach_du_toan.Columns[0].Visible = false;
         }
     }
 }
Esempio n. 2
0
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, string ip_str_so_hd)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
        decimal            v_dc_id_hdong      = get_id_by_so_hop_dong(ip_str_so_hd);

        if (v_dc_id_hdong == 0)
        {
            m_lbl_thong_bao.Visible         = true;
            m_lbl_thong_bao.Text            = "Không có thanh toán nào phù hợp";
            m_grv_danh_sach_du_toan.Visible = false;
            return;
        }
        v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "' AND ID_HOP_DONG_KHUNG = " + v_dc_id_hdong);
        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        else
        {
            m_grv_danh_sach_du_toan.Visible = true;
        }
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
    }
    // Hàm này kiểm tra
    // - Lớp môn có ứng với hợp đồng không?
    private void kiem_tra_toan_bo_thanh_toan_ung_hop_dong(decimal ip_dc_id_hop_dong_khung, string ip_str_ma_lop_mon)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        // lấy toàn bộ thanh toán của hợp đồng theo id_hop_dong
        v_us_v_gd_tt.FillDataset(v_ds_v_gd_tt, " WHERE ID_HOP_DONG_KHUNG=" + ip_dc_id_hop_dong_khung + " ORDER BY ID");
        // Nếu đã có thanh toán
        if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            // kiểm tra xem đã thanh lý chưa
            // Sử dụng dòng cuối cùng, ứng với thanh toán cuối cùng của hd này
            // Nếu đã thanh lý, reference_code là null
            if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE].GetType() == typeof(DBNull))
            {
                string someScript;
                someScript = "<script language='javascript'>{ alert('Hợp đồng này đã được thanh lý!'); window.close(); }</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "oncheck", someScript);
                return;
            }
            // Nếu ko phải thanh lý mà là tạm ứng, kiểm tra số lần tạm ứng
            else
            {
                decimal v_dc_so_tien_da_tt   = 0;
                string  v_str_so_lan_tam_ung = cut_end_string(CIPConvert.ToStr(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE]));
                v_dc_so_tien_da_tt  += CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.DA_THANH_TOAN]) + CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.TONG_TIEN_THANH_TOAN]);
                m_lbl_thong_bao.Text = "Hợp đồng này đã được tạm ứng " + v_str_so_lan_tam_ung + " lần. Số tiền đã thanh toán là: " + CIPConvert.ToStr(v_dc_so_tien_da_tt, "#,###");
            }
        }
        // Nếu số dòng ==0 nghĩa là chưa có thanh toán nào, ko thực hiện gì
    }
 private void load_data_2_grid(string ip_str_ma_dot_tt)
 {
     if (ip_str_ma_dot_tt == "")
     {
         m_lbl_thong_bao.Visible = true;
         m_lbl_thong_bao.Text    = "Chưa tạo Đợt thanh toán";
         return;
     }
     else
     {
         US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
         DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
         // Số phiếu thanh toán là mã đợt thanh toán
         v_us_gd_thanh_toan.f410_load_data_2_grid(ip_str_ma_dot_tt, CIPConvert.ToDecimal(lblUser.ToolTip), CIPConvert.ToDecimal(m_lbl_thong_bao0.ToolTip), v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));
         //v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = N'" + ip_str_ma_dot_tt + "' AND (ID_TRANG_THAI_THANH_TOAN = " + lblUser.ToolTip + " OR ID_TRANG_THAI_THANH_TOAN = " + m_lbl_thong_bao0.ToolTip + ") ORDER BY ID");
         if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
         {
             m_lbl_thong_bao.Visible = true;
             m_lbl_thong_bao.Text    = "Chưa có Thanh toán nào ứng với Đợt thanh toán này";
         }
         m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
         m_grv_danh_sach_du_toan.DataBind();
         m_lbl_danh_sach_thanh_toan.Text = "Danh sách thanh toán: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " thanh toán";
     }
 }
Esempio n. 5
0
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, string ip_str_so_hd)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        //decimal v_dc_id_hdong = get_id_by_so_hop_dong(ip_str_so_hd);
        //if (v_dc_id_hdong == 0)
        //{
        //    m_lbl_thong_bao.Visible = true;
        //    m_lbl_thong_bao.Text = "Không có thanh toán nào phù hợp";
        //    m_grv_danh_sach_du_toan.Visible = false;
        //    return;
        //}
        v_us_gd_thanh_toan.f403_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_like_so_hd(ip_str_ma_dot_tt, CIPConvert.ToDecimal(lblUser.ToolTip), ip_str_so_hd, v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));
        //v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "' AND SO_HOP_DONG LIKE N'%" + ip_str_so_hd + "%' AND ID_TRANG_THAI_THANH_TOAN = " + CIPConvert.ToDecimal(lblUser.ToolTip) + " ORDER BY ID");
        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        else
        {
            m_grv_danh_sach_du_toan.Visible = true;
        }
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
        lbl_danh_sach_chung_tu.Text = "Danh sách các chứng từ: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " chứng từ";
    }
Esempio n. 6
0
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, string ip_str_so_hd, decimal ip_dc_id_trang_thai_tt)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
        decimal            v_dc_id_hdong      = get_id_by_so_hop_dong(ip_str_so_hd);

        if (v_dc_id_hdong == 0)
        {
            m_lbl_thong_bao.Visible         = true;
            m_lbl_thong_bao.Text            = "Không có thanh toán nào phù hợp";
            m_grv_danh_sach_du_toan.Visible = false;
            return;
        }

        v_us_gd_thanh_toan.f403_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_id_hd_khung(ip_str_ma_dot_tt, ip_dc_id_trang_thai_tt, v_dc_id_hdong, v_ds_gd_thanh_toan);

        //// Nếu ko search theo trạng thái thanh toán
        //if (ip_dc_id_trang_thai_tt == 0)
        //    v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "' AND ID_HOP_DONG_KHUNG = " + v_dc_id_hdong);
        //else
        //    // Số phiếu thanh toán là mã đợt thanh toán
        //    v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "' AND ID_HOP_DONG_KHUNG = " + v_dc_id_hdong + " AND ID_TRANG_THAI_THANH_TOAN = " + ip_dc_id_trang_thai_tt);

        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        m_grv_danh_sach_du_toan.Visible    = true;
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
    }
    private int get_the_number_of_payments_by_dot_tt(string ip_str_ma_dot_tt)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        v_us_v_gd_tt.FillDataset(v_ds_v_gd_tt, " WHERE SO_PHIEU_THANH_TOAN='" + ip_str_ma_dot_tt + "'");
        return(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count);
    }
    private decimal get_so_tien_da_tt(decimal ip_dc_id_so_hd)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        v_us_v_gd_tt.FillDataset(v_ds_v_gd_tt, " WHERE ID_HOP_DONG_KHUNG =" + ip_dc_id_so_hd);
        return(CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[0][V_GD_THANH_TOAN.DA_THANH_TOAN]));
    }
        public void fill_dataset_by_so_hop_dong(string ip_str_loai_hop_dong,
                                                string ip_str_so_hop_dong,
                                                DS_V_GD_THANH_TOAN ip_ds_gd_thanh_toan, string ip_str_po)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanBySoHopDong");

            v_cstore.addNVarcharInputParam("@LOAI_HOP_DONG", ip_str_loai_hop_dong);
            v_cstore.addNVarcharInputParam("@SO_HOP_DONG", ip_str_so_hop_dong);
            v_cstore.addNVarcharInputParam("@USER_NAME", ip_str_po);
            v_cstore.fillDataSetByCommand(this, ip_ds_gd_thanh_toan);
        }
        public decimal get_so_tien_da_thanh_toan(DS_V_GD_THANH_TOAN op_v_ds_gd_tt)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_Tinh_So_Tien_Da_Thanh_Toan");

            v_cstore.addDecimalInputParam("@ID_HOP_DONG_KHUNG", this.dcID_HOP_DONG_KHUNG);
            v_cstore.fillDataSetByCommand(this, op_v_ds_gd_tt);
            if (op_v_ds_gd_tt.V_GD_THANH_TOAN.Rows[0][0] == null)
            {
                return(0);
            }
            return(CIPConvert.ToDecimal(op_v_ds_gd_tt.V_GD_THANH_TOAN.Rows[0][0]));
        }
        // LinhDH 10/08/2012
        public void f410_load_data_2_grid(string ip_str_ma_dot_tt,
                                          decimal ip_dc_trang_thai_tt1, decimal ip_dc_trang_thai_tt2,
                                          DS_V_GD_THANH_TOAN op_ds_v_gd_thanh_toan,
                                          string ip_str_po)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_410_load_data_2_grid");

            v_cstore.addNVarcharInputParam("@MA_DOT_TT", ip_str_ma_dot_tt);
            v_cstore.addDecimalInputParam("@ID_TRANG_THAI_TT1", ip_dc_trang_thai_tt1);
            v_cstore.addNVarcharInputParam("@ID_TRANG_THAI_TT2", ip_dc_trang_thai_tt2);
            v_cstore.addNVarcharInputParam("@USER_NAME", ip_str_po);
            v_cstore.fillDataSetByCommand(this, op_ds_v_gd_thanh_toan);
        }
        public US_V_GD_THANH_TOAN(decimal i_dbID)
        {
            pm_objDS        = new DS_V_GD_THANH_TOAN();
            pm_strTableName = c_TableName;
            IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);

            v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
            SqlCommand v_cmdSQL;

            v_cmdSQL = v_objMkCmd.getSelectCmd();
            this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
            pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
        }
        // LinhDH 09/05/2012
        public void f412_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_loai_hd(string ip_str_ma_dot_tt,
                                                                                  decimal ip_dc_trang_thai_tt, string ip_str_loai_hd,
                                                                                  DS_V_GD_THANH_TOAN op_ds_v_gd_thanh_toan,
                                                                                  string ip_str_po)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanByDotThanhToan_TrangThaiTT_va_loai_hd");

            v_cstore.addNVarcharInputParam("@MA_DOT_TT", ip_str_ma_dot_tt);
            v_cstore.addDecimalInputParam("@ID_TRANG_THAI_TT", ip_dc_trang_thai_tt);
            v_cstore.addNVarcharInputParam("@LOAI_HOP_DONG", ip_str_loai_hd);
            v_cstore.addNVarcharInputParam("@USER_NAME", ip_str_po);
            v_cstore.fillDataSetByCommand(this, op_ds_v_gd_thanh_toan);
        }
        public void fill_dataset_by_po_phu_trach_va_thoi_gian(string ip_str_po_phu_trach,
                                                              string ip_str_loai_hop_dong,
                                                              decimal ip_dc_thang_tt,
                                                              decimal ip_dc_nam_tt,
                                                              DS_V_GD_THANH_TOAN ip_ds_gd_thanh_toan)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanByPOPhuTrachvaThoiGian");

            v_cstore.addNVarcharInputParam("@PO_PHU_TRACH", ip_str_po_phu_trach);
            v_cstore.addDecimalInputParam("@THANG_TT", ip_dc_thang_tt);
            v_cstore.addDecimalInputParam("@NAM_TT", ip_dc_nam_tt);
            v_cstore.addNVarcharInputParam("@LOAI_HOP_DONG", ip_str_loai_hop_dong);
            v_cstore.fillDataSetByCommand(this, ip_ds_gd_thanh_toan);
        }
        public void fill_dataset_by_dot_tt_va_loai_hd(string ip_str_ma_dot, string ip_str_loai_hd,
                                                      decimal ip_dc_thang_tt, decimal ip_dc_nam_tt,
                                                      decimal ip_dc_dv_thanh_toan, DS_V_GD_THANH_TOAN ip_ds_gd_thanh_toan, string ip_str_po)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanByDotAndLoaiHD");

            v_cstore.addNVarcharInputParam("@MA_DOT_TT", ip_str_ma_dot);
            v_cstore.addNVarcharInputParam("@LOAI_HOP_DONG", ip_str_loai_hd);
            v_cstore.addDecimalInputParam("@THANG_TT", ip_dc_thang_tt);
            v_cstore.addDecimalInputParam("@NAM_TT", ip_dc_nam_tt);
            v_cstore.addDecimalInputParam("@ID_DON_VI_TT", ip_dc_dv_thanh_toan);
            v_cstore.addNVarcharInputParam("@USER_NAME", ip_str_po);
            v_cstore.fillDataSetByCommand(this, ip_ds_gd_thanh_toan);
        }
    /// <summary>
    /// Hàm này kiểm tra trạng thái các thanh toán trong đợt thanh tóan (có cho đóng đợt thanh toán ko???). Cho đóng đợt thanh toán khi:
    /// + Khi tất cả các thanh toán có trong đợt đã ở trạng thái 5_DA_CO_XAC_NHAN_CUA_GIANG_VIEN
    /// + không có thanh toán nào của đợt này trong KHO có trạng thái: 3B_NGAN_HANG_CHUYEN_KHOAN_KHONG_THANH_CONG
    /// </summary>
    /// <param name="ip_str_ma_dot_tt">Mã của đợt thanh toán cần kiểm tra</param>
    private bool check_trang_thai_cac_thanh_toan_cua_dot_tt(string ip_str_ma_dot_tt)
    {
        // Check trạng thái các thanh toán trong đợt thanh toán
        US_V_GD_THANH_TOAN v_us_v_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        // Load các thanh toán có trạng thái khác với đã có xác nhận giảng viên
        v_us_v_gd_thanh_toan.FillDataset(v_ds_v_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN =N'" + ip_str_ma_dot_tt + "' AND ID_TRANG_THAI_THANH_TOAN <> " + hdf_id_trang_thai_da_co_xac_nhan_gv.Value + " ORDER BY ID");
        if (v_ds_v_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            return(false);
        }
        return(true);
    }
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, string ip_str_so_hd, decimal ip_dc_id_trang_thai_tt)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        v_us_gd_thanh_toan.f403_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_like_so_hd(ip_str_ma_dot_tt, ip_dc_id_trang_thai_tt, m_txt_so_hd_search.Text.Trim(), v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));
        //v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "' AND SO_HOP_DONG like N'%" + m_txt_so_hd_search.Text.Trim()+"%' AND ID_TRANG_THAI_THANH_TOAN = " + ip_dc_id_trang_thai_tt);

        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        m_grv_danh_sach_du_toan.Visible    = true;
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
        m_lbl_danh_sach_chung_tu_ton_dong.Text = "Danh sách các chứng từ tồn đọng: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " chứng từ";
    }
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, decimal ip_dc_id_trang_thai_tt)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        // Nếu ko search theo trạng thái thanh toán
        v_us_gd_thanh_toan.f409_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_gvien_so_hd(ip_str_ma_dot_tt, ip_dc_id_trang_thai_tt, CIPConvert.ToDecimal(m_cbo_ten_giang_vien.SelectedValue)
                                                                                             , CIPConvert.ToDecimal(m_txt_so_hd_search.SelectedValue), v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));

        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        m_grv_danh_sach_du_toan.Visible    = true;
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
    }
    private int get_so_lan_tam_ung(decimal ip_dc_id_hd_khung)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        // lấy toàn bộ thanh toán của hợp đồng theo id_hop_dong
        v_us_v_gd_tt.f601_load_thanh_toan_theo_hop_dong_de_kiem_tra(ip_dc_id_hd_khung, v_ds_v_gd_tt);
        string v_str_so_lan_tam_ung;

        // Nếu đã có thanh toán
        if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            v_str_so_lan_tam_ung = cut_end_string(CIPConvert.ToStr(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE]));
            return(int.Parse(v_str_so_lan_tam_ung));
        }
        // Nếu chưa có thanh toán nào --> chưa có tạm ứng
        return(0);
    }
    private void load_data_2_grid_search(string ip_str_ma_dot_tt, string ip_str_so_hd)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        v_us_gd_thanh_toan.f403_load_thanh_toan_by_ma_dot_tt_va_trang_thai_tt_va_like_so_hd(ip_str_ma_dot_tt, 0, ip_str_so_hd, v_ds_gd_thanh_toan, CIPConvert.ToStr(Session["UserName"]));
        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Visible = true;
            m_lbl_thong_bao.Text    = "Không có thanh toán nào phù hợp";
        }
        else
        {
            m_grv_danh_sach_du_toan.Visible = true;
            m_lbl_danh_sach_thanh_toan.Text = "Danh sách thanh toán: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " thanh toán";
        }
        m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_danh_sach_du_toan.DataBind();
    }
    private decimal get_so_tien_da_thanh_toan(decimal ip_dc_id_hop_dong_khung)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        // lấy toàn bộ thanh toán của hợp đồng theo id_hop_dong
        v_us_v_gd_tt.f601_load_thanh_toan_theo_hop_dong_de_kiem_tra(ip_dc_id_hop_dong_khung, v_ds_v_gd_tt);
        // Nếu đã có thanh toán
        if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            decimal v_dc_so_tien_da_tt = 0;
            //string v_str_so_lan_tam_ung = cut_end_string(CIPConvert.ToStr(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE]));
            v_dc_so_tien_da_tt += CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.DA_THANH_TOAN]) + CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.TONG_TIEN_THANH_TOAN]);
            return(v_dc_so_tien_da_tt);
        }
        else
        {
            return(0);
        }
    }
    // Kiểm tra hợp đồng đã được thanh lý chưa?
    private bool check_thanh_ly(decimal ip_dc_id_hop_dong_khung)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        // lấy toàn bộ thanh toán của hợp đồng theo id_hop_dong
        v_us_v_gd_tt.FillDataset(v_ds_v_gd_tt, " WHERE ID_HOP_DONG_KHUNG=" + ip_dc_id_hop_dong_khung + " ORDER BY ID");
        // Nếu đã có thanh toán
        if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            // kiểm tra xem đã thanh lý chưa
            // Sử dụng dòng cuối cùng, ứng với thanh toán cuối cùng của hd này
            // Nếu đã thanh lý, reference_code là null
            if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE].GetType() == typeof(DBNull))
            {
                return(false);    // Nghĩa là đã được thanh lý
            }
        }
        return(true);    // Chưa đc thanh lý
    }
    private decimal get_so_tien_da_thanh_toan_update(decimal ip_dc_id_hop_dong_khung)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_tt = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_v_gd_tt = new DS_V_GD_THANH_TOAN();

        // lấy toàn bộ thanh toán của hợp đồng theo id_hop_dong
        v_us_v_gd_tt.FillDataset(v_ds_v_gd_tt, " WHERE ID_HOP_DONG_KHUNG=" + ip_dc_id_hop_dong_khung + " ORDER BY ID");
        // Nếu đã có thanh toán
        if (v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            decimal v_dc_so_tien_da_tt = 0;
            //string v_str_so_lan_tam_ung = cut_end_string(CIPConvert.ToStr(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.REFERENCE_CODE]));
            v_dc_so_tien_da_tt += CIPConvert.ToDecimal(v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows[v_ds_v_gd_tt.V_GD_THANH_TOAN.Rows.Count - 1][V_GD_THANH_TOAN.DA_THANH_TOAN]);
            return(v_dc_so_tien_da_tt);
        }
        else
        {
            return(0);
        }
    }
        // Created by LinhDH 2012/06/11
        public void fill_dataset_by_id_giang_vien_thang_nam_dot_va_dv_thanh_toan(decimal ip_dc_id_giang_vien,
                                                                                 decimal ip_dc_dv_thanh_toan,
                                                                                 decimal ip_dc_trang_thai_tt,
                                                                                 string ip_str_reference_code,
                                                                                 string ip_str_loai_hop_dong,
                                                                                 decimal ip_dc_thang_tt,
                                                                                 decimal ip_dc_nam_tt,
                                                                                 string ip_str_ma_dot_tt,
                                                                                 DS_V_GD_THANH_TOAN ip_ds_gd_thanh_toan)
        {
            CStoredProc v_cstore = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanByGiangVien_thang_nam_dot_va_DVThanhToan");

            v_cstore.addDecimalInputParam("@ID_GIANG_VIEN", ip_dc_id_giang_vien);
            v_cstore.addDecimalInputParam("@ID_DON_VI_TT", ip_dc_dv_thanh_toan);
            v_cstore.addDecimalInputParam("@THANG_TT", ip_dc_thang_tt);
            v_cstore.addDecimalInputParam("@NAM_TT", ip_dc_nam_tt);
            v_cstore.addNVarcharInputParam("@LOAI_HOP_DONG", ip_str_loai_hop_dong);
            v_cstore.addDecimalInputParam("@ID_TRANG_THAI_TT", ip_dc_trang_thai_tt);
            v_cstore.addNVarcharInputParam("@REFERENCE_CODE", ip_str_reference_code);
            v_cstore.addNVarcharInputParam("@MA_DOT_THANH_TOAN", ip_str_ma_dot_tt);
            v_cstore.fillDataSetByCommand(this, ip_ds_gd_thanh_toan);
        }
Esempio n. 25
0
 private void load_data_2_grid(string ip_str_ma_dot_tt)
 {
     if (ip_str_ma_dot_tt == "")
     {
         m_lbl_thong_bao.Visible = true;
         m_lbl_thong_bao.Text    = "Chưa tạo Đợt thanh toán";
         return;
     }
     else
     {
         US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
         DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
         // Số phiếu thanh toán là mã đợt thanh toán
         v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = '" + ip_str_ma_dot_tt + "'");
         if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
         {
             m_lbl_thong_bao.Visible = true;
             m_lbl_thong_bao.Text    = "Chưa có Thanh toán nào ứng với Đợt thanh toán này";
         }
         m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
         m_grv_danh_sach_du_toan.DataBind();
     }
 }
    private void load_data_2_grid_lich_su(decimal ip_dc_id_hop_dong, string ip_str_ma_lop_mon)
    {
        US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
        DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();

        v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE ID_HOP_DONG_KHUNG =" + ip_dc_id_hop_dong + " AND REFERENCE_CODE = '" + ip_str_ma_lop_mon + "'");
        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            m_lbl_thong_bao.Text = "Chưa có thanh toán nào ứng với lớp môn và hợp đồng này";
            return;
        }
        m_grv_dm_danh_sach_hop_dong_khung.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
        m_grv_dm_danh_sach_hop_dong_khung.DataBind();
        if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count > 0)
        {
            decimal v_dc_sum = 0;
            for (int i = 0; i < v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count; i++)
            {
                v_dc_sum += CIPConvert.ToDecimal(v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows[i][V_GD_THANH_TOAN.TONG_TIEN_THANH_TOAN]);
            }
            //string v_str_da_tt =
            m_grv_dm_danh_sach_hop_dong_khung.FooterRow.Cells[8].Text = CIPConvert.ToStr(v_dc_sum, "#,###");
        }
    }
 private void load_data_2_grid(string ip_str_ma_dot_tt)
 {
     if (ip_str_ma_dot_tt == "")
     {
         m_lbl_thong_bao.Visible = true;
         m_lbl_thong_bao.Text    = "Chưa tạo Đợt thanh toán";
         return;
     }
     else
     {
         US_V_GD_THANH_TOAN v_us_gd_thanh_toan = new US_V_GD_THANH_TOAN();
         DS_V_GD_THANH_TOAN v_ds_gd_thanh_toan = new DS_V_GD_THANH_TOAN();
         // Số phiếu thanh toán là mã đợt thanh toán
         v_us_gd_thanh_toan.FillDataset(v_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN = N'" + ip_str_ma_dot_tt + "' AND ID_TRANG_THAI_THANH_TOAN <> " + hdf_id_trang_thai_chung_tu_chua_duoc_thanh_toan.Value + " ORDER BY ID DESC");
         if (v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
         {
             m_lbl_thong_bao.Visible = true;
             m_lbl_thong_bao.Text    = "Chưa có Thanh toán nào ứng với Đợt thanh toán này";
         }
         m_grv_danh_sach_du_toan.DataSource = v_ds_gd_thanh_toan.V_GD_THANH_TOAN;
         m_grv_danh_sach_du_toan.DataBind();
         m_lbl_danh_sach_chung_tu_ton_dong.Text = "Danh sách các chứng từ tồn đọng: " + v_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count + " chứng từ";
     }
 }
        public void f601_load_thanh_toan_theo_hop_dong_de_kiem_tra(decimal ip_dc_id_hop_dong, DS_V_GD_THANH_TOAN ip_v_ds_gd_thanh_toan)
        {
            CStoredProc v_store = new CStoredProc("pr_V_GD_THANH_TOAN_GetThanhToanByIdHopDong_f601");

            v_store.addDecimalInputParam("@id_hop_dong_khung", ip_dc_id_hop_dong);
            v_store.fillDataSetByCommand(this, ip_v_ds_gd_thanh_toan);
        }
    // Check trạng thái các thanh toán  trong KHO nằm trong đợt thanh toán này
    // Nếu có các thanh toán đó thì ta cho nó vào 1 ds để xuất ra màn hình
    private bool check_trang_thai_cac_thanh_toan_cua_dot_tt_trong_kho(string ip_str_ma_dot_tt, ref DS_V_GD_THANH_TOAN ip_ds_gd_thanh_toan)
    {
        US_V_GD_THANH_TOAN v_us_v_gd_thanh_toan = new US_V_GD_THANH_TOAN();

        // Láy tất cả các thanh toán trong kho mà có description giống với mã đợt thanh toán hiện
        v_us_v_gd_thanh_toan.FillDataset(ip_ds_gd_thanh_toan, " WHERE SO_PHIEU_THANH_TOAN like '%KHO%' AND [DESCRIPTION] like N'%" + ip_str_ma_dot_tt + "%' AND ID_TRANG_THAI_THANH_TOAN = " + hdf_id_trang_thai_ngan_hang_chuyen_khoan_khong_thanh_cong.Value + " ORDER BY ID DESC");
        // Nếu ko có thanh toán nào phù hợp, nghĩa là ổn :)
        if (ip_ds_gd_thanh_toan.V_GD_THANH_TOAN.Rows.Count == 0)
        {
            return(true);
        }
        return(false);
    }
 public US_V_GD_THANH_TOAN()
 {
     pm_objDS        = new DS_V_GD_THANH_TOAN();
     pm_strTableName = c_TableName;
     pm_objDR        = pm_objDS.Tables[pm_strTableName].NewRow();
 }