Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReportBaoCaoChiLuongNhanVien rpt = new CrystalReportBaoCaoChiLuongNhanVien();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
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;
            }
        }