Exemplo n.º 1
0
        private void btnReportNL_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                foreach (NguyenLieu nl in listNL)
                {
                    if ((nl.NgayNhap.Value.Month < Convert.ToInt32(listView1.SelectedItems[0].SubItems[1].Text) || nl.NgayNhap.Value.Month == Convert.ToInt32(listView1.SelectedItems[0].SubItems[1].Text))

                        && (nl.NgayNhap.Value.Year < Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text) || nl.NgayNhap.Value.Year == Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text))
                        )
                    {
                        rptChiPhiNguyenLieu rpcpnl = new rptChiPhiNguyenLieu();
                        rpcpnl.TenNL     = "NL" + nl.TenNguyenLieu.ToString();
                        rpcpnl.NgayNhap  = nl.NgayNhap.Value.ToString("d");
                        rpcpnl.SoLuong   = nl.SoLuong;
                        rpcpnl.Gia       = nl.Gia;
                        rpcpnl.ThanhTien = nl.Gia * nl.SoLuong;

                        listRP_CPNL.Add(rpcpnl);
                    }
                }

                FrmReportDoanhThuHD f = new FrmReportDoanhThuHD(listRP_CPNL, user.TenNV);
                f.ShowDialog();
                this.Show();
                Cursor.Current = Cursors.Arrow;

                listRP_CPNL.Clear();
            }
            else
            {
                MessageBox.Show("Mời bạn nhấp vào dữ liệu trước khi chọn !");
            }
        }
Exemplo n.º 2
0
        private void btnReportNL_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                // Xét toàn bộ Danh sách chi phí nguyên liệu, nếu tháng và năm của ngày nhập nguyên liệu đang chọn <= ngày và tháng đang xét
                // thì lưu thông tin các nguyên liệu biến rptDoanhThuHoaDon để sau này thêm vào danh sách report chi phí nguyên liệu.
                //
                foreach (NguyenLieu nl in listNL)
                {
                    if ((nl.NgayNhap.Value.Month < Convert.ToInt32(listView1.SelectedItems[0].SubItems[1].Text) || nl.NgayNhap.Value.Month == Convert.ToInt32(listView1.SelectedItems[0].SubItems[1].Text))

                        && (nl.NgayNhap.Value.Year < Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text) || nl.NgayNhap.Value.Year == Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text))
                        )
                    {
                        rptChiPhiNguyenLieu rpcpnl = new rptChiPhiNguyenLieu();
                        rpcpnl.TenNL     = "NL" + nl.TenNguyenLieu.ToString();
                        rpcpnl.NgayNhap  = nl.NgayNhap.Value.ToString("d");
                        rpcpnl.SoLuong   = nl.SoLuong;
                        rpcpnl.Gia       = nl.Gia;
                        rpcpnl.ThanhTien = nl.Gia * nl.SoLuong;

                        listRP_CPNL.Add(rpcpnl);
                    }
                }
                // Danh sách Report Chi phí nguyên liệu sau khi nhận dc hết thông tin tháng đó thì gửi dữ liệu listRP_CPNL qua form ReportDoanhThuHD
                // để xuất hóa đơn.
                FrmReportDoanhThuHD f = new FrmReportDoanhThuHD(listRP_CPNL, user.TenNV);
                f.ShowDialog();
                this.Show();
                Cursor.Current = Cursors.Arrow;

                listRP_CPNL.Clear();
            }
            else
            {
                MessageBox.Show("Mời bạn nhấp vào dữ liệu trước khi chọn !");
            }
        }