Ejemplo n.º 1
0
 public ChiTietDonThuoc(HoaDonXuat hdx)
 {
     InitializeComponent();
     busBenhNhan = new BusBenhNhan();
     busHDX = new BusHDX();
     this.hdx = hdx;
 }
Ejemplo n.º 2
0
        public bool TaoHoaDonXuat(HoaDonXuat hdx, ArrayList arrThuoc)
        {
            int i = hdxQ.InsertHDX(hdx);            
            if (i > 0)
            {

                HoaDonXuat hdxTemp = hdxQ.SelectLastHoaDonXuat();
                int MaHDX = hdxTemp.MaHDX;
                    int j = 0;
                    foreach (Thuoc thuoc in arrThuoc)
                    {
                          ChiTietHoaDonXuat chiTietHDX = new ChiTietHoaDonXuat(MaHDX, thuoc.IDThuoc, thuoc.SoLuong, thuoc.GiaBan, thuoc.Thue, thuoc.TenDVT);
                          j += hdxQ.InsertChiTietHDX(chiTietHDX);
                    }
                    if (j == arrThuoc.Count)
                    {
                        foreach (Thuoc thuoc in arrThuoc)
                        {
                            hdxQ.UpdateSoLuongThuoc(thuoc.IDThuoc, thuoc.SoLuong);
                        }
                        return true;
                    }
                    else
                    {
                        hdxQ.DelChiTietHDXByMaHDX(MaHDX);
                        hdxQ.DelHoaDonXuatByMaHDX(MaHDX);
                        return false;
                    }
            }
            else {
                return false;
            }
        }
Ejemplo n.º 3
0
 public SuLyInDonThuoc(HoaDonXuat hdx,ArrayList arrList)
 {
     InitializeComponent();
     busHDX = new BusHDX();
     this.hdx = hdx;
     this.arrList = arrList;
     busUser = new BusUser();
 }
Ejemplo n.º 4
0
 public HoaDonXuat SelectHoaDonXuat(int _MaHDX)
 {
     SqlDataReader rd = null;
     rd = dbHelper.ExecuteQuery("GetHoaDonXuat_MaHDX " + _MaHDX + "");
     if (rd.Read())
     {
         HoaDonXuat hdx = new HoaDonXuat(rd.GetInt32(0), rd.GetString(1), rd.GetDateTime(2), rd.GetDecimal(3), rd.GetDouble(4), rd.GetDecimal(5));
         rd.Close();
         return hdx;
     }
     else
     {
         rd.Close();
         return null;
     }
 }
Ejemplo n.º 5
0
        public int InsertHDX(HoaDonXuat hdx)
        {
            List<SqlParameter> paramList = new List<SqlParameter>();
            SqlParameter param = new SqlParameter();
            param = new SqlParameter("@IDBN", SqlDbType.Int);
            param.Value = hdx.IDBN;
            paramList.Add(param);
            param = new SqlParameter("@NgayLap", SqlDbType.NVarChar);
            param.Value = hdx.NgayLap;
            paramList.Add(param);
            param = new SqlParameter("@TongTienThuoc", SqlDbType.Decimal);
            param.Value = hdx.TongTienThuoc;
            paramList.Add(param);
            param = new SqlParameter("@TongThue", SqlDbType.Float);
            param.Value = hdx.TongThue;
            paramList.Add(param);
            param = new SqlParameter("@TongTienHD", SqlDbType.Decimal);
            param.Value = hdx.TongTienHD;
            paramList.Add(param);

            int i = dbHelper.ExecuteNonQuery("HoaDonXuat_Insert", paramList);
            return i;
        }
Ejemplo n.º 6
0
 public ArrayList SelectHDXByMaHDX(int _MaHDX)
 {
     SqlDataReader rd = dbHelper.ExecuteQuery(" GetHDXByMaHDX "+_MaHDX+" ");
     ArrayList arrLHDX = new ArrayList();
     while (rd.Read())
     {
         HoaDonXuat hdx = new HoaDonXuat(rd.GetInt32(0), rd.GetInt32(1), rd.GetString(2), rd.GetDateTime(3), rd.GetDecimal(4), rd.GetDouble(5), rd.GetDecimal(6), rd.GetString(7));
         arrLHDX.Add(hdx);
     }
     rd.Close();
     return arrLHDX;
 }
Ejemplo n.º 7
0
 public ArrayList SelectAllHDX(string _MaBN, string _ToDate, string _FromDate)
 {
     _MaBN = _MaBN.Replace("'", "''");
     SqlDataReader rd = dbHelper.ExecuteQuery(" DSHDX_NgayThangMaBN N'%" + _MaBN + "%','" + _ToDate + "','" + _FromDate + "' ");
     ArrayList arrLHDX = new ArrayList();
     while (rd.Read())
     {
         HoaDonXuat hdx = new HoaDonXuat(rd.GetInt32(0),rd.GetInt32(1), rd.GetString(2), rd.GetDateTime(3), rd.GetDecimal(4), rd.GetDouble(5), rd.GetDecimal(6), rd.GetString(7));
         arrLHDX.Add(hdx);
     }
     rd.Close();
     return arrLHDX;
 }
Ejemplo n.º 8
0
 private void btnLuuHD_Click(object sender, EventArgs e)
 {
     if (arrLlVChiTietHDX.Count == 0)
     {
         MessageBox.Show(this, "Chưa có thuốc trong hóa đơn", "Thông báo");
         txtMaThuoc.Focus();
         return;
     }
     else if (benhNhanHDX == null)
     {
         MessageBox.Show(this, "Chưa có thông tin bệnh nhân", "Thông báo");
         txtMaBN.Focus();
         return;
     }
     else
     {
         HoaDonXuat hdx = new HoaDonXuat(benhNhanHDX.IDBN, DateTime.Now, Convert.ToDecimal(this._TienThuoc), Convert.ToDouble(this._TienThue), Convert.ToDecimal(this._TongTienHD));
         SuLyInDonThuoc suLyDT = new SuLyInDonThuoc(hdx, arrLlVChiTietHDX);
         suLyDT.dgDT = new SuLyInDonThuoc.dgDonThuoc(TaoDonThuocOK);
         suLyDT.ShowDialog();
     }
 }