Exemplo n.º 1
0
        private void simpleButton6_Click(object sender, EventArgs e)
        {
            rpPhieuban = new report.phieuban();

            using (ReportPrintTool printTool = new ReportPrintTool(rpPhieuban))
            {
                // Invoke the Ribbon Print Preview form modally,
                // and load the report document into it.
                printTool.ShowRibbonPreviewDialog();

                // Invoke the Ribbon Print Preview form
                // with the specified look and feel setting.
                printTool.ShowRibbonPreviewDialog(UserLookAndFeel.Default);
            }
        }
        private void UiBarButtonConsolidado_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var devolucionesConsolidadas = RecepcionesPorDevoluciones
                                           .Where(d => d.QTY > 0)
                                           .GroupBy(d => new { d.INVOICE_DOC_NUM })
                                           .Select(dc => new ReporteRecepcionPorDevolucion
            {
                INVOICE_DOC_NUM         = dc.Key.INVOICE_DOC_NUM
                , ERP_REFERENCE_DOC_NUM = dc.First().ERP_REFERENCE_DOC_NUM
                , CLIENT_CODE           = dc.First().CLIENT_CODE
                , CLIENT_NAME           = dc.First().CLIENT_NAME
                , QTY = dc.Sum(d => d.QTY)
            });

            var cantidadNotasDeCredito =
                devolucionesConsolidadas.Where(d => d.ERP_REFERENCE_DOC_NUM != null).ToList().Count;

            var reporte = new Reportes.ReporteDevolucionesConsolidado()
            {
                DataSource        = devolucionesConsolidadas,
                RequestParameters = false
            };

            reporte.Parameters["ParametroUsuario"].Value       = InteraccionConUsuarioServicio.ObtenerUsuario();
            reporte.Parameters["ImagenLogo"].Value             = InteraccionConUsuarioServicio.ObtenerLogo();
            reporte.Parameters["CantidadNotasDeCredito"].Value = cantidadNotasDeCredito;
            reporte.FillDataSource();

            using (var printTool = new ReportPrintTool(reporte))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 3
0
        private void UiBtnImprimirReporte_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (UiVistaInventarioPorAcuerdoComercial.DataSource == null)
            {
                InteraccionConUsuarioServicio.Mensaje(
                    "No se encontraron datos para generar el reporte, por favor, verifique y vuelva a intentar.");
            }
            else
            {
                var listaDeInventarioPorAcuerdoComercial = new List <AcuerdoComercial>();
                for (var i = 0; i < UiVistaInventarioPorAcuerdoComercial.Views[0].RowCount; i++)
                {
                    listaDeInventarioPorAcuerdoComercial.Add((AcuerdoComercial)UiVistaInventarioPorAcuerdoComercial.Views[0].GetRow(i));
                }
                var reporte = new Reportes.AcuerdoComercialPorInventario
                {
                    DataSource        = ListToDataTableClass.ListToDataTable(listaDeInventarioPorAcuerdoComercial),
                    DataMember        = "AcuerdoComercial",
                    RequestParameters = false
                };
                reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
                reporte.FillDataSource();

                using (var printTool = new ReportPrintTool(reporte))
                {
                    printTool.ShowRibbonPreviewDialog();
                }
            }
        }
        private void UiBotonReportePorDocumento_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (PolizasMaestroDetalle == null || PolizasMaestroDetalle.IsEmpty() || PolizasMaestroDetalle.Count(x => x.IS_SELECTED) == 0)
            if (PolizasMaestroDetalle == null || PolizasMaestroDetalle.Count(x => x.IS_SELECTED) == 0)
            {
                return;
            }
            var documentosSeleccionados = PolizasMaestroDetalle.Where(detalle => detalle.IS_SELECTED).Select(x => new { x.DOC_ID }).Distinct().ToList();


            var reporte = new Reportes.ConsultaCosteosPorDocumento
            {
                DataSource        = ListToDataTableClass.ListToDataTable(PolizasMaestroDetalle.Where(detalle => documentosSeleccionados.Exists(s => s.DOC_ID == detalle.DOC_ID)).ToList()),
                DataMember        = "COSTEOS_POR_DOCUMENTO",
                RequestParameters = false
            };

            reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
            reporte.FillDataSource();

            using (var printTool = new ReportPrintTool(reporte))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 5
0
        private void UiBarButtonImprimir_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (SolicitudesDeTraslado == null)
            {
                return;
            }
            var listaSolicitudes = new List <SolicitudDeTrasladoEncabezado>();

            for (var i = 0; i < UiVistaSolicitud.RowCount; i++)
            {
                listaSolicitudes.Add((SolicitudDeTrasladoEncabezado)UiVistaSolicitud.GetRow(i));
            }
            var reporte = new Reportes.ReporteDeSolicitudDeTraslado
            {
                DataSource = ListToDataTableClass.ListToDataTable(listaSolicitudes)
                ,
                RequestParameters = false
            };

            reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
            reporte.FillDataSource();

            using (var printTool = new ReportPrintTool(reporte))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 6
0
        private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Print.Barcode   barcode   = new Print.Barcode();
            ReportPrintTool printTool = new ReportPrintTool(barcode);

            printTool.ShowRibbonPreviewDialog();
        }
Exemplo n.º 7
0
 private void TsbtnPrint_Click(object sender, EventArgs e)
 {
     using (ReportPrintTool printTool = new ReportPrintTool(rpt))
     {
         printTool.ShowRibbonPreviewDialog();
     }
 }
Exemplo n.º 8
0
        public static void ShowReport(Decimal dptid)
        {
            SqlConnection con = new SqlConnection(Properties.Settings.Default.strCon);

            if (con.State != System.Data.ConnectionState.Open)
            {
                con.Open();
            }
            DispatchReport rpt = new DispatchReport();
            DataSet        ds  = new DataSet();
            SqlCommand     cmd = new SqlCommand("Select * from DispatchHeader where DptId=" + dptid.ToString(), con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);

            adp.Fill(ds, "DispatchHeader");

            cmd = new SqlCommand("Select * from DispatchLine where DptId=" + dptid.ToString(), con);
            adp = new SqlDataAdapter(cmd);
            adp.Fill(ds, "DispatchLine");

            ds.Relations.Add("DispatchHeaderDispatchLine", ds.Tables["DispatchHeader"].Columns["DptId"], ds.Tables["DispatchLine"].Columns["DptId"]);
            rpt.DataSource = ds;
            using (ReportPrintTool printTool = new ReportPrintTool(rpt))
            {
                // printTool.Print("TSC TA210");
                printTool.ShowRibbonPreviewDialog();
                //or printTool.PrintDialog();
            }

            cmd.Dispose();
            con.Dispose();
        }
Exemplo n.º 9
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "PRNX files|*.prnx";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                ReportPrintTool printTool = new ReportPrintTool(new XtraReport());

                // Access the Print Tool's Printing System and load the report document.
                if (System.IO.File.Exists(openFileDialog.FileName))
                {
                    printTool.PrintingSystem.LoadDocument(openFileDialog.FileName);
                }
                else
                {
                    System.Console.WriteLine("The source file does not exist.");
                }

                // Load a Print Preview in a dialog window.
                // printTool.ShowPreviewDialog()
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 레포트 출력 버튼 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Report_Click(object sender, EventArgs e)
        {
            if (string.Empty == txt_Remark.Text)        // 비고란 빈칸 검증
            {
                MessageBox.Show("비고란을 입력해주세요.", "오류");
                txt_Remark.Focus();
                return;
            }
            else if (gridView1.RowCount == 0)
            {
                MessageBox.Show("조회 후 출력이 가능합니다. 조회 먼저 실행해 주세요.", "오류");
                txt_Remark.Text = string.Empty;
                return;
            }
            string startDate = date_StartDate.Value.ToString("yyyy-MM-dd");
            string endDate   = date_EndDate.Value.ToString("yyyy-MM-dd");
            string remark    = txt_Remark.Text;

            DataSet ds = GetChartBarInfo();                            // DB에서 바 차트 정보 가져오기

            Report1 report1 = new Report1(startDate, endDate, remark); // 시작일, 종료일, 비고 전달해서 바로 출력하기 위해 값 같이 넘김

            report1.DataSource = ds;                                   // 레포트 datasource에 가져온 dataset 설정
            //report1.DataMember = "DATA";

            using (ReportPrintTool printTool = new ReportPrintTool(report1)) // 레포트 미리보기 팝업
            {
                printTool.ShowRibbonPreviewDialog();
            }

            txt_Remark.Text = string.Empty; // 비고란 지우기
        }
Exemplo n.º 11
0
        private void UiBotonReporte_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (Cajas == null)
                {
                    return;
                }

                UiVistaPrincipal.ExpandAllGroups();
                var listaCajas = GetFilteredData <Caja>(UiVistaPrincipal);

                var reporte = new Reportes.ConsultaLineaPicking(false)
                {
                    DataSource        = ListToDataTableClass.ListToDataTable(listaCajas),
                    RequestParameters = false
                };
                reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
                reporte.FillDataSource();

                using (var printTool = new ReportPrintTool(reporte))
                {
                    printTool.ShowRibbonPreviewDialog();
                }
            }
            catch (Exception ex)
            {
                InteraccionConUsuarioServicio.MensajeErrorDialogo(ex.Message);
            }
        }
Exemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <string> chkList = new List <string>();

            for (int i = 0; i < dgvBORList.Rows.Count; i++)
            {
                bool isCellChecked = (bool)dgvBORList.Rows[i].Cells[0].EditedFormattedValue;
                if (isCellChecked)
                {
                    chkList.Add(dgvBORList.Rows[i].Cells[1].Value.ToString());
                }
            }
            if (chkList.Count == 0)
            {
                MessageBox.Show("출력할 바코드를 선택해주세요.");
                return;
            }

            string strChkBarCodes = string.Join(",", chkList);

            BORService  service = new BORService();
            XtraBORList rpt     = new XtraBORList();

            DataTable dt = service.GetBaCodeBORList(strChkBarCodes);

            rpt.Parameters["uName"].Value = LoginInfo.UserInfo.LI_NAME;
            rpt.DataSource = dt;
            rpt.CreateDocument();
            using (ReportPrintTool printTool = new ReportPrintTool(rpt))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 13
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (XtraReport report = new XtraReport1())
         using (ReportPrintTool printTool = new ReportPrintTool(report)) {
             printTool.ShowRibbonPreviewDialog();
         }
 }
        private void UiBarButtonReporte_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                var reporte = new Reportes.ConsultaDeInventarioDiario()
                {
                    DataSource        = ListToDataTableClass.ListToDataTable(Inventario.ToList()),
                    RequestParameters = false
                };

                reporte.Parameters["Usuario"].Value    = InteraccionConUsuarioServicio.ObtenerNombreUsuario();
                reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
                reporte.FillDataSource();

                using (var printTool = new ReportPrintTool(reporte))
                {
                    printTool.ShowRibbonPreviewDialog();
                }
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                InteraccionConUsuarioServicio.MensajeErrorDialogo(ex.Message);
            }
        }
Exemplo n.º 15
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (XtraReport report = CreateTreeListReport())
     {
         ReportPrintTool pt = new ReportPrintTool(report);
         pt.ShowRibbonPreviewDialog();
     }
 }
Exemplo n.º 16
0
 public BarCode(XtraReport rpt)
 {
     InitializeComponent();
     using (ReportPrintTool printTool = new ReportPrintTool(rpt))
     {
         printTool.ShowRibbonPreviewDialog();
     }
 }
Exemplo n.º 17
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            // Show the report's Print Preview
            XtraReport1     report    = new XtraReport1();
            ReportPrintTool printTool = new ReportPrintTool(report);

            printTool.ShowRibbonPreviewDialog();
        }
        private void radButtonElement2_Click(object sender, EventArgs e)
        {
            ReportPrintTool printTool = new ReportPrintTool(new RevenueReport());

            // Invoke the Ribbon Print Preview form modally
            // with the specified look and feel settings.
            printTool.ShowRibbonPreviewDialog(UserLookAndFeel.Default);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     // Create a cross-tab report.
     using (XtraReport report = CreateReport())
         using (ReportPrintTool tool = new ReportPrintTool(report)) {
             // Show its Print Preview.
             tool.ShowRibbonPreviewDialog();
         }
 }
Exemplo n.º 20
0
        private void button1_Click(object sender, EventArgs e)
        {
            XtraReport1 report = new XtraReport1();

            using (ReportPrintTool tool = new ReportPrintTool(report)) {
                report.PrintControl = tool.PreviewRibbonForm.PrintControl;
                tool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 21
0
        public void ExibirNaTela()
        {
            var rpt = AtualizarLogoDoBancoNoModelo();

            var pt = new ReportPrintTool(rpt);

            pt.AutoShowParametersPanel = true;
            pt.ShowRibbonPreviewDialog();
        }
Exemplo n.º 22
0
        public void ShowReport()
        {
            XtraReport report = ReportGenerator.GenerateReport(gridView);

            using (ReportPrintTool printTool = new ReportPrintTool(report))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 23
0
        // phiếu rút tiền
        private void barButtonItem_phieuthu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PhieuRutTien    phieuChi        = new PhieuRutTien();
            ReportPrintTool reportPrintTool = new ReportPrintTool(phieuChi);
            UserLookAndFeel userLookAndFeel = new UserLookAndFeel(this);

            userLookAndFeel.UseDefaultLookAndFeel = false;
            userLookAndFeel.SkinName = "Office 2016 colorful";
            reportPrintTool.ShowRibbonPreviewDialog(userLookAndFeel);
        }
Exemplo n.º 24
0
        private void TsbtnPrint_Click(object sender, EventArgs e)
        {
            ProductionRequest rpt = new ProductionRequest();

            rpt.DataSource = dt;
            using (ReportPrintTool printTool = new ReportPrintTool(rpt))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 25
0
        private void btnReport_Click(object sender, EventArgs e)
        {
            TwitReport order = new TwitReport();

            order.DataSource = CreateData(twits);
            ReportPrintTool tool = new ReportPrintTool(order);

            tool.ShowRibbonPreviewDialog();
            btnReport.Enabled = false;
        }
Exemplo n.º 26
0
        // xuất ra phiếu gửi tiền
        private void btn_phieuguitien_Click(object sender, EventArgs e)
        {
            PhieuGuiTien    phieuChi        = new PhieuGuiTien();
            ReportPrintTool reportPrintTool = new ReportPrintTool(phieuChi);
            UserLookAndFeel userLookAndFeel = new UserLookAndFeel(this);

            userLookAndFeel.UseDefaultLookAndFeel = false;
            userLookAndFeel.SkinName = "Office 2016 colorful";
            reportPrintTool.ShowRibbonPreviewDialog(userLookAndFeel);
        }
        private void GenerarReporte()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                var listaDeEncabezadosSeleccionados =
                    InventarioComprometidoEncabezados.Where(enc => enc.IS_SELECTED).ToList();

                if (listaDeEncabezadosSeleccionados.Count == 0)
                {
                    return;
                }

                var listaDeReporte = (from encabezado in listaDeEncabezadosSeleccionados
                                      let listaDetalles = InventarioComprometidoTodosDetalles.Where(det => det.WAVE_PICKING_ID == encabezado.WAVE_PICKING_ID).ToList()
                                                          from detalle in listaDetalles
                                                          select new InventarioComprometidoParaReporte
                {
                    DOC_NUM = encabezado.DOC_NUM,
                    CLIENT_CODE = encabezado.CLIENT_CODE,
                    CLIENT_NAME = encabezado.CLIENT_NAME,
                    WAVE_PICKING_ID = encabezado.WAVE_PICKING_ID,
                    ERP_DOCUMENT = encabezado.ERP_DOCUMENT,
                    LABEL_ID = detalle.LABEL_ID,
                    LOCATION_SPOT = detalle.LOCATION_SPOT,
                    MATERIAL_ID = detalle.MATERIAL_ID,
                    MATERIAL_NAME = detalle.MATERIAL_NAME,
                    QTY = detalle.QTY,
                    DELIVERY_STATUS = detalle.DELIVERY_STATUS
                }).ToList();

                var reporte = new ReporteInventarioComprometido()
                {
                    DataSource        = ListToDataTableClass.ListToDataTable(listaDeReporte),
                    RequestParameters = false
                };

                reporte.Parameters["ImagenLogo"].Value = InteraccionConUsuarioServicio.ObtenerLogo();
                reporte.Parameters["Usuario"].Value    = InteraccionConUsuarioServicio.ObtenerUsuario();
                reporte.FillDataSource();

                using (var printTool = new ReportPrintTool(reporte))
                {
                    printTool.ShowRibbonPreviewDialog();
                }
            }
            catch (Exception ex)
            {
                InteraccionConUsuarioServicio.MensajeErrorDialogo(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private void Report_Print_Preview(string action)
        {
            XtraReport_EmployeeAttendance Xtra_Report_EmployeeAttendanceList = new XtraReport_EmployeeAttendance();

            DynamicParameters paramSalary = new DynamicParameters();

            paramSalary.Add("@Emp_Code_Processing", txtEmpCode.EditValue);
            paramSalary.Add("@Salary_Month", DtStartDate.EditValue);
            paramSalary.Add("@Deduct_Advance", 1);
            paramSalary.Add("@Deduct_Loan", 1);
            paramSalary.Add("@TeaRate", 0);
            paramSalary.Add("@NoOfCups", 0);


            DynamicParameters param = new DynamicParameters();

            param.Add("@EmpCode", txtEmpCode.EditValue);
            param.Add("@Attendance_Month", DtStartDate.EditValue);

            DynamicParameters paramEmp = new DynamicParameters();

            paramEmp.Add("@EmpCode", txtEmpCode.EditValue);

            ProgramMasterModel programMaster = ProgramMasterData.GetProgramMasterModel(GlobalVariables.ProgCode);



            EmployeeAttendanceDetails_Model employeeAttendanceDetails_Model = new EmployeeAttendanceDetails_Model
            {
                EmpCode                     = txtEmpCode.EditValue + string.Empty,
                AttendanceMonth             = ConvertTo.DateTimeVal(DtStartDate.EditValue),
                EmployeeAttendance_Get_List = EmployeeData.EmployeeAttendance_Get(programMaster.ProgProcName + "_v2", param),
                EmployeesSalaryList         = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", paramSalary),
                EmployeeMasterDataList      = EmployeeData.GetEmployeeMasterDataList("sp_LoadEmpMstFEditing", paramEmp)
            };

            //EmployeeMasterModel
            attendanceBindingSource.DataSource = employeeAttendanceDetails_Model;

            Xtra_Report_EmployeeAttendanceList.DataSource = attendanceBindingSource;

            //MessageBox.Show(employeeAttendanceDetails_Model.EmployeesSalaryList.Count + "");

            ReportPrintTool tool = new ReportPrintTool(Xtra_Report_EmployeeAttendanceList);

            if (action.Equals("preview"))
            {
                tool.ShowRibbonPreviewDialog();
            }
            if (action.Equals("print"))
            {
                tool.PrintDialog();
            }
        }
Exemplo n.º 29
0
        private void attendantListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var source = _db.Attendants.Where(a => !a.IsInactive).OrderBy(a => a.AgeGroupID).ThenBy(a => a.LastName).ThenBy(a => a.FirstName).ToList();
            var report = new AttendantListReport();

            report.DataSource = source;

            using (ReportPrintTool printTool = new ReportPrintTool(report))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 30
0
        private void familySummaryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var source = AttendantSummary.Load(_db, Properties.Settings.Default.StartDate, Properties.Settings.Default.EndDate);
            var report = new FamilySummaryReport();

            report.DataSource = source;

            using (ReportPrintTool printTool = new ReportPrintTool(report))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 31
0
 private void fRpt_Load(object sender, EventArgs e)
 {
     rptDonDatHang _rptDonDatHang = new rptDonDatHang();
     _rptDonDatHang.obj = objDonDatHang;
     _rptDonDatHang.DataSource = dtDonDatHangCT;
     _rptDonDatHang.DataMember = "ChiTietDonHang";
     using (ReportPrintTool printTool = new ReportPrintTool(_rptDonDatHang))
     {
         printTool.ShowRibbonPreviewDialog();
         printTool.ShowRibbonPreview(UserLookAndFeel.Default);
     }
     this.Close();
 }
Exemplo n.º 32
0
        private void btnGraphReport_Click(object sender, RoutedEventArgs e)
        {
            DashboardReportDesign.seriesList1.Clear();
            DashboardReportDesign.seriesList2.Clear();
            DashboardReportDesign.seriesList3.Clear();
            using (var context = new DatabaseContext())
            {
                List<DashboardReportData> dataList = new List<DashboardReportData>();

                #region Leads per month
                var leads = (from c in context.Leads.ToList() select c).Distinct().ToList();
                int LeadsMonth = 0;
                DateTime[] months = { DateTime.Now.AddMonths(-2), DateTime.Now.AddMonths(-1), DateTime.Now };
                if (months[0].Month >= DateTime.Now.Month && months[1].Month >= DateTime.Now.Month)
                {
                    months[0].AddYears(-1);
                    months[1].AddYears(-1);
                }
                int countLeads = 0;
                DevExpress.XtraCharts.Series leadSeries = new DevExpress.XtraCharts.Series();

                foreach (var month in months)
                {
                    foreach (var lead in leads)
                    {
                        leadSeries = new DevExpress.XtraCharts.Series(month.ToString("MMM"), ViewType.StackedBar);

                        if (Convert.ToDateTime(lead.DateAdded).Month == month.Month && Convert.ToDateTime(lead.DateAdded).Year == month.Year)
                        {
                            countLeads++;
                            LeadsMonth++;
                        }
                    }

                    leadSeries.Points.Add(new DevExpress.XtraCharts.SeriesPoint(month.ToString("MMM yyyy"), countLeads));
                    leadSeries.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;
                    DashboardReportDesign.seriesList1.Add(leadSeries);
                    countLeads = 0;
                }
                #endregion

                #region Leads per year
                leads = (from c in context.Leads.ToList() select c).Distinct().ToList();
                DateTime[] years = { DateTime.Now.AddYears(-2), DateTime.Now.AddYears(-1), DateTime.Now };
                countLeads = 0; int LeadsYear = 0;
                DevExpress.XtraCharts.Series leadSeriesPerYear = new DevExpress.XtraCharts.Series();

                foreach (var year in years)
                {
                    foreach (var lead in leads)
                    {
                        leadSeriesPerYear = new DevExpress.XtraCharts.Series(year.ToString("yyyy"), ViewType.StackedBar);

                        if (Convert.ToDateTime(lead.DateAdded).Year == year.Year)
                        {
                            countLeads++;
                            LeadsYear++;
                        }
                    }

                    leadSeriesPerYear.Points.Add(new DevExpress.XtraCharts.SeriesPoint(year.ToString("yyyy"), countLeads));
                    leadSeriesPerYear.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;
                    DashboardReportDesign.seriesList2.Add(leadSeriesPerYear);
                    countLeads = 0;
                }
                #endregion

                #region Leads per Sales Stage
                leads = (from c in context.Leads.ToList() select c).Distinct().ToList();
                var salesStages = context.SalesStages.ToList();
                countLeads = 0; int LeadsStatus = 0;
                DevExpress.XtraCharts.Series leadSeriesPerStage = new DevExpress.XtraCharts.Series();
                leadSeriesPerStage = new DevExpress.XtraCharts.Series("Sales Stages", ViewType.Doughnut);

                foreach (var salesStage in salesStages)
                {
                    foreach (var lead in leads)
                    {
                        if (lead.Status == salesStage.SalesStageName)
                        {
                            countLeads++;
                            LeadsStatus++;
                        }
                    }

                    leadSeriesPerStage.Points.Add(new DevExpress.XtraCharts.SeriesPoint(salesStage.SalesStageName, countLeads));
                    leadSeriesPerStage.LegendTextPattern = "{A} : {V}";
                    countLeads = 0;
                }
                leadSeriesPerStage.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;
                DashboardReportDesign.seriesList3.Add(leadSeriesPerStage);
                #endregion

                #region Overall Leads
                leads = context.Leads.ToList();
                List<string> statuses = new List<string>() {"Engaged client", "Active", "Not active"};
                countLeads = 0; int overAll = leads.Count(); string percent = "";

                foreach (var status in statuses)
                {
                    foreach (var item in leads)
                    {
                        var customerAccount = context.Customers.FirstOrDefault(c => c != null && c.LeadID == item.LeadID);

                        if (item.IsActive == true && status == statuses[0] && customerAccount != null && item.Status == "New Customer")
                        {
                            countLeads++;
                        }
                        else if (item.IsActive == true && status == statuses[1] && customerAccount == null)
                        {
                            countLeads++;
                        }
                        else if (item.IsActive == false && status == statuses[2] && customerAccount == null)
                        {
                            countLeads++;
                        }
                    }

                    Compute(countLeads, overAll, out percent);
                    countLeads = 0;

                    if (status == statuses[0])
                    {
                        if (Convert.ToInt32(percent) < 10)
                        {
                            DashboardReportDesign.lblEngaged.Text = "0" + percent + "%";
                        }
                        else
                        {
                            DashboardReportDesign.lblEngaged.Text = percent + "%";
                        }
                    }
                    else if (status == statuses[1])
                    {
                        if (Convert.ToInt32(percent) < 10)
                        {
                            DashboardReportDesign.lblActive.Text = "0" + percent + "%";
                        }
                        else
                        {
                            DashboardReportDesign.lblActive.Text = percent + "%";
                        }
                    }
                    else if (status == statuses[2])
                    {
                        if (Convert.ToInt32(percent) < 10)
                        {
                            DashboardReportDesign.lblNotActive.Text = "0" + percent + "%";
                        }
                        else
                        {
                            DashboardReportDesign.lblNotActive.Text = percent + "%";
                        }
                    }
                }
                #endregion

                dataList.Add(new DashboardReportData
                {
                    ReportHeader = "NSPIRE INC.",
                    ReportTitle = "GRAPH REPORT as of " + DateTime.Now.ToString("MMMM d, yyyy"),
                    TotalLeads = overAll,
                    TotalLeadsMonth = LeadsMonth,
                    TotalLeadsSalesStage = LeadsStatus,
                    TotalLeadsYear = LeadsYear
                });

                var report = new DashboardReportDesign()
                {
                    DataSource = dataList.Distinct(),
                    Name = "GRAPH REPORT as of " + DateTime.Now.ToString("MMMM d, yyyy")
                };

                using (ReportPrintTool printTool = new ReportPrintTool(report))
                {
                    printTool.ShowRibbonPreviewDialog();
                }
            }
        }
Exemplo n.º 33
0
        private void GenerarFicheroFacturaPdfToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (!DatosLineaValido()) return;
            bsFactura.EndEdit();
            Factura factura = bsFactura.Current as Factura;

            ActualizarContadoresLineas();

            try
            {
                XtraReportFactura xtraReport=new XtraReportFactura
                {
                    Factura=factura
                };

                xtraReport.Parameters["licenciaMunicipal"].Value = Settings.Default.licencia;
                xtraReport.Parameters["email"].Value = Settings.Default.email;
                xtraReport.Parameters["Movil"].Value = Settings.Default.movil;
                xtraReport.Parameters["Nif"].Value = Settings.Default.nif;
                xtraReport.Parameters["Telefono"].Value = Settings.Default.telefono;
                xtraReport.Parameters["nombre"].Value = Settings.Default.nombre;
                xtraReport.Parameters["direccion"].Value = Settings.Default.direccion;
                xtraReport.Parameters["poblacion"].Value = Settings.Default.poblacionCP;

                if (!string.IsNullOrEmpty(Settings.Default.Iban))
                {
                    xtraReport.Parameters["poblacion"].Value = string.Format("IBAN: {0}", Settings.Default.Iban);
                }
                else
                {
                    xtraReport.Parameters["poblacion"].Value = string.Format("IBAN: {0}", Settings.Default.ccc);
                }

                SetTextWatermark(xtraReport);

                using (ReportPrintTool printTool = new ReportPrintTool(xtraReport))
                {
                    // Invoke the Ribbon Print Preview form modally,
                    // and load the report document into it.
                    printTool.ShowRibbonPreviewDialog();

                    // Invoke the Ribbon Print Preview form
                    // with the specified look and feel setting.
                    printTool.ShowRibbonPreview(UserLookAndFeel.Default);
                }
                //(new PdfGenerador(factura)).Run();
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }

            if (factura != null) Settings.Default.ultimaFactura = factura.Numero;
            Settings.Default.Save();
        }
Exemplo n.º 34
0
        private void btnPrintContact_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                int itemNo = 0;
                if (contactsList.Count() > 0)
                {
                    List<ContactsReportData> dataList = new List<ContactsReportData>();
                    List<ContactsReportDetail> detailsList = new List<ContactsReportDetail>();
                    foreach (var contact in contactsList)
                    {
                        itemNo++;
                        var detail = new ContactsReportDetail();

                        detail.CompanyName = contact.Company;
                        detail.ContactNo = itemNo;
                        detail.ContactPerson = contact.ContactPersonName;
                        detail.PhoneNo = contact.PhoneNo;
                        detail.Position = contact.Position;
                        detailsList.Add(detail);
                    }
                    dataList.Add(new ContactsReportData()
                    {
                        ReportHeader = "CONTACT PERSONS",
                        ReportTitle = "CONTACT PERSONS as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalContacts = detailsList.Count(),
                        details = detailsList
                    });

                    var report = new ContactsReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "CONTACT PERSONS as of "
                            + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new NoticeWindow();
                    NoticeWindow.message = "No details to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }
Exemplo n.º 35
0
        private void btnPrintLead_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                int itemNo = 0;
                if (leadsList.Count() > 0)
                {
                    List<LeadsReportData> dataList = new List<LeadsReportData>();
                    List<LeadsReportDetail> detailsList = new List<LeadsReportDetail>();
                    foreach (var lead in leadsList)
                    {
                        itemNo++;
                        var detail = new LeadsReportDetail();
                        detail.Address = lead.CompanyAddress;
                        detail.CompanyName = lead.CompanyName;
                        detail.LeadNo = itemNo;
                        detail.SalesStageStatus = lead.SalesStageStatus;
                        detail.Territory = lead.TerritoryName;
                        detailsList.Add(detail);
                    }
                    dataList.Add(new LeadsReportData()
                    {
                        ReportHeader = "LEADS",
                        ReportTitle = "LEADS as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalLeads = detailsList.Count(),
                        details = detailsList
                    });

                    var report = new LeadsReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "LEADS as of "
                            + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new NoticeWindow();
                    NoticeWindow.message = "No data to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                var activities = activityList.ToList();
                int itemNo = 0;
                var lead = context.Leads.FirstOrDefault(c => c.LeadID == LeadId);
                if (activities.Count() > 0)
                {
                    List<LeadActivityReportData> dataList = new List<LeadActivityReportData>();
                    List<LeadActivityReportDetail> detailsList = new List<LeadActivityReportDetail>();

                    foreach (var leadActivity in activities)
                    {
                        var contact = context.Contacts.FirstOrDefault(c => c.ContactPersonName == leadActivity.ContactPerson);

                        if (leadActivity.CompanyName == lead.CompanyName)
                        {
                            itemNo++;
                            var detail = new LeadActivityReportDetail();

                            detail.ActivityDate = leadActivity.ActivityDate;
                            detail.ActivityNo = itemNo;
                            detail.ActivityTime = leadActivity.ActivityTime;
                            detail.ClientResponse = leadActivity.ClientResponse;
                            detail.CompanyName = leadActivity.CompanyName;
                            detail.Cost = leadActivity.Cost;
                            detail.Description = leadActivity.Description;
                            detail.DetailsOfTransaction = leadActivity.TransactionDetails;
                            detail.DueDateOfNextStep = leadActivity.NextStepDueDate;
                            detail.MarketingVoucherNo = leadActivity.MarketingVoucher;
                            detail.NextStep = leadActivity.NextStep;
                            detail.SalesRep = leadActivity.SalesRep;
                            if (contact != null) { detail.ContactPerson = contact.ContactPersonName; }
                            else { detail.ContactPerson = ""; }
                            detailsList.Add(detail);
                        }
                    }

                    dataList.Add(new LeadActivityReportData()
                    {
                        ReportHeader = "LEAD ACTIVITIES",
                        ReportTitle = "LEAD ACTIVITIES of " + lead.CompanyName.ToUpper()
                        + " as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalActivities = detailsList.Count(),
                        details = detailsList
                    });

                    var report = new LeadActivityReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "LEAD ACTIVITIES of " + lead.CompanyName.ToUpper()
                        + " as of " + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new NoticeWindow();
                    NoticeWindow.message = "No data to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }
Exemplo n.º 37
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
                return;
            try
            {
                SplashScreenManager.ShowForm(this, typeof(PleaseWaitForm), false, false, false);
                DateTime first = new DateTime(Convert.ToInt32(cbYear.EditValue), Convert.ToInt32(cbMonth.EditValue), 1);
                DateTime last = new DateTime(Convert.ToInt32(cbYear.EditValue), Convert.ToInt32(cbMonth.EditValue),
                    DateTime.DaysInMonth(Convert.ToInt32(cbYear.EditValue), Convert.ToInt32(cbMonth.EditValue)));

                driver d = driver.SingleOrDefault(Convert.ToInt64(cbDriver.EditValue));
                List<FeesDriverList> fdl = new List<FeesDriverList>();
                string sql = String.Format("WHERE driver_id = {0} AND start::date BETWEEN '{1:yyyy-MM-dd}' AND '{2:yyyy-MM-dd}' ORDER BY start",
                    d.id, first, last);
                List<freight> fre = freight.Fetch(sql);
                if (fre.Count <= 0)
                {
                    SplashScreenManager.CloseForm(false);
                    XtraMessageBox.Show("Não foi encontrado resultados para este período!");
                    return;
                }
                foreach (freight fr in fre)
                {
                    fdl.Add(new FeesDriverList()
                    {
                        date = Convert.ToDateTime(fr.start),
                        driver = d.full_name,
                        freight_id = fr.id.ToString(),
                        value = fr.value_comission
                    });
                }

                FeesDriverModel f = new FeesDriverModel();
                f.feesList = fdl;
                f.document_driver = d.cpf;
                f.driver = d.full_name;
                f.emission_at = String.Format("Emitido em {0:dd/MM/yyyy HH:mm}", driver.Now());
                f.reference = String.Format("Referente à {0} de {1}", cbMonth.Text, cbYear.EditValue);
                f.signature = "Emitido por CadoreTecnologia";

                FeesDriverReport report = new FeesDriverReport();
                report.bdgFees.DataSource = f;

                foreach (DevExpress.XtraReports.Parameters.Parameter p in report.Parameters)
                {
                    p.Visible = false;
                }
                /*PdfExportOptions po = new PdfExportOptions() {ImageQuality = PdfJpegImageQuality.Highest, Compressed = true };
                report.ExportToPdf("C:\\Users\\William\\Desktop\\testePDF.pdf", po);*/

                /*HtmlExportOptions htmlOptions = report.ExportOptions.Html;
                htmlOptions.CharacterSet = "UTF-8";
                htmlOptions.TableLayout = false;
                htmlOptions.RemoveSecondarySymbols = false;
                htmlOptions.Title = "Teste relatório HTML";
                htmlOptions.ExportMode = HtmlExportMode.SingleFilePageByPage;
                htmlOptions.PageBorderColor = Color.Blue;
                htmlOptions.PageBorderWidth = 3;
                report.ExportToHtml("C:\\Users\\William\\Desktop\\testeHTML.html");*/
                ReportPrintTool tool = new ReportPrintTool(report);
                SplashScreenManager.CloseForm(false);
                tool.ShowRibbonPreviewDialog();
                //this.Close();
            }
            catch (Exception ex)
            {
                SplashScreenManager.CloseForm(false);
                XtraMessageBox.Show(String.Format("Ocorreu um erro:\n{0}\n{1}", ex.Message, ex.InnerException));
            }
        }
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
                return;

            List<freight> llf = null;
            truck _truck = null;
            driver _driver = null;

            long truck_id = Convert.ToInt64(cbTruck.EditValue);
            long driver_id = Convert.ToInt64(cbDriver.EditValue);
            DateTime start = dtStart.DateTime;
            DateTime end = dtEnd.DateTime;

            bool isTruck = ckTruck.Checked;

            if(isTruck)
            {
                _truck = truck.SingleOrDefault(truck_id);
                llf = freight.Fetch(String.Format("WHERE truck_id={0} AND start BETWEEN '{1:yyyy-MM-dd}' AND '{2:yyyy-MM-dd}' ORDER BY start",
                    _truck.id, start, end));
                _driver = driver.SingleOrDefault(_truck.driver_id);
            }
            else if (ckDriver.Checked)
            {
                driver dri = driver.SingleOrDefault(driver_id);
                _truck = truck.SingleOrDefault("WHERE driver_id=@0", driver_id);
                llf = freight.Fetch(String.Format("WHERE driver_id={0} AND start BETWEEN '{1:yyyy-MM-dd}' AND '{2:yyyy-MM-dd}' ORDER BY start",
                    dri.id, start, end));
                _driver = dri;
                if (_truck == null)
                    _truck = new truck();
            }

            if (llf.Count <= 0)
            {
                XtraMessageBox.Show("Nenhum resultado encontrado para o período informado!");
                return;
            }

            decimal value_gross = 0;
            SplashScreenManager.ShowForm(this, typeof(PleaseWaitForm), false, false, false);
            trailer t1 = new trailer();
            trailer t2 = new trailer();
            trailer t3 = new trailer();
            if (_truck.id > 0)
            {
                t1 = trailer.SingleOrDefault("WHERE truck_id=@0 AND index=@1", _truck.id, 1);
                t2 = trailer.SingleOrDefault("WHERE truck_id=@0 AND index=@1", _truck.id, 2);
                t3 = trailer.SingleOrDefault("WHERE truck_id=@0 AND index=@1", _truck.id, 3);
            }
            FreightsByTruckModel fm = new FreightsByTruckModel()
            {
                emission_at = String.Format("Emitido em {0:dd/MM/yyyy HH:mm}", freight.Now()),
                reference = String.Format("Período de {0:dd/MM/yyyy} à {1:dd/MM/yyyy}", start, end),
                signature = "Emitido por CadoreTecnologia",
                truck = String.Format("{0} - {1}{2}{3}",
                _truck.board, (t1 != null ? t1.board : ""), (t2 != null ? "/" + t2.board : ""), (t3 != null ? "/" + t3.board : "")),
                driver = _driver.full_name
            };

            if (_truck.id <= 0 && (t1.id <= 0) && (t2.id <= 0) && (t3.id <= 0))
            {
                fm.truck = "Motorista não cadastrado para nenhum veículo.";
                if (_driver.inactive)
                    fm.truck += " Motorista inativo.";
            }

            List<ListFreights> lf = new List<ListFreights>();
            foreach (freight f in llf)
            {
                decimal value_fueleds = 0, value_outputs = 0;
                List<ListFueleds> lfueled = new List<ListFueleds>();
                List<fueled> llfueled = fueled.Fetch("WHERE freight_id = @0", f.id);
                foreach (fueled fu in llfueled)
                {
                    value_fueleds += fu.total;
                    lfueled.Add(new ListFueleds()
                    {
                        date = Convert.ToDateTime(fu.date),
                        liters = fu.liters,
                        discont = fu.discount,
                        value_liters = fu.value_liters,
                        value_total = fu.total,
                        gas_station = customer.SingleOrDefault(fu.gas_station_id).corporate_name
                    });
                }

                List<ListOutputs> loutputs = new List<ListOutputs>();
                List<output> lloutputs = output.Fetch("WHERE freight_id = @0", f.id);
                foreach (output o in lloutputs)
                {
                    value_outputs += o.value;
                    loutputs.Add(new ListOutputs()
                    {
                        date = Convert.ToDateTime(o.date),
                        description = o.description,
                        value = o.value,
                        customer = customer.SingleOrDefault(o.customer_id).corporate_name
                    });
                }

                lf.Add(new ListFreights()
                {
                    comission = f.value_comission,
                    date = Convert.ToDateTime(f.start),
                    id = f.id,
                    listFueleds = lfueled,
                    listOutputs = loutputs,
                    driver = isTruck ? driver.SingleOrDefault(f.driver_id).full_name : truck.SingleOrDefault(f.truck_id).board,
                    outputs = value_outputs,
                    fueleds = value_fueleds,
                    product = f.product,
                    value_ton = f.value_ton,
                    gross = (f.value_ton * f.weight),
                    liquid = ((f.value_ton * f.weight) - (f.value_comission + value_fueleds + value_outputs))
                });
                value_gross += (f.value_ton * f.weight);
            }
            fm.gross = value_gross;
            fm.listFreights = lf;

            FreightsByTruckReport report = new FreightsByTruckReport();
            report.bdgFreigths.DataSource = fm;
            report.list.Value = isTruck ? "Motorista" : "Placa";
            report.start_page.Value = isTruck ? "Veículo" : "Motorista";
            ReportPrintTool tool = new ReportPrintTool(report);
            SplashScreenManager.CloseForm(false);
            tool.ShowRibbonPreviewDialog();
        }
Exemplo n.º 39
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                int customerNo = 0;
                if (customersList.Count() > 0)
                {
                    List<CustomersReportData> dataList = new List<CustomersReportData>();
                    List<CustomersReportDetail> detailsList = new List<CustomersReportDetail>();
                    foreach (var customer in customersList.OrderBy(c => c.CustomerID))
                    {
                        customerNo++;
                        var detail = new CustomersReportDetail();
                        var lead = context.Leads.FirstOrDefault
                            (c => c.CompanyName.ToLower() == customer.CompanyName.ToLower());

                        detail.CompanyAddress = customer.CompanyAddress;
                        detail.CompanyName = customer.CompanyName;
                        detail.CustomerID = customerNo;
                        detail.DateSigned = customer.DateSigned;
                        detail.Email = customer.Email;
                        if (lead != null) { detail.FromLead = "FROM LEAD"; } else { detail.FromLead = ""; }
                        detail.PhoneNo = customer.PhoneNo;
                        detail.Website = customer.Website;
                        detailsList.Add(detail);
                    }
                    dataList.Add(new CustomersReportData()
                    {
                        ReportHeader = "CUSTOMERS",
                        ReportTitle = "CUSTOMERS as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalCustomers = detailsList.Count(),
                        details = detailsList
                    });

                    var report = new CustomersReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "CUSTOMERS as of "
                            + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new Shared.Windows.NoticeWindow();
                    Shared.Windows.NoticeWindow.message = "No data to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }
Exemplo n.º 40
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                int productNo = 0;
                if (productsList.Count() > 0)
                {
                    List<ProductsReportData> dataList = new List<ProductsReportData>();
                    List<ProductsReportDetails> detailsList = new List<ProductsReportDetails>();
                    List<LeadsPerProducts> leadsList = new List<LeadsPerProducts>();
                    var leads = context.Leads.ToList();

                    foreach (var product in productsList)
                    {
                        if (product != null)
                        {
                            productNo++;
                            var detail = new ProductsReportDetails();

                            detail.Category = product.Category;
                            detail.Cost = product.Cost;
                            detail.ProductId = productNo;
                            detail.ProductName = product.ProductName;
                            detailsList.Add(detail);
                        }

                        if (leads != null)
                        {
                            foreach (var lead in leads)
                            {
                                var toReport = new LeadsPerProducts();

                                toReport.LeadName = lead.CompanyName;
                                leadsList.Add(toReport);
                            }
                        }
                    }

                    dataList.Add(new ProductsReportData()
                    {
                        ReportHeader = "PRODUCTS",
                        ReportTitle = "PRODUCTS OF as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalProducts = detailsList.Count(),
                        details = detailsList,
                        leads = leadsList
                    });

                    var report = new ProductsReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "LEAD ACTIVITIES OF as of " + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new NoticeWindow();
                    NoticeWindow.message = "No data to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }
Exemplo n.º 41
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new DatabaseContext())
            {
                var accounts = context.CustomerAccounts.ToList();
                int accountNo = 0;
                if (accounts.Count() > 0)
                {
                    List<CustomerAccountsReportData> dataList = new List<CustomerAccountsReportData>();
                    List<CustomerAccountsReportDetail> detailsList = new List<CustomerAccountsReportDetail>();
                    foreach (var account in accounts)
                    {
                        accountNo++;
                        var detail = new CustomerAccountsReportDetail();
                        var territory = context.Territories.FirstOrDefault(c => c.TerritoryID == account.TerritoryID);
                        var customer = context.Customers.FirstOrDefault(c => c.CustomerID == account.CustomerID);
                        var product = context.Products.FirstOrDefault(c => c.ProductID == account.ProductID);

                        detail.AccountNumber = Convert.ToString(accountNo);
                        detail.Customer = customer.CompanyName;
                        detail.Discount = account.Discount;
                        detail.Gross = account.Gross;
                        detail.ModeOfPayment = account.ModeOfPayment;
                        detail.NetValue = account.NetValue;
                        detail.Product = product.ProductName;
                        detail.ServiceCharge = account.ServiceCharge;
                        detail.Territory = territory.TerritoryName;
                        detailsList.Add(detail);
                    }
                    dataList.Add(new CustomerAccountsReportData()
                    {
                        ReportHeader = "CUSTOMER ACCOUNTS",
                        ReportTitle = "CUSTOMER ACCOUNTS as of " + DateTime.Now.ToString("MMMM dd, yyyy"),
                        TotalCustomerAccounts = detailsList.Count(),
                        details = detailsList
                    });

                    var report = new CustomerAccountsReportDesign
                    {
                        DataSource = dataList.Distinct(),
                        Name = "CUSTOMER ACCOUNTS as of "
                            + DateTime.Now.ToString("MMMM dd, yyyy")
                    };

                    using (ReportPrintTool printTool = new ReportPrintTool(report))
                    {
                        printTool.ShowRibbonPreviewDialog();
                    }
                }
                else
                {
                    var windows = new Shared.Windows.NoticeWindow();
                    Shared.Windows.NoticeWindow.message = "No data to print.";
                    windows.Height = 0;
                    windows.Top = screenTopEdge + 8;
                    windows.Left = (screenWidth / 2) - (windows.Width / 2);
                    if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; }
                    windows.ShowDialog();
                }
            }
        }