Example #1
0
        private void btnExportPDF_Click_1(object sender, EventArgs e)
        {
            try
            {
                int driverId = ddl_Driver.SelectedValue.ToInt();



                if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
                {
                    dtpFromDate.Value = null;
                }

                if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
                {
                    dtpTillDate.Value = null;
                }

                DateTime?fromDate = string.Format("{0:dd/MM/yyyy HH:mm}", dtpFromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                ;
                DateTime?tillDate = string.Format("{0:dd/MM/yyyy HH:mm}", dtpTillDate.Value.ToDate() + dtpTillTime.Value.Value.TimeOfDay).ToDateTime();



                string error = string.Empty;
                if (driverId == 0)
                {
                    error += "Required : Driver";
                }

                if (fromDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : From Date";
                }

                if (tillDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : To Date";
                }

                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }


                rptfrmDriverJobLog frm = new rptfrmDriverJobLog();


                frm.DatePeriod = "For the Period : " + string.Format("{0:dd/MM/yyyy HH:mm}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy HH:mm}", tillDate);
                frm.DataSource = GetDataSource(driverId, fromDate, tillDate);

                frm.GenerateReport();
                frm.ExportReport();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        public override void Print()
        {
            try
            {
                int driverId = ddl_Driver.SelectedValue.ToInt();



                if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
                {
                    dtpFromDate.Value = null;
                }

                if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
                {
                    dtpTillDate.Value = null;
                }

                DateTime?fromDate = string.Format("{0:dd/MM/yyyy HH:mm}", dtpFromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                ;
                DateTime?tillDate = string.Format("{0:dd/MM/yyyy HH:mm}", dtpTillDate.Value.ToDate() + dtpTillTime.Value.Value.TimeOfDay).ToDateTime();



                string error = string.Empty;
                if (driverId == 0)
                {
                    error += "Required : Driver";
                }

                if (fromDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : From Date";
                }

                if (tillDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : To Date";
                }

                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }



                rptfrmDriverJobLog frm = new rptfrmDriverJobLog();

                frm.DataSource = GetDataSource(driverId, fromDate, tillDate);



                frm.DatePeriod = "For the Period : " + string.Format("{0:dd/MM/yyyy HH:mm}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy HH:mm}", tillDate);
                //   frm.StatementType = statementType;
                frm.GenerateReport();

                DockWindow doc = UI.MainMenuForm.MainMenuFrm.GetDockByName("rptfrmDriverJobLog");

                if (doc != null)
                {
                    doc.Close();
                }
                UI.MainMenuForm.MainMenuFrm.ShowForm(frm);
            }
            catch (Exception ex)
            {
            }
        }