Ejemplo n.º 1
0
        public static void NhapPhieuThuTien(PhieuThuTien phieuThuTien)
        {
            PhieuThuTienDAL.NhapPhieuThuTien(phieuThuTien);
            string hieuXe = XeDAL.GetHieuXe(phieuThuTien.BienSo);
            string maBCDT = BaoCaoDoanhThuBLL.GetMaBC(phieuThuTien.NgayThu.Month, phieuThuTien.NgayThu.Year);

            if (maBCDT == "")
            {
                maBCDT = BaoCaoDoanhThuBLL.AutoMABC();

                BaoCaoDoanhThu baoCao = new BaoCaoDoanhThu();
                baoCao.MaBaoCaoDoanhThu = maBCDT;
                baoCao.Thang            = phieuThuTien.NgayThu.Month;
                baoCao.Nam = phieuThuTien.NgayThu.Year;

                BaoCaoDoanhThuBLL.ThemBC(baoCao);
            }

            ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();

            chiTiet.MaBC   = maBCDT;
            chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.GetMaCTBC(maBCDT, hieuXe);
            chiTiet.HieuXe = hieuXe;

            if (chiTiet.MaCTBC == "")
            {
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }

            ChiTietBaoCaoDoanhThuBLL.CapNhatBaoCao(chiTiet, phieuThuTien.SoTienThu);
        }
Ejemplo n.º 2
0
        private void bttXemBaoCao_Click(object sender, EventArgs e)
        {
            var tb = new HideNotifications();

            cbxThang.Text = thang.ToString();
            numNam.Value  = nam;
            if (nam <= DateTime.Now.Year)
            {
                if (thang <= DateTime.Now.Month)
                {
                    rptBaoCaoDoanhThuTheoNgay report = new rptBaoCaoDoanhThuTheoNgay();
                    report.DataSource = BaoCaoDoanhThu.LayDuLieu(thang, nam);
                    report.BinData();
                    ReportPrintTool tool = new ReportPrintTool(report);
                    report.ShowPreviewDialog();
                }
                else
                {
                    lblThongBao.ForeColor = Color.Red;
                    lblThongBao.Text      = "Tháng không tồn tại";
                    tb.stt(lblThongBao);
                }
            }
            else
            {
                lblThongBao.ForeColor = Color.Red;
                lblThongBao.Text      = "Năm không tồn tại";
                tb.stt(lblThongBao);
                numNam.Focus();
            }
        }
        public override global::System.Data.DataSet Clone()
        {
            BaoCaoDoanhThu cln = ((BaoCaoDoanhThu)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            BaoCaoDoanhThu ds = new BaoCaoDoanhThu();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Ejemplo n.º 5
0
        //Hàm LoadData để load lại dữ liệu khi có sự thay đổi
        public void LoadData()
        {
            cbxThang.Text          = thang.ToString();
            numNam.Value           = nam;
            dgvDoanhThu.DataSource = BaoCaoDoanhThu.LayDuLieu(thang, nam);

            dgvDoanhThu.Columns["NgayKham"].HeaderText = "Ngày";
            dgvDoanhThu.Columns["SoBN"].HeaderText     = "Số bệnh nhân";
            dgvDoanhThu.Columns["DoanhThu"].HeaderText = "Doanh thu";

            dgvDoanhThu.Columns["NgayKham"].Width = 200;
            dgvDoanhThu.Columns["SoBN"].Width     = 150;
            dgvDoanhThu.Columns["DoanhThu"].Width = 200;
        }
Ejemplo n.º 6
0
        public static void ThemBaoCao(BaoCaoDoanhThu baoCao)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("THEMBCDS");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MABC", baoCao.MaBaoCaoDoanhThu);
            cmd.Parameters.AddWithValue("@THANG", baoCao.Thang);
            cmd.Parameters.AddWithValue("@NAM", baoCao.Nam);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
Ejemplo n.º 7
0
 private void load_table(string tungay, string denngay, string loaibaocao)
 {
     switch (loaibaocao)
     {
     case "Báo cáo doanh thu bán hàng":
     {
         BaoCaoDoanhThu u4 = new BaoCaoDoanhThu(tungay, denngay)
         {
             Dock = DockStyle.Fill
         };
         panel1.Controls.Add(u4);
         break;
     }
     }
 }
Ejemplo n.º 8
0
        public static void ThemBC(BaoCaoDoanhThu baoCao)
        {
            BaoCaoDoanhThuDAL.ThemBaoCao(baoCao);
            DataTable dt = HieuXeBLL.GetHieuXe();

            foreach (DataRow row in dt.Rows)
            {
                ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                chiTiet.MaBC   = baoCao.MaBaoCaoDoanhThu;
                chiTiet.HieuXe = row.ItemArray[0].ToString();

                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }
        }
Ejemplo n.º 9
0
        public static void ThemPhieuSuaChua(PhieuSuaChua psc)
        {
            PhieuSuaChuaDAL.ThemPhieuSuaChua(psc);

            string hieuXe = XeDAL.GetHieuXe(psc.BienSo);
            string maBCDT = BaoCaoDoanhThuBLL.GetMaBC(psc.NgaySuaChua.Month, psc.NgaySuaChua.Year);

            if (maBCDT == "")
            {
                maBCDT = BaoCaoDoanhThuBLL.AutoMABC();

                BaoCaoDoanhThu baoCao = new BaoCaoDoanhThu();
                baoCao.MaBaoCaoDoanhThu = maBCDT;
                baoCao.Thang            = psc.NgaySuaChua.Month;
                baoCao.Nam = psc.NgaySuaChua.Year;

                BaoCaoDoanhThuBLL.ThemBC(baoCao);
            }

            ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();

            chiTiet.MaBC   = maBCDT;
            chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.GetMaCTBC(maBCDT, hieuXe);

            if (chiTiet.MaCTBC == "")
            {
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                chiTiet.HieuXe = hieuXe;
                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }

            ChiTietBaoCaoDoanhThuBLL.CapNhatSoLuotSua(chiTiet);

            string maBCT = BaoCaoTonBLL.GetMaBCT(psc.NgaySuaChua.Month, psc.NgaySuaChua.Year);

            if (maBCT == "")
            {
                maBCT = BaoCaoTonBLL.AutoMABCT();

                BaoCaoTon BCT = new BaoCaoTon();
                BCT.MaBCT = maBCT;
                BCT.Thang = psc.NgaySuaChua.Month;
                BCT.Nam   = psc.NgaySuaChua.Year;

                BaoCaoTonBLL.ThemBC(BCT);
            }
        }
Ejemplo n.º 10
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (txtMaBC.Text == "")
            {
                MessageBox.Show("Lỗi xảy ra");
                return;
            }
            string mabc = txtMaBC.Text;

            BaoCaoDoanhThu bc = db.BaoCaoDoanhThus.Find(mabc);

            bc.Xoa = 1;
            db.SaveChanges();
            if (db.SaveChanges() == 0)
            {
                MessageBox.Show("Xóa thành công báo cáo tháng" + txtThang.Text);
                ResetForm();
            }
        }
Ejemplo n.º 11
0
        private void txtMaBC_TextChanged(object sender, EventArgs e)
        {
            if (txtMaBC.Text == "")
            {
                return;
            }
            BaoCaoDoanhThu bc = db.BaoCaoDoanhThus.Find(txtMaBC.Text);

            txtThang.Text = bc.Thang + "/" + bc.Nam;
            var result = from c in db.CT_BaoCaoDT where c.MaBaoCaoDT == bc.MaBaoCaoDT select c;

            foreach (var i in result)
            {
                string[] row1 = new string[]
                {
                    i.MaLoaiPhong,
                    i.DoanhThu.ToString(),
                    i.TyLe.ToString()
                };
                dgvCTBC.Rows.Add(row1);
            }
        }
Ejemplo n.º 12
0
        private void btnLap_Click(object sender, EventArgs e)
        {
            if (txtThang.Text != "" || txtMaBC.Text != "")
            {
                MessageBox.Show("Lỗi xảy ra");
                return;
            }
            string mabc  = txtNhapThang.Text;
            var    check = from c in db.BaoCaoDoanhThus where c.Thang == mabc select c;

            if (check.Count() != 0)
            {
                MessageBox.Show("Báo cáo tháng " + mabc + "đã tồn tại.");
                return;
            }
            ;



            var result = from c in db.BaoCaoDoanhThus select c;
            int id     = 0;

            foreach (var i in result)
            {
                id = id + 1;
            }

            BaoCaoDoanhThu bc = new BaoCaoDoanhThu()
            {
                MaBaoCaoDT = "BCDT" + (id + 1),
                Thang      = txtNhapThang.Text,
                Nam        = txtNam.Text,
                Xoa        = 0
            };

            db.BaoCaoDoanhThus.Add(bc);
            db.SaveChanges();

            if (db.SaveChanges() == 0)
            {
                for (int i = 0; i < (dgvCTBC.Rows.Count - 1); i++)
                {
                    var re    = from c in db.CT_BaoCaoDT select c;
                    int id_ct = 0;
                    foreach (var d in re)
                    {
                        id_ct = id_ct + 1;
                    }
                    string      loaiphong = dgvCTBC[0, i].Value.ToString();
                    double      doanhthu  = double.Parse(dgvCTBC[1, i].Value.ToString());
                    string      tyle      = dgvCTBC[2, i].Value.ToString();
                    CT_BaoCaoDT ct        = new CT_BaoCaoDT()
                    {
                        MaCTBaoCaoDT = "CTDT" + (id_ct + 1),
                        MaBaoCaoDT   = "BCDT" + (id + 1),
                        MaLoaiPhong  = loaiphong,
                        DoanhThu     = doanhthu,
                        TyLe         = tyle
                    };

                    db.CT_BaoCaoDT.Add(ct);
                    db.SaveChanges();
                }
                MessageBox.Show("Lập báo cáo thành công");
            }
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                BaoCaoDoanhThu ds = new BaoCaoDoanhThu();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "BaoCaoDoanhThuDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Ejemplo n.º 14
0
        private void pictureBox5_Click(object sender, EventArgs e)
        {
            BaoCaoDoanhThu b = new BaoCaoDoanhThu();

            b.ShowDialog();
        }
Ejemplo n.º 15
0
        private void btnDoanhThu_Click(object sender, EventArgs e)
        {
            BaoCaoDoanhThu bc = new BaoCaoDoanhThu();

            bc.ShowDialog();
        }