private void ExportAccepted()
 {
     try
     {
         if (DialogResult.OK == saveFileDialog1.ShowDialog())
         {
             this.btn_export_accepted.Enabled = false;
             for (int a = 0; a < grdAcceptedJob.Columns.Count; a++)
             {
                 grdAcceptedJob.Columns[a].Width = 80;
             }
             ClsExportGridView objClsExportGridView = new ClsExportGridView(this.grdAcceptedJob, saveFileDialog1.FileName);
             objClsExportGridView.ApplyCellFormatting = true;
             string headerText = "Date Range : " + string.Format("{0:dd-MMM-yy}", dtp_TransferredFrom.Value) + " to " + string.Format("{0:dd-MMM-yy}", dtp_TranferredTo.Value);
             objClsExportGridView.Heading        = headerText;
             objClsExportGridView.TitleFontSize  = 18;
             objClsExportGridView.TitleBackColor = Color.Red;
             objClsExportGridView.TitleForeColor = Color.White;
             //objClsExportGridView.HeaderBackColor = Color.Black;
             objClsExportGridView.HeaderForeColor = Color.White;
             objClsExportGridView.ExportExcel();
             //objClsExportGridView.ExportExcelAsync(radProgressBar1);
             objClsExportGridView             = null;
             this.btn_export_accepted.Enabled = true;
             for (int a = 0; a < grdAcceptedJob.Columns.Count; a++)
             {
                 grdAcceptedJob.Columns[a].Width = 160;
             }
         }
     }
     catch (Exception ex)
     {
         RadMessageBox.Show(ex.Message);
     }
 }
        private void ExpoerOperatorVehicleRecord()
        {
            try
            {
                if (DialogResult.OK == saveFileDialog2.ShowDialog())
                {
                    this.btnExport2.Enabled = false;
                    grdOperatorVehicleRecord.Columns["OperatorLicenceNumber"].Width   = 110;
                    grdOperatorVehicleRecord.Columns["MonthCommencing"].Width         = 90;
                    grdOperatorVehicleRecord.Columns["OperatorName"].Width            = 90;
                    grdOperatorVehicleRecord.Columns["VehicleMake"].Width             = 90;
                    grdOperatorVehicleRecord.Columns["VehicleRegistrationMark"].Width = 100;
                    grdOperatorVehicleRecord.Columns["PHCVehicle"].Width = 90;

                    ClsExportGridView objClsExportGridView = new ClsExportGridView(grdOperatorVehicleRecord, saveFileDialog2.FileName);
                    string            headerText           = "Date Range : " + string.Format("{0:dd-MMM-yy}", dtpFromDate2.Value) + " to " + string.Format("{0:dd-MMM-yy}", dtpToDate2.Value);
                    objClsExportGridView.Heading             = headerText;
                    objClsExportGridView.TitleFontSize       = 18;
                    objClsExportGridView.ApplyCellFormatting = true;
                    objClsExportGridView.TitleBackColor      = Color.Red;
                    objClsExportGridView.TitleForeColor      = Color.White;
                    objClsExportGridView.HeaderBackColor     = Color.Black;
                    objClsExportGridView.HeaderForeColor     = Color.White;
                    objClsExportGridView.ExportExcel();
                    objClsExportGridView            = null;
                    this.btnExport2.Enabled         = true;
                    IsOperatorVehicleRecordExported = true;
                    //grdOperatorVehicleRecord.Columns["PHCVehicle"].HeaderText = "PHC Vehicle";
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message);
            }
        }
        private void btnexport_Click(object sender, EventArgs e)
        {
            try
            {
                saveFileDialog1.Filter = "Excel File (*.xls)|*.xls|AdvExcel File (*.xlsx)|*.xlsx";

                saveFileDialog1.Title    = "Save File";
                saveFileDialog1.FileName = "SageInvoice";


                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    PopulateGrid();

                    grdLister.Columns["InvoiceType"].Width      = 70;
                    grdLister.Columns["InvoiceType"].HeaderText = "invoice type";

                    grdLister.Columns["AccountCode"].Width      = 70;
                    grdLister.Columns["AccountCode"].HeaderText = "account code";

                    grdLister.Columns["SageNo"].Width      = 50;
                    grdLister.Columns["SageNo"].HeaderText = "sage no.";


                    grdLister.Columns["BlankField"].HeaderText = "";

                    grdLister.Columns["InvoiceDate"].Width      = 60;
                    grdLister.Columns["InvoiceDate"].HeaderText = "invoice date";

                    grdLister.Columns["InvoiceNo"].Width      = 70;
                    grdLister.Columns["InvoiceNo"].HeaderText = "invoice npo.";

                    grdLister.Columns["SoftwareName"].Width      = 120;
                    grdLister.Columns["SoftwareName"].HeaderText = "software name.";

                    grdLister.Columns["InvoiceTotal"].Width      = 70;
                    grdLister.Columns["InvoiceTotal"].HeaderText = "invoice total";

                    grdLister.Columns["TaxCode"].Width      = 50;
                    grdLister.Columns["TaxCode"].HeaderText = "tax code";

                    grdLister.Columns["Vat"].Width      = 40;
                    grdLister.Columns["Vat"].HeaderText = "vat";



                    string heading = string.Empty;
                    //  heading = string.Format("{0:dd/MM/yyyy hh:mm tt}", dtF) + " till " + string.Format("{0:dd/MM/yyyy hh:mm tt}", dtT);

                    ClsExportGridView obj = new ClsExportGridView(grdLister, saveFileDialog1.FileName);
                    obj.ApplyCellFormatting       = false;
                    obj.ApplyCustomCellFormatting = true;
                    //  obj.Heading = heading;
                    obj.ExportExcelAsync();
                }
            }
            catch
            {
            }
        }
        private void ExportOperatorPrivateHireDriverRecord()
        {
            try
            {
                if (DialogResult.OK == saveFileDialog1.ShowDialog())
                {
                    this.btnExport.Enabled = false;
                    grdOperatorPrivateHireDriverRecord.Columns["OperatorLicenceNumber"].Width = 110;

                    grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].HeaderText     = "Month";
                    grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].Width          = 40;
                    grdOperatorPrivateHireDriverRecord.Columns["OperatorName"].Width             = 90;
                    grdOperatorPrivateHireDriverRecord.Columns["FirstName"].Width                = 80;
                    grdOperatorPrivateHireDriverRecord.Columns["PrivateHireLicenceNumber"].Width = 100;
                    grdOperatorPrivateHireDriverRecord.Columns["Surname"].Width  = 80;
                    grdOperatorPrivateHireDriverRecord.Columns["Surname2"].Width = 60;
                    ClsExportGridView objClsExportGridView = new ClsExportGridView(this.grdOperatorPrivateHireDriverRecord, saveFileDialog1.FileName);
                    objClsExportGridView.ApplyCellFormatting = true;
                    string headerText = "Date Range : " + string.Format("{0:dd-MMM-yy}", dtpFromDate.Value) + " to " + string.Format("{0:dd-MMM-yy}", dtpToDate.Value);
                    objClsExportGridView.Heading        = headerText;
                    objClsExportGridView.TitleFontSize  = 18;
                    objClsExportGridView.TitleBackColor = Color.Red;
                    objClsExportGridView.TitleForeColor = Color.White;
                    //objClsExportGridView.HeaderBackColor = Color.Black;
                    objClsExportGridView.HeaderForeColor = Color.White;
                    objClsExportGridView.ExportExcel();
                    //objClsExportGridView.ExportExcelAsync(radProgressBar1);
                    objClsExportGridView   = null;
                    this.btnExport.Enabled = true;
                    grdOperatorPrivateHireDriverRecord.Columns["OperatorLicenceNumber"].Width    = 160;
                    grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].Width          = 160;
                    grdOperatorPrivateHireDriverRecord.Columns["OperatorName"].Width             = 170;
                    grdOperatorPrivateHireDriverRecord.Columns["FirstName"].Width                = 150;
                    grdOperatorPrivateHireDriverRecord.Columns["PrivateHireLicenceNumber"].Width = 180;
                    grdOperatorPrivateHireDriverRecord.Columns["Surname"].Width  = 110;
                    grdOperatorPrivateHireDriverRecord.Columns["Surname2"].Width = 80;

                    grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].HeaderText = "Month Commencing";
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message);
            }
        }
Example #5
0
        void btnExportXL_Click(object sender, EventArgs e)
        {
            if (grdDriverJobsList.Rows.Count == 0)
            {
                return;
            }

            try
            {
                saveFileDialog1.Filter = "Excel File (*.xls)|*.xls|AdvExcel File (*.xlsx)|*.xlsx";

                saveFileDialog1.Title    = "Save File";
                saveFileDialog1.FileName = "Driver Booking Stats";


                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    //grdLister.Columns["IsPaid"].IsVisible = false;
                    //grdLister.Columns["Paid"].IsVisible = true;
                    ////grdLister.Columns["btnUpdate"].IsVisible = false;

                    //grdLister.Columns[COLS.Active].Width = 50;
                    //grdLister.Columns[COLS.Rent].Width = 60;
                    //grdLister.Columns[COLS.DriverNo].Width = 50;
                    //grdLister.Columns[COLS.PreviousBalance].Width = 85;
                    //grdLister.Columns[COLS.Adjustment].Width = 60;
                    //grdLister.Columns[COLS.Collection].Width = 60;
                    //grdLister.Columns[COLS.AgentCommission].Width = 70;
                    //grdLister.Columns[COLS.OldAgentBalance].Width = 90;

                    //grdLister.Columns[COLS.Total].Width = 45;
                    //grdLister.Columns[COLS.Paid].Width = 35;


                    //var row = grdLister.Rows.OrderByDescending(c => c.Cells["ToDate"].Value.ToDate()).FirstOrDefault();

                    //DateTime? dtCurrent = row.Cells["FromDate"].Value.ToDate();
                    //DateTime dtEnd = row.Cells["ToDate"].Value.ToDate();



                    Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[1];
                    string heading = string.Empty;
                    heading = "" + string.Format("from {0:dd/MM/yyyy}", dtpFromDate.Value) + " till " + string.Format("{0:dd/MM/yyyy}", dtpTillDate.Value);

                    ClsExportGridView obj = new ClsExportGridView(grdDriverJobsList, saveFileDialog1.FileName);
                    obj.ApplyCellFormatting       = true;
                    obj.ApplyCustomCellFormatting = true;
                    obj.Heading = heading;
                    obj.ExportExcelAsync(radProgressBar1);
                    //obj.ConditionalFormattingObject = new StyleDataRowConditionalFormattingObject();
                    //obj.ConditionalFormattingObject.ConditionFormattingColumnName = "Paid";
                    //obj.ConditionalFormattingObject.RowBackColor = Color.LightGreen;
                    //obj.ConditionalFormattingObject.RowForeColor = Color.Black;
                    //obj.ConditionalFormattingObject.TValue = "Paid";



                    //if (obj.ExportExcel())
                    //{
                    //    RadDesktopAlert alert = new RadDesktopAlert();
                    //    alert.CaptionText = "Export";
                    //    alert.ContentText = "<html> <b><span style=font-size:medium><color=Blue>Export Successfully</span></b></html>";
                    //    alert.Show();

                    //}

                    //grdLister.Columns["IsPaid"].IsVisible = true;
                    //grdLister.Columns["Paid"].IsVisible = false;
                    //   grdLister.Columns["IsPaid"].IsVisible = false;
                    // grdLister.Columns["Paid"].IsVisible = true;
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
            finally
            {
                SetDefaultColumnSettings();
            }
        }
Example #6
0
        void btnExportExcel_Click(object sender, EventArgs e)
        {
            if (grdLister.Rows.Count == 0)
            {
                return;
            }

            try
            {
                saveFileDialog1.Filter = "Excel File (*.xls)|*.xls|AdvExcel File (*.xlsx)|*.xlsx";

                saveFileDialog1.Title    = "Save File";
                saveFileDialog1.FileName = "Driver Weekly Rent History";


                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    grdLister.Columns["IsPaid"].IsVisible = false;
                    grdLister.Columns["Paid"].IsVisible   = true;
                    //grdLister.Columns["btnUpdate"].IsVisible = false;

                    grdLister.Columns["Active"].Width      = 35;
                    grdLister.Columns["Active"].HeaderText = "Active";

                    grdLister.Columns["DriverNo"].Width      = 38;
                    grdLister.Columns["DriverNo"].HeaderText = "Driver";

                    grdLister.Columns["AccountBookings"].Width      = 70;
                    grdLister.Columns["AccountBookings"].HeaderText = "A/C Bookings";

                    grdLister.Columns["TotalRentCommission"].Width = 60;

                    grdLister.Columns["OfficeToPay"].Width     = 70;
                    grdLister.Columns["PreviousBalance"].Width = 65;

                    //   grdLister.Columns["Total"].Width = 80;
                    grdLister.Columns["DriverToPay"].Width = 70;
                    grdLister.Columns["Paid"].Width        = 30;


                    var row = grdLister.Rows.OrderByDescending(c => c.Cells["ToDate"].Value.ToDate()).FirstOrDefault();

                    DateTime?dtCurrent = row.Cells["FromDate"].Value.ToDate();
                    DateTime dtEnd     = row.Cells["ToDate"].Value.ToDate();


                    Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[1];
                    string heading = string.Empty;
                    heading = "Driver Weekly Rent History - " + string.Format("from {0:dd/MM/yyyy}", dtCurrent) + " until " + string.Format("{0:dd/MM/yyyy}", dtEnd);

                    ClsExportGridView obj = new ClsExportGridView(grdLister, saveFileDialog1.FileName);
                    obj.ApplyCellFormatting         = true;
                    obj.ConditionalFormattingObject = new StyleDataRowConditionalFormattingObject();
                    obj.ConditionalFormattingObject.ConditionFormattingColumnName = "Paid";
                    obj.ConditionalFormattingObject.RowBackColor = Color.LightGreen;
                    obj.ConditionalFormattingObject.RowForeColor = Color.Black;
                    obj.ConditionalFormattingObject.TValue       = "Paid";



                    obj.Heading = heading;
                    if (obj.ExportExcel())
                    {
                        RadDesktopAlert alert = new RadDesktopAlert();
                        alert.CaptionText = "Export";
                        alert.ContentText = "<html> <b><span style=font-size:medium><color=Blue>Export Successfully</span></b></html>";
                        alert.Show();
                    }


                    SetDefaultColumnSettings();
                }
            }
            catch (Exception ex)
            {
                SetDefaultColumnSettings();
                ENUtils.ShowMessage(ex.Message);
            }
        }