Пример #1
0
        /// <summary>
        /// hàm thực hiện in phiếu báo cáo
        /// thông tin
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdBaoCao_Click(object sender, EventArgs e)
        {
            try
            {
                string nhomthuoc = "-1";

                nhomthuoc = txtLoaithuoc.MyID.ToString();


                DataTable m_dtReport = null;
                if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                {
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaoBiendongthuocTrongkhotong(chkByDate.Checked ? dtFromDate.Text : Utility.sDbnull("01/01/1900"),
                                                                                   chkByDate.Checked ? dtToDate.Text : globalVariables.SysDate.ToString(),
                                                                                   Utility.Int32Dbnull(cboKho.SelectedValue), nhomthuoc, Utility.Int32Dbnull(txtthuoc.MyID, -1), chkBiendong.Checked ? 1 : 0);
                }
                else
                {
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaoBiendongthuocTrongkhole(chkByDate.Checked ? dtFromDate.Text : Utility.sDbnull("01/01/1900"),
                                                                                 chkByDate.Checked ? dtToDate.Text : globalVariables.SysDate.ToString(),
                                                                                 Utility.Int32Dbnull(cboKho.SelectedValue), Utility.Int32Dbnull(txtthuoc.MyID, -1), nhomthuoc, chkBiendong.Checked ? 1 : 0);
                }

                Utility.SetDataSourceForDataGridEx(_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked) ? grdListKhoChan : grdListKhole, m_dtReport, true, true, "1=1", "");
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
                if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_xuatnhapton_khochan.xml");
                    thuoc_baocao.BaocaoNhapxuattonKhochan(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                          dtNgayIn.Value, FromDateToDate,
                                                          Utility.sDbnull(cboKho.Text), chkTheoNhomThuoc.Checked);
                }
                else
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_xuatnhapton_khole.xml");
                    thuoc_baocao.BaocaoNhapxuattonKhole(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                        dtNgayIn.Value, FromDateToDate,
                                                        Utility.sDbnull(cboKho.Text), chkTheoNhomThuoc.Checked);
                }
                //else
                //{
                //    thuoc_baocao.BaocaoNhapxuattonKhochanTheonhom(m_dtReport, baocaO_TIEUDE1.TIEUDE,
                //                                                                         dtNgayIn.Value, FromDateToDate,
                //                                                                         Utility.sDbnull(cboKho.Text));
                //}
            }
            catch (Exception)
            {
            }
        }