Esempio n. 1
0
        /// <summary>
        /// In báo cáo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrintImport_Click(object sender, EventArgs e)
        {
            DateTime TuNgay           = dtpkTuNgayThu.Value;
            DateTime denNgay          = dtpkDenNgayThu.Value;
            CrystalReportBaoCaoThu cr = new CrystalReportBaoCaoThu();

            cr.SetDataSource(HoaDonDAO.Instance.getHoaDonbyThoiGian(TuNgay, denNgay));
            ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;

            ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["TuNgay"];
            ParameterDiscreteValue   crParameterDiscreteValue   = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = TuNgay;
            ParameterValues crParameterValues = new ParameterValues();

            //reset lại value
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            ParameterFieldDefinition crParameterFieldDefinitionDenNgay = crParameterFieldDefinitions["DenNgay"];
            ParameterDiscreteValue   crParameterDiscreteValueDenNgay   = new ParameterDiscreteValue();

            crParameterDiscreteValueDenNgay.Value = denNgay;
            ParameterValues crParameterValuesDenNgay = new ParameterValues();

            //reset lại value
            crParameterValuesDenNgay = crParameterFieldDefinitionDenNgay.CurrentValues;
            crParameterValuesDenNgay.Add(crParameterDiscreteValueDenNgay);
            crParameterFieldDefinitionDenNgay.ApplyCurrentValues(crParameterValuesDenNgay);
            fReport f = new fReport(cr);

            f.ShowDialog();
        }
        /// <summary>
        /// thực hiện thao tác in hóa đơn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrint_Click(object sender, EventArgs e)
        {
            //CrystalReport1 cr = new CrystalReport1();
            //cr.SetDataSource(DataProvider.Instance.ExecuteQuery("SELECT *FROM dbo.BANAN"));
            //fReport f = new fReport(cr);
            //f.ShowDialog();
            if (dtgvBills.Tag == null)
            {
                fMessageBoxOK.Show("Vui lòng chọn bàn ăn!"); return;
            }
            BanAn table = (BanAn)dtgvBills.Tag;

            totalMonney = 0;
            foreach (ThongTinHoaDonDTO item in cthdDAO.Instance.getListItemNonCheckByMABA(table.MABA))
            {
                totalMonney += item.SoLuongMA * item.GIA;
            }
            preMoney = 0;
            foreach (string item in HoaDonDAO.Instance.GETHOADONNonCheckByMABA(table.MABA))
            {
                preMoney += cthdDAO.Instance.getTienDaThanhToanByHoaDon(item);
            }
            if (dtgvBills.Rows.Count <= 0)
            {
                return;
            }
            string    mahd = (string)dtgvBills.Rows[0].Cells["MAHD"].Value;
            DataTable data = cthdDAO.Instance.getListPrintBillsbyMAHD(mahd);
            fReport   f    = new fReport(data, totalMonney - preMoney);

            f.ShowDialog();
        }
Esempio n. 3
0
        /// <summary>
        /// Thuc hiện tạo hóa đơn nhập và in hóa đơn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrint_Click(object sender, EventArgs e)
        {
            if (listCTHDN.Count <= 0)
            {
                return;
            }
            if (fMessageBox.Show("Tạo hóa đơn nhập thực phẩm?") == DialogResult.Cancel)
            {
                return;
            }
            NhaCungCapDTO nhacc = ((NhaCungCapDTO)cbSuplier.SelectedItem);
            string        MAHD  = StaticClass.Random(10);

            if (!HoaDonNhapDAO.Instance.insertHoaDonNhap(MAHD, DateTime.Now, 0, 0))
            {
                fMessageBoxOK.Show("Vui long thuc hien lai!");
                return;
            }
            foreach (CTHDNdto item in listCTHDN)
            {
                CTHDNdao.Instance.insertCTHDN(MAHD, item.MATP, item.SoLuongThucPham);
                CTTPdao.Instance.insertCTTP(item.MATP, nhacc.MANCC);
            }
            fReport f = new fReport(MAHD, nhacc.MANCC);

            f.ShowDialog();
            listCTHDN.Clear();
            listCTHDN            = new List <CTHDNdto>();
            dtgvCTHDN.DataSource = listCTHDN;
            ptbSearch_Click(this, new EventArgs());
        }
        /// <summary>
        /// in hóa đơn đặt bàn trước!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrint_Click(object sender, EventArgs e)
        {
            if (cbTenKhachHang.SelectedItem == null)
            {
                return;
            }
            KhachHangHoaDonDTO kh   = (KhachHangHoaDonDTO)cbTenKhachHang.SelectedItem;
            DataTable          data = cthdDAO.Instance.getListPrintBillsbyMAHD(kh.MAHD);
            fReport            f    = new fReport(data, PrePrice);

            f.ShowDialog();
        }
Esempio n. 5
0
        /// <summary>
        /// In báo cáo chi. 0 hóa đơn nhâp. 1 tiền lương nhân viên
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrintExport_Click(object sender, EventArgs e)
        {
            switch (((BaoCaoChi)cbChi.SelectedItem).BaoCao)
            {
            case 0:
                DateTime TuNgay  = dtpkTuNgayChi.Value;
                DateTime denNgay = dtpkDenNgayChi.Value;


                CrystalReportBaoCaoChiNhapThucPham cr = new CrystalReportBaoCaoChiNhapThucPham();
                cr.SetDataSource(HoaDonNhapDAO.Instance.getListHoaDonNhapTuNgayDenNgay(TuNgay, denNgay));
                ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;

                ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["TuNgay"];
                ParameterDiscreteValue   crParameterDiscreteValue   = new ParameterDiscreteValue();
                crParameterDiscreteValue.Value = TuNgay;
                ParameterValues crParameterValues = new ParameterValues();
                //reset lại value
                crParameterValues = crParameterFieldDefinition.CurrentValues;
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                ParameterFieldDefinition crParameterFieldDefinitionDenNgay = crParameterFieldDefinitions["DenNgay"];
                ParameterDiscreteValue   crParameterDiscreteValueDenNgay   = new ParameterDiscreteValue();
                crParameterDiscreteValueDenNgay.Value = denNgay;
                ParameterValues crParameterValuesDenNgay = new ParameterValues();
                //reset lại value
                crParameterValuesDenNgay = crParameterFieldDefinitionDenNgay.CurrentValues;
                crParameterValuesDenNgay.Add(crParameterDiscreteValueDenNgay);
                crParameterFieldDefinitionDenNgay.ApplyCurrentValues(crParameterValuesDenNgay);
                fReport f = new fReport(cr);
                f.ShowDialog();
                break;

            case 1:
                DateTime TuNgaya  = dtpkTuNgayChi.Value;
                DateTime denNgaya = dtpkDenNgayChi.Value;

                CrystalReportBaoCaoChiLuongNhanVien cr1 = new CrystalReportBaoCaoChiLuongNhanVien();
                cr1.SetDataSource(BangLuongNhanVienDAO.Instance.getListBangLuongTuNgayDenNgay(TuNgaya, denNgaya));
                ParameterFieldDefinitions crParameterFieldDefinitions1 = cr1.DataDefinition.ParameterFields;

                ParameterFieldDefinition crParameterFieldDefinition1 = crParameterFieldDefinitions1["TuNgay"];
                ParameterDiscreteValue   crParameterDiscreteValue1   = new ParameterDiscreteValue();
                crParameterDiscreteValue1.Value = TuNgaya;
                ParameterValues crParameterValues1 = new ParameterValues();
                //reset lại value
                crParameterValues1 = crParameterFieldDefinition1.CurrentValues;
                crParameterValues1.Add(crParameterDiscreteValue1);
                crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);

                ParameterFieldDefinition crParameterFieldDefinitionDenNgay1 = crParameterFieldDefinitions1["DenNgay"];
                ParameterDiscreteValue   crParameterDiscreteValueDenNgay1   = new ParameterDiscreteValue();
                crParameterDiscreteValueDenNgay1.Value = denNgaya;
                ParameterValues crParameterValuesDenNgay1 = new ParameterValues();
                //reset lại value
                crParameterValuesDenNgay1 = crParameterFieldDefinitionDenNgay1.CurrentValues;
                crParameterValuesDenNgay1.Add(crParameterDiscreteValueDenNgay1);
                crParameterFieldDefinitionDenNgay1.ApplyCurrentValues(crParameterValuesDenNgay1);
                fReport f1 = new fReport(cr1);
                f1.ShowDialog();
                break;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Xem chi tiết báo cáo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChiTiet_Click(object sender, EventArgs e)
        {
            switch (((PhuongThuctimKiem)cbThongKe.SelectedItem).Loai)
            {
            case 0:
                string   tenma   = StaticClass.xoakhoangtrang(txbSearchFood.Text);
                DateTime tuNgay  = dtpkTuNgay.Value;
                DateTime denNgay = dtpkDenNgay.Value;

                CrystalReportThongKeTenMonAn cr = new CrystalReportThongKeTenMonAn();
                cr.SetDataSource(HoaDonDAO.Instance.USP_getThongKeTheoTenchiTiet(tenma, tuNgay, denNgay));
                ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;

                ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["TuNgay"];
                ParameterDiscreteValue   crParameterDiscreteValue   = new ParameterDiscreteValue();
                crParameterDiscreteValue.Value = tuNgay;
                ParameterValues crParameterValues = new ParameterValues();
                //reset lại value
                crParameterValues = crParameterFieldDefinition.CurrentValues;
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                ParameterFieldDefinition crParameterFieldDefinitionDenNgay = crParameterFieldDefinitions["DenNgay"];
                ParameterDiscreteValue   crParameterDiscreteValueDenNgay   = new ParameterDiscreteValue();
                crParameterDiscreteValueDenNgay.Value = denNgay;
                ParameterValues crParameterValuesDenNgay = new ParameterValues();
                //reset lại value
                crParameterValuesDenNgay = crParameterFieldDefinitionDenNgay.CurrentValues;
                crParameterValuesDenNgay.Add(crParameterDiscreteValueDenNgay);
                crParameterFieldDefinitionDenNgay.ApplyCurrentValues(crParameterValuesDenNgay);
                fReport f = new fReport(cr);
                f.ShowDialog();
                break;

            case 1:
                string   tenLoai     = StaticClass.xoakhoangtrang(txbSearchFood.Text);
                DateTime tuNgayLoai  = dtpkTuNgay.Value;
                DateTime denNgayLoai = dtpkDenNgay.Value;
                CrystalReportThongKeLoaiMonAn crLoai = new CrystalReportThongKeLoaiMonAn();
                crLoai.SetDataSource(HoaDonDAO.Instance.USP_getThongKeTheoLoaichiTiet(tenLoai, tuNgayLoai, denNgayLoai));
                ParameterFieldDefinitions crParameterFieldDefinitionsLoai = crLoai.DataDefinition.ParameterFields;

                ParameterFieldDefinition crParameterFieldDefinitionLoai = crParameterFieldDefinitionsLoai["TuNgay"];
                ParameterDiscreteValue   crParameterDiscreteValueLoai   = new ParameterDiscreteValue();
                crParameterDiscreteValueLoai.Value = tuNgayLoai;
                ParameterValues crParameterValuesLoai = new ParameterValues();
                //reset lại value
                crParameterValues = crParameterFieldDefinitionLoai.CurrentValues;
                crParameterValues.Add(crParameterDiscreteValueLoai);
                crParameterFieldDefinitionLoai.ApplyCurrentValues(crParameterValues);

                ParameterFieldDefinition crParameterFieldDefinitionDenNgayLoai = crParameterFieldDefinitionsLoai["DenNgay"];
                ParameterDiscreteValue   crParameterDiscreteValueDenNgayLoai   = new ParameterDiscreteValue();
                crParameterDiscreteValueDenNgayLoai.Value = denNgayLoai;
                ParameterValues crParameterValuesDenNgayLoai = new ParameterValues();
                //reset lại value
                crParameterValuesDenNgayLoai = crParameterFieldDefinitionDenNgayLoai.CurrentValues;
                crParameterValuesDenNgayLoai.Add(crParameterDiscreteValueDenNgayLoai);
                crParameterFieldDefinitionDenNgayLoai.ApplyCurrentValues(crParameterValuesDenNgayLoai);
                fReport fLoai = new fReport(crLoai);
                fLoai.ShowDialog();
                break;
            }
        }