Beispiel #1
0
 private void btnPrint_Click(System.Object sender, System.EventArgs e)
 {
     if (PrintDialog1.ShowDialog() == DialogResult.OK)
     {
         PrintDocument1.Print();
     }
 }
Beispiel #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            HH    = 0;
            index = 0;
            if (employeesListView.CheckedItems.Count > 0)
            {
                totalPages            = employeesListView.CheckedItems.Count;
                PrintDialog1.Document = PrintDocument1;
                if (PrintDialog1.ShowDialog() == DialogResult.OK)
                {
                    PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                    var New_Paper = new PaperSize("", 213, 338);
                    New_Paper.PaperName = ((int)PaperKind.Custom).ToString();
                    var New_Margin = new Margins();
                    New_Margin.Left = 0;
                    New_Margin.Top  = 0;
                    {
                        var withBlock = PrintDocument1;
                        withBlock.DefaultPageSettings.PaperSize = New_Paper;
                        withBlock.DefaultPageSettings.Margins   = New_Margin;
                        // .PrinterSettings.DefaultPageSettings.Landscape = False
                        withBlock.Print();
                    }
                }

                warningLabel.Hide();
            }
            else
            {
                warningLabel.Show();
            }
        }
Beispiel #3
0
        private void ArchivoImprimir_Click(object sender, EventArgs e)
        {
            // Formulario padre
            FormMDI formPadre = (FormMDI)this.MdiParent;

            // Formulario hijo activo
            FormDocumento FormHijo = this;

            if (FormHijo == null)
            {
                return;
            }

            // Se supone que durante el diseño se asignó a la propiedad Document
            // de PrintDialog1 el objeto PrintDocument utilizado para imprimir.

            // Permitir al usuario elegir el rango de páginas a imprimir.
            PrintDialog1.AllowSomePages = true;
            if (PrintDialog1.ShowDialog() == DialogResult.OK)
            {
                // Si se pulsó el botón "Aceptar" (OK), entonces imprimir.
                string texto = FormHijo.rtbText.Text;
                char[] seps  = { '\n', '\r' }; // LF y CR
                línea = texto.Split(seps);     //líneas de texto que hay que imprimir
                totalLineasImpresas = 0;
                PrintDocument1.Print();        //invoca a ImprimirDoc_PrintPage
            }
        }
Beispiel #4
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (PrintDialog1.ShowDialog() == DialogResult.OK)
     {
         PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings;
         PrintDocument1.DocumentName    = cmboProductCode.Text + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");
         PrintDocument1.Print();
     }
 }
Beispiel #5
0
        //---------------------------------------------------------------------------

        private void btPrintClick(object sender, EventArgs e)
        {
            PrintDialog1.Document = tbReport.GetPrintDocument();
            if (PrintDialog1.ShowDialog() != DialogResult.None)
            {
                //TODO: remove before release
                tbReport.GetPrintDocument().Preview("Moras Konfigurations-Report");
                tbReport.GetPrintDocument().Print("Moras Konfigurations-Report");
            }
        }
Beispiel #6
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (PrintDialog1.ShowDialog() == DialogResult.OK)
            {
                PrintDocument1.OriginAtMargins = true;

                // Link between print dialog and print document
                PrintDialog1.Document = PrintDocument1;
                PrintDocument1.Print();
            }
        }
Beispiel #7
0
 private void PrintToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     try
     {
         PrintDialog1.Document = PrintDocument1;
         if (PrintDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             PrintDocument1.Print();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString(), "Error");
     }
 }
Beispiel #8
0
        private void printButton_Click(object sender, EventArgs e)
        {
            titleTimeManagementLabel.Text = "";
            I_Start_Items = 0;
            I_Start       = 0;
            bool employeeIsSelected = false;

            summaryIsPrinted = false;
            for (int i = 0, loopTo = summaryBunifuDataGridView.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(summaryBunifuDataGridView.Rows[i].Cells[0].Value, true, false)))
                {
                    employeeIsSelected = true;
                    break;
                }
            }

            if (employeeIsSelected)
            {
                // If completeTimeSheet = True Then

                PrintDialog1.Document = PrintDocument1;
                if (PrintDialog1.ShowDialog() == DialogResult.OK)
                {
                    PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                    LineNumber = 0;
                    var New_Paper = new PaperSize("", 850, 1100);
                    New_Paper.PaperName = ((int)PaperKind.Custom).ToString();
                    var New_Margin = new Margins();
                    New_Margin.Left = 0;
                    New_Margin.Top  = 50;
                    {
                        var withBlock = PrintDocument1;
                        withBlock.DefaultPageSettings.PaperSize = New_Paper;
                        withBlock.DefaultPageSettings.Margins   = New_Margin;
                        // .PrinterSettings.DefaultPageSettings.Landscape = False
                        withBlock.Print();
                    }
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected", titleTimeManagementLabel);
            }
        }
Beispiel #9
0
        private void button1_click(object sender, EventArgs e)
        {
            firstpage    = true;
            pagestoprint = 0;
            if (dgvUnits.SelectedRows.Count > 0 & !string.IsNullOrEmpty(sampletitlecombobox.Text) & !string.IsNullOrEmpty(Strings.Trim(tbCustomer.Text).Length.ToString()) & !string.IsNullOrEmpty(cboBooking.Text.Length.ToString()) | BunifuToggleSwitch1.Value == true)
            {
                i_start_items         = 0;
                i_start               = 0;
                hh                    = 0;
                index                 = 0;
                PrintDialog1.Document = PrintDocument1;
                for (int i = 0, loopTo = dgvUnits.Rows.Count - 1; i <= loopTo; i++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvUnits.Rows[i].Cells[0].Value, true, false)))
                    {
                        pagestoprint += 1;
                    }
                }

                if (PrintDialog1.ShowDialog() == DialogResult.OK)
                {
                    PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                    var new_paper = new PaperSize("", 400, 300);
                    new_paper.PaperName = ((int)PaperKind.Custom).ToString();
                    var new_margin = new Margins();
                    new_margin.Left = 10;
                    new_margin.Top  = 10;
                    {
                        var withBlock = PrintDocument1;
                        withBlock.DefaultPageSettings.PaperSize = new_paper;
                        withBlock.DefaultPageSettings.Margins   = new_margin;
                        withBlock.PrinterSettings.DefaultPageSettings.Landscape = false;
                        withBlock.Print();
                    }
                }

                warningLabel.Text = "";
            }
            else
            {
                warningLabel.Text = "Please make sure to select the units to be printed";
            }
        }
Beispiel #10
0
        private void printButton_Click(object sender, EventArgs e)
        {
            INDEX_ALL_DAYS           = 0;
            INDEX_FOCUSED_EMPLOYEE   = 0;
            INDEX_EMPLOYEES_COMPARED = 0;
            INDEX_EMPLOYEES_COMPARED_CHECK_OVERTIME = 0;
            pageNumber     = 1;
            checkedWork    = "";
            nextPageExists = false;
            if (reportFromListView.SelectedItems.Count > 0 & CheckedListBox1.CheckedItems.Count > 0 & comparisonTypeComboBox.SelectedIndex == 1)
            {
                titleLabel.Text      = "Hours worked comparison report";
                titleLabel.BackColor = Color.FromArgb(64, 64, 0);
                var loopTo = CheckedListBox1.Items.Count - 1;
                for (i = 0; i <= loopTo; i++)
                {
                    string Item = (string)CheckedListBox1.Items[i];
                    if (CheckedListBox1.GetItemChecked(i))
                    {
                        Item         = Strings.Trim(Conversions.ToString(Item.Split('(')[0]));
                        checkedWork += Item.ToString().Replace(" ", "_") + "='yes' or ";
                    }
                }

                checkedWork = checkedWork.Substring(0, checkedWork.Length - 3);
                int    selectedIndex = reportFromListView.FocusedItem.Index;
                string condition     = Conversions.ToString(Operators.AddObject(Operators.AddObject(" and Site_Location = '", yardComboBox.SelectedItem), "'"));
                if (yardComboBox.SelectedItem.Equals("Both"))
                {
                    condition = "";
                }

                employeesWorkingThatDay      = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 2, checkedWork, condition);
                datesWorkedByFocusedEmployee = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 1, checkedWork, "");
                datesWorkedTable             = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 3, checkedWork, condition);
                if (comparisonTypeComboBox.SelectedIndex == 1 & CheckedListBox1.CheckedItems.Count > 0)
                {
                    PrintDialog1.Document = PrintDocument1;
                    if (PrintDialog1.ShowDialog() == DialogResult.OK)
                    {
                        PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                        LineNumber = 0;
                        var New_Paper = new PaperSize("", 850, 1100);
                        New_Paper.PaperName = ((int)PaperKind.Custom).ToString();
                        var New_Margin = new Margins();
                        New_Margin.Left = 20;
                        New_Margin.Top  = 50;
                        {
                            var withBlock = PrintDocument1;
                            withBlock.DefaultPageSettings.PaperSize = New_Paper;
                            withBlock.DefaultPageSettings.Margins   = New_Margin;
                            // .PrinterSettings.DefaultPageSettings.Landscape = False
                            withBlock.Print();
                        }
                    }
                }
                else
                {
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected report", titleLabel);
            }
        }