Esempio n. 1
0
        private void imprimirCuotas_Click(object sender, EventArgs e)
        {
            if (dtgPrestamosCuotas.Rows.Count != 0)
            {
                DialogResult imprimir = MessageBox.Show("Desea imprimir los ticket de las cuotas selecionadas?\nCuotas seleccionadas: " + dtgPrestamosCuotas.SelectedRows.Count, "Informacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (imprimir == DialogResult.Yes)
                {
                    frmEncabezadoAbono oEncabezado = new frmEncabezadoAbono("Reimprimir abono");
                    oEncabezado.ShowDialog();

                    if (oEncabezado.cancelar)
                    {
                        oEncabezado.Dispose();
                        return;
                    }

                    // ENCABEZADO DE LA CUOTA
                    this.encabezado = oEncabezado.encabezado;

                    cRows = 0;

                    // CONTIENE LAS FILAS SELECIONADAS
                    int[] filasSelecionadas = new int[dtgPrestamosCuotas.SelectedRows.Count];

                    // LLEVA LOS INDICES DE LAS FILAS EN EL ARRAY
                    int indexFilas = 0;

                    // AGREGA LAS FILAS AL ARREGLO
                    foreach (DataGridViewRow item in dtgPrestamosCuotas.SelectedRows)
                    {
                        filasSelecionadas[indexFilas] = item.Index;
                        indexFilas++;
                    }

                    // ORDENA LAS FILAS
                    Array.Sort(filasSelecionadas);

                    // CICLO QUE RECORRE EL ARREGLO PARA IMPRIMIR
                    for (int i = 0; i < filasSelecionadas.Length; i++)
                    {
                        cRows = filasSelecionadas[i];
                        ImprimirTickets.Print();
                    }
                }
            }

            else
            {
                MessageBox.Show("No puede procesar una planilla sin cuotas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 2
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (dtgPrestamosCuotas.Rows.Count != 0)
            {
                DialogResult imprimir = MessageBox.Show("Desea imprimir los ticket de esta planilla? ", "Informacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (imprimir == DialogResult.Yes)
                {
                    cRows = 0;

                    for (int i = 0; i < dtgPrestamosCuotas.Rows.Count; i++)
                    {
                        ImprimirTickets.Print();
                        cRows++;
                    }
                }
            }

            else
            {
                MessageBox.Show("No puede procesar una planilla sin cuotas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (dtgPrestamosCuotas.Rows.Count != 0)
            {
                DialogResult opcion = MessageBox.Show("Desea guardar la planilla con estas cuotas", "Informacion", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);


                if (opcion == DialogResult.OK)
                {
                    if (txtDetalle.Text == "")
                    {
                        MessageBox.Show("Escriba un detalle para esta planilla", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    else
                    {
                        // INSTANCIAS

                        PlanillaCL oPlanilla = new PlanillaCL();

                        oPlanilla.InsertarPlanilla(numPlanilla, Convert.ToDateTime(lblFecha.Text), txtDetalle.Text, false);

                        foreach (DataGridViewRow row in dtgPrestamosCuotas.Rows)
                        {
                            int idCuota = Convert.ToInt32(row.Cells["Prestamos_cuotas_id"].Value.ToString());

                            oPlanilla.InsertarPlanillaDetalle(numPlanilla, idCuota);
                        }

                        // COMPRUEBA SI HAY ERROR

                        if (oPlanilla.IsError)
                        {
                            MessageBox.Show(oPlanilla.ErrorDescripcion, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                        else
                        {
                            MessageBox.Show("Planilla creada con exito ", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            DialogResult imprimir = MessageBox.Show("Desea imprimir los ticket de esta planilla? ", "Informacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                            if (imprimir == DialogResult.Yes)
                            {
                                int cRows = 0;

                                for (int i = 0; i < dtgPrestamosCuotas.Rows.Count; i++)
                                {
                                    ImprimirTickets.Print();

                                    cRows++;
                                }
                            }

                            iPlanilla.CargarPlanilla("");

                            this.Dispose();
                        }
                    }
                }
            }

            else
            {
                MessageBox.Show("No puede procesar una planilla sin cuotas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }