Example #1
0
 public US_V_DM_BILL(decimal i_dbID)
 {
     pm_objDS = new DS_V_DM_BILL();
     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]);
 }
        private void save_data()
        {
            //set_color_ma_bill_da_ton_tai();
            //Các bước:
            //B1. Kiểm tra dữ liệu trên grid, nếu sai thì không làm gì hết
            if(!check_validate_grid_is_ok())
                return;
            //B2. Nếu đúng rồi thì lưu thôi
            // Insert vào dm bill, cột số tiền để null
            DS_V_DM_BILL v_ds_v_dm_bill = new DS_V_DM_BILL();
            US_V_DM_BILL v_us_v_dm_bill = new US_V_DM_BILL();

            Int64 v_dem_bill = 0;
            for(int v_i_cur_row = m_fg.Rows.Fixed; v_i_cur_row < m_fg.Rows.Count - 1; v_i_cur_row++) {
                //Check xem tồn tại số bill trong CSDL chưa? Nếu có rồi tô màu đỏ
                if(is_exist_bill_in_db(CIPConvert.ToStr(m_fg.Rows[v_i_cur_row][(int)e_col_Number.SO_BILL]))) {
                    BaseMessages.MsgBox_Error("Đã tồn tại số bill " + CIPConvert.ToStr(m_fg.Rows[v_i_cur_row][(int)e_col_Number.SO_BILL]) + "này trong phần mềm!");
                    set_color_ma_bill_da_ton_tai(v_i_cur_row);
                    return;
                }
                //Đổ dữ liệu từ lưới lên us
                grid_row_2_us_v_dm_bill(v_i_cur_row, v_us_v_dm_bill);
                //Insert
                v_us_v_dm_bill.Insert();
                //Xóa hàng nếu insert thành công cho dễ nhìn
                if(m_fg.Rows.Count > 3) {
                    m_fg.Rows.Remove(v_i_cur_row);
                    v_i_cur_row = v_i_cur_row - 1;
                }
                else {
                    m_fg.Rows[v_i_cur_row].Clear(C1.Win.C1FlexGrid.ClearFlags.All);

                }
                v_dem_bill++;
            }
            BaseMessages.MsgBox_Infor("Đã nhập thành công " + v_dem_bill + " Bill!");
        }
 private void load_data_grv_detail(decimal ip_id_trang_thai)
 {
     decimal v_id_trung_tam = CIPConvert.ToDecimal(m_hdf_id_trung_tam.Value);
     US_V_DM_BILL v_us_v_dm_bill = new US_V_DM_BILL();
     DS_V_DM_BILL v_ds_v_dm_bill = new DS_V_DM_BILL();
     v_ds_v_dm_bill.Clear();
     if (ip_id_trang_thai == CONST_ID_TRANG_THAI_THU.ID_DA_NHAN_NOI_BO || ip_id_trang_thai == CONST_ID_TRANG_THAI_THU.ID_DA_CHUYEN_CPN)
     {
         v_us_v_dm_bill.FillDataset(v_ds_v_dm_bill, v_id_trung_tam, CIPConvert.ToDatetime(m_txt_tu_ngay.Text), CIPConvert.ToDatetime(m_txt_den_ngay.Text), ip_id_trang_thai, "", m_txt_nguoi_gui_tk.Text.Trim());
     }
     if (ip_id_trang_thai == CONST_ID_TRANG_THAI_THU.ID_BI_TRA_LAI_MAT_PHI)
     {
         v_us_v_dm_bill.Fill_DS_BAO_CAO_TONG_HOP_BILL_BI_TRA_LAI_MAT_PHI_WEB_DETAIL(v_ds_v_dm_bill, v_id_trung_tam, CIPConvert.ToDatetime(m_txt_tu_ngay.Text), CIPConvert.ToDatetime(m_txt_den_ngay.Text), m_txt_nguoi_gui_tk.Text.Trim());
     }
     if (ip_id_trang_thai == CONST_ID_TRANG_THAI_THU.ID_BI_TRA_LAI_KHONG_MAT_PHI)
     {
         v_us_v_dm_bill.Fill_DS_BAO_CAO_TONG_HOP_BILL_BI_TRA_LAI_KHONG_MAT_PHI_WEB_DETAIL(v_ds_v_dm_bill, v_id_trung_tam, CIPConvert.ToDatetime(m_txt_tu_ngay.Text), CIPConvert.ToDatetime(m_txt_den_ngay.Text), m_txt_nguoi_gui_tk.Text.Trim());
     }
     m_grv_detail.DataSource = v_ds_v_dm_bill.V_DM_BILL;
     string v_str_thong_tin = "Danh sách Có " + v_ds_v_dm_bill.V_DM_BILL.Rows.Count + " Bill";
     m_lbl_grv_detail.Text = v_str_thong_tin;
     m_grv_detail.DataBind();
     if (!m_hdf_id_bill.Value.Equals(""))
     {
         m_grv_detail.SelectedIndex = -1;
         for (int i = 0; i < m_grv_detail.Rows.Count; i++)
             if (CIPConvert.ToDecimal(m_grv_detail.DataKeys[i].Value) == CIPConvert.ToDecimal(m_hdf_id_bill.Value)) m_grv_detail.SelectedIndex = i;
     }
     if (v_ds_v_dm_bill.V_DM_BILL.Count == 0)
         thong_bao("Không tìm thấy Bill!", true);
 }
Example #4
0
 public void FillDatasetSearch_grid_ngay(DS_V_DM_BILL ip_ds, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay, decimal ip_dc_id_trung_tam, decimal ip_dc_id_trang_thai, string ip_str_key_word)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_V_DM_BILL_Search_phongban_ngay");
     v_store_proc.addNVarcharInputParam("@KEY_WORD", ip_str_key_word);
     v_store_proc.addDecimalInputParam("@ID_TRUNG_TAM", ip_dc_id_trung_tam);
     v_store_proc.addDecimalInputParam("@ID_TRANG_THAI", ip_dc_id_trang_thai);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_dat_den_ngay);
     v_store_proc.fillDataSetByCommand(this, ip_ds);
 }
Example #5
0
 public void Fill_DS_BAO_CAO_TONG_HOP_BILL_BI_TRA_LAI_MAT_PHI_WEB_DETAIL(DS_V_DM_BILL ip_v_ds_v_dm_bill, decimal ip_dc_id_trung_tam, DateTime ip_v_dat_tu_ngay, DateTime ip_v_dat_den_ngay, string ip_nguoi_gui)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_BAO_CAO_TONG_HOP_BILL_BI_TRA_LAI_MAT_PHI_WEB_DETAIL_2");
     v_store_proc.addDecimalInputParam("@ID_TRUNG_TAM", ip_dc_id_trung_tam);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_v_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_v_dat_den_ngay);
     v_store_proc.addNVarcharInputParam("@NGUOI_GUI", ip_nguoi_gui);
     v_store_proc.fillDataSetByCommand(this, ip_v_ds_v_dm_bill);
 }
Example #6
0
 public US_V_DM_BILL()
 {
     pm_objDS = new DS_V_DM_BILL();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
Example #7
0
 public void FillDatasetSearch_grid(DS_V_DM_BILL ip_ds, decimal ip_dc_id_trung_tam, decimal ip_dc_id_trang_thai, string ip_str_key_word)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_V_DM_BILL_Search_phongban");
     v_store_proc.addNVarcharInputParam("@KEY_WORD", ip_str_key_word);
     v_store_proc.addDecimalInputParam("@ID_TRUNG_TAM", ip_dc_id_trung_tam);
     v_store_proc.addDecimalInputParam("@ID_TRANG_THAI", ip_dc_id_trang_thai);
     v_store_proc.fillDataSetByCommand(this, ip_ds);
 }
Example #8
0
 public void FillDatasetSearch_bill(DS_V_DM_BILL ip_ds, decimal ip_dc_id_phong_ban, string ip_str_tu_khoa, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_V_DM_BILL_Search");
     v_store_proc.addDecimalInputParam("@ID_TRUNG_TAM", ip_dc_id_phong_ban);
     v_store_proc.addNVarcharInputParam("@TU_KHOA", ip_str_tu_khoa);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_dat_den_ngay);
     v_store_proc.fillDataSetByCommand(this, ip_ds);
 }
Example #9
0
 public void FillDatasetSearch_bitralai(DS_V_DM_BILL ip_ds,decimal ip_dc_id_trang_thai, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_V_DM_BILL_Search_trang_thai_tra_lai");
     v_store_proc.addDecimalInputParam("@ID_TRANG_THAI", ip_dc_id_trang_thai);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_dat_den_ngay);
     v_store_proc.fillDataSetByCommand(this, ip_ds);
 }
Example #10
0
 public void FillDataset(DS_V_DM_BILL ip_v_ds_v_dm_bill, decimal ip_dc_id_trung_tam, DateTime ip_v_dat_tu_ngay, DateTime ip_v_dat_den_ngay, decimal ip_v_dc_id_trang_thai, string ip_v_str_tu_khoa, string ip_nguoi_gui)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_TRA_CUU_TRANG_THAI_CUA_TRUNG_TAM_WEB_Search_2");
     v_store_proc.addDecimalInputParam("@ID_TRUNG_TAM", ip_dc_id_trung_tam);
     v_store_proc.addNVarcharInputParam("@TU_KHOA", ip_v_str_tu_khoa);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_v_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_v_dat_den_ngay);
     v_store_proc.addDecimalInputParam("@ID_TRANG_THAI", ip_v_dc_id_trang_thai);
     v_store_proc.addNVarcharInputParam("@NGUOI_GUI", ip_nguoi_gui);
     v_store_proc.fillDataSetByCommand(this, ip_v_ds_v_dm_bill);
 }
Example #11
0
 public void FillDatasetSearch(DS_V_DM_BILL ip_ds, decimal ip_dc_id_phong_ban, string ip_str_so_bill, decimal ip_dc_id_trang_thai_cu, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
 {
     CStoredProc v_store_proc = new CStoredProc("pr_V_DM_BILL_Search_trang_thai");
     v_store_proc.addDecimalInputParam("@ID_PHONG_BAN", ip_dc_id_phong_ban);
     v_store_proc.addNVarcharInputParam("@SO_BILL", ip_str_so_bill);
     v_store_proc.addDecimalInputParam("@ID_TRANG_THAI", ip_dc_id_trang_thai_cu);
     v_store_proc.addDatetimeInputParam("@TU_NGAY", ip_dat_tu_ngay);
     v_store_proc.addDatetimeInputParam("@DEN_NGAY", ip_dat_den_ngay);
     v_store_proc.fillDataSetByCommand(this, ip_ds);
 }
        private void load_data_2_grid(decimal ip_dc_trang_thai, C1.Win.C1FlexGrid.C1FlexGrid i_fg)
        {
            DateTime v_dat_tu_ngay = DateTime.Now.Date;
            DateTime v_dat_den_ngay = DateTime.Now.Date;
            decimal v_dc_id_trung_tam = CIPConvert.ToDecimal(m_cbo_trung_tam.SelectedValue);
            decimal v_dc_id_trang_thai = ip_dc_trang_thai; //CIPConvert.ToDecimal(m_cbo_trang_thai_cu.SelectedValue);
            string v_str_key_word = m_txt_key_word.Text;
            if (v_str_key_word == m_str_goi_y_so_bill) v_str_key_word = "";
            m_ds = new DS_V_DM_BILL();
            if (m_rdb_tat_ca.Checked == true)
            {
                v_dat_tu_ngay = CIPConvert.ToDatetime(m_dtp_tu_ngay.Text.Trim(), "dd/MM/yyyy");
                v_dat_den_ngay = CIPConvert.ToDatetime(m_dtp_den_ngay.Text.Trim(), "dd/MM/yyyy");

            }
            if (m_rdb_chon_ngay.Checked == true)
            {
                v_dat_tu_ngay = CIPConvert.ToDatetime(m_dtp_tu_ngay.Text.Trim(), "dd/MM/yyyy");
                v_dat_den_ngay = CIPConvert.ToDatetime(m_dtp_den_ngay.Text.Trim(), "dd/MM/yyyy");
                v_dat_den_ngay = v_dat_tu_ngay;
            }
            if (m_rdb_chon_thang.Checked == true)
            {
                v_dat_tu_ngay = CIPConvert.ToDatetime("01/" + m_dtp_tu_ngay.Text, "dd/MM/yyyy");
                DateTime temp = v_dat_tu_ngay.Date;
                temp = temp.AddMonths(1);
                temp = temp.AddDays(-(temp.Day));
                v_dat_den_ngay = temp;

            }
            m_us.FillDatasetSearch_grid_ngay(m_ds, v_dat_tu_ngay, v_dat_den_ngay, v_dc_id_trung_tam, v_dc_id_trang_thai, v_str_key_word);
            i_fg.Redraw = false;
            m_obj_trans = get_trans_object(i_fg);
            CGridUtils.Dataset2C1Grid(m_ds, i_fg, m_obj_trans);
            CGridUtils.MakeSoTT(0, i_fg);
            i_fg.Redraw = true;
            set_textbox_keyword_format_before();
        }
            v_ds.CM_DM_TU_DIEN.Rows.InsertAt(v_dr, 0);
            m_cbo_trang_thai.SelectedIndex = 0;
        }

        private void load_data_2_cbo_trung_tam()
        {
            US_DM_PHONG_BAN v_us = new US_DM_PHONG_BAN();
            DS_DM_PHONG_BAN v_ds = new DS_DM_PHONG_BAN();
            v_us.FillDataset(v_ds);
            m_cbo_trung_tam.DataSource = v_ds.DM_PHONG_BAN;
            m_cbo_trung_tam.ValueMember = DM_PHONG_BAN.ID;
            m_cbo_trung_tam.DisplayMember = DM_PHONG_BAN.TEN_PHONG_BAN;

            DataRow v_dr = v_ds.DM_PHONG_BAN.NewRow();
            v_dr[DM_PHONG_BAN.ID] = -1;
            v_dr[DM_PHONG_BAN.MA_PHONG_BAN] = "";
            v_dr[DM_PHONG_BAN.TEN_PHONG_BAN] = "-----Tất cả-----";

            v_ds.DM_PHONG_BAN.Rows.InsertAt(v_dr, 0);
            m_cbo_trung_tam.SelectedIndex = 0;
        }
 private void load_data_2_grid()
 {
     decimal v_dc_id_trang_thai = CONST_ID_TRANG_THAI_THU.ID_BI_TRA_LAI;
     DateTime v_dat_tu_ngay = CIPConvert.ToDatetime(m_dtp_tu_ngay.Text);
     DateTime v_dat_den_ngay = CIPConvert.ToDatetime(m_dtp_den_ngay.Text);
     m_ds = new DS_V_DM_BILL();
     m_us.FillDatasetSearch_bitralai(m_ds, v_dc_id_trang_thai, v_dat_tu_ngay, v_dat_den_ngay);
     m_grv_bill.Redraw = false;
     CGridUtils.Dataset2C1Grid(m_ds, m_grv_bill, m_obj_trans);
     CGridUtils.MakeSoTT(0, m_grv_bill);
     m_grv_bill.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Count // chỗ này dùng hàm count tức là để đếm, có thể dùng các hàm khác thay thế
       , 0
       , (int)e_col_Number.TEN_PHONG_BAN // chỗ này là tên trường mà mình nhóm
       , (int)e_col_Number.SO_BILL // chỗ này là tên trường mà mình Count
       , "{0}"
       );
     m_grv_bill.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Sum
         , 0
         , (int)e_col_Number.TEN_PHONG_BAN
         , (int)e_col_Number.SO_TIEN
         , "{0}"
         );
     m_grv_bill.Cols[(int)e_col_Number.CHON_GUI_MAIL].AllowEditing = true;
     m_grv_bill.Cols[(int)e_col_Number.NGUOI_NHAN].AllowEditing = true;
     m_grv_bill.AllowEditing = true;
     m_grv_bill.Redraw = true;
 }
 private void load_data_to_grid()
 {
     decimal v_id_trung_tam = CIPConvert.ToDecimal(m_hdf_id_trung_tam.Value);
     decimal v_dc_id_trang_thai = CIPConvert.ToDecimal(m_cbo_trang_thai.SelectedValue);
     string v_str_tu_khoa = m_txt_tim_kiem.Text.Trim();
     US_V_DM_BILL v_us_v_dm_bill = new US_V_DM_BILL();
     DS_V_DM_BILL v_ds_v_dm_bill = new DS_V_DM_BILL();
     v_ds_v_dm_bill.Clear();
     v_us_v_dm_bill.FillDataset(v_ds_v_dm_bill, v_id_trung_tam, CIPConvert.ToDatetime(m_txt_tu_ngay.Text), CIPConvert.ToDatetime(m_txt_den_ngay.Text), v_dc_id_trang_thai, v_str_tu_khoa);
     m_grv_v_dm_bill.DataSource = v_ds_v_dm_bill.V_DM_BILL;
     string v_str_thong_tin = " (Có " + v_ds_v_dm_bill.V_DM_BILL.Rows.Count + " bản ghi)";
     m_lbl_thong_tim_grv_dm_bill.Text = v_str_thong_tin;
     m_grv_v_dm_bill.DataBind();
     if (!m_hdf_id_bill.Value.Equals(""))
     {
         m_grv_v_dm_bill.SelectedIndex = -1;
         for (int i = 0; i < m_grv_v_dm_bill.Rows.Count; i++)
             if (CIPConvert.ToDecimal(m_grv_v_dm_bill.DataKeys[i].Value) == CIPConvert.ToDecimal(m_hdf_id_bill.Value)) m_grv_v_dm_bill.SelectedIndex = i;
     }
     if (v_ds_v_dm_bill.V_DM_BILL.Count == 0)
         thong_bao("Không tìm thấy Bill!",true);
 }
Example #16
0
        {
            f517_V_DM_BILL_DE v_fDE = new f517_V_DM_BILL_DE();
            v_fDE.display_for_insert();
            load_data_2_grid();
        }

        private void load_data_2_cbo_trung_tam()
        {
            US_DM_PHONG_BAN v_us = new US_DM_PHONG_BAN();
            DS_DM_PHONG_BAN v_ds = new DS_DM_PHONG_BAN();
            v_us.FillDataset(v_ds);
            m_cbo_trung_tam.DataSource = v_ds.DM_PHONG_BAN;
            m_cbo_trung_tam.ValueMember = DM_PHONG_BAN.ID;
            m_cbo_trung_tam.DisplayMember = DM_PHONG_BAN.TEN_PHONG_BAN;