Example #1
0
        public void ImprimirCuotas()
        {
            frmFechaPreliminarPagoCuota frmFechaPreliminarPagoCuota = new frmFechaPreliminarPagoCuota(this);

            frmFechaPreliminarPagoCuota.ShowDialog();
            if (this.fechaPreliminarPago.ToShortDateString() != "01/01/0001")
            {
                frmEncabezadoAbono oEncabezado = new frmEncabezadoAbono("Reimprimir abono");
                oEncabezado.ShowDialog();

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

                // DATOS DE LA FECHA FINAL DEL PRESTAMO
                PrestamosCL prestamosCL = new PrestamosCL();

                DataTable fechaFinalPrestamo = prestamosCL.TraerFechaFinalPrestamo(Convert.ToString(this.dtgCuotas["id_prestamos", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString())).Tables[0];

                // DATOS DEL CLIENTE
                ClientesCL clientesCL    = new ClientesCL();
                DataTable  clientesDatos = clientesCL.TraerClientes(this.cliente).Tables[0];

                // DATOS DEL PRESTAMO
                this.oEPrestamos = new EPrestamos();
                this.oEPrestamos.clientePrestamo  = this.cliente;
                this.oEPrestamos.nombreCliente    = clientesDatos.Rows[0].ItemArray.GetValue(1).ToString();
                this.oEPrestamos.telefonoCliente  = clientesDatos.Rows[0].ItemArray.GetValue(4).ToString();
                this.oEPrestamos.direccionCliente = clientesDatos.Rows[0].ItemArray.GetValue(2).ToString();

                this.oEPrestamos.totalPrestamo      = Convert.ToDouble(this.dtgPrestamos["Total1", this.dtgPrestamos.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.fechaAbono         = fechaPreliminarPago;
                this.oEPrestamos.fechaFinalPrestamo = Convert.ToDateTime(fechaFinalPrestamo.Rows[0].ItemArray.GetValue(0).ToString());

                // ORDENA LAS CUOTAS BASADO EN EL INDICE
                var cuotasOrdenadas = dtgCuotas.SelectedRows.Cast <DataGridViewRow>().OrderBy(row => row.Index);


                // CICLO QUE RECORRE LAS CUOTAS PARA SER IMPRESAS COMO PRELIMINARES
                foreach (DataGridViewRow item in cuotasOrdenadas)
                {
                    this.oEPrestamos.encabezado           = oEncabezado.encabezado;
                    this.oEPrestamos.prestamo             = Convert.ToString(item.Cells["id_prestamos"].Value.ToString());
                    this.oEPrestamos.saldoPrestamo        = Convert.ToDouble(item.Cells["saldo"].Value.ToString());
                    this.oEPrestamos.fechaPactada         = Convert.ToDateTime(item.Cells["fecha_pactada"].Value.ToString());
                    this.oEPrestamos.numeroCuota          = Convert.ToInt32(item.Cells["num_cuota"].Value.ToString());
                    this.oEPrestamos.idCuota              = Convert.ToInt32(item.Cells["id"].Value.ToString());
                    this.oEPrestamos.saldoPretamoAnterior = Convert.ToDouble(item.Cells["saldo"].Value.ToString()) + Convert.ToDouble(item.Cells["monto_cuota"].Value.ToString());
                    this.oEPrestamos.montoAbono           = Convert.ToDouble(item.Cells["monto_cuota"].Value.ToString());
                    this.ImprimirTicket.Print();
                }
            }
        }
Example #2
0
        private void btnImprimirPreliminar_Click(object sender, EventArgs e)
        {
            frmFechaPreliminarPagoCuota frmFechaPreliminarPagoCuota = new frmFechaPreliminarPagoCuota(this);

            frmFechaPreliminarPagoCuota.ShowDialog();
            if (this.fechaPreliminarPago.ToShortDateString() != "01/01/0001")
            {
                frmEncabezadoAbono oReimprimir = new frmEncabezadoAbono("Imprimir preliminar");
                oReimprimir.ShowDialog();

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

                //VALORES DEL TICKET ABONO
                this.oEPrestamos = new EPrestamos();
                ClientesCL  clientesCL  = new ClientesCL();
                PrestamosCL prestamosCL = new PrestamosCL();
                DataTable   dataTable   = clientesCL.TraerClientes(this.cliente).Tables[0];
                DataTable   dataTable2  = prestamosCL.TraerFechaFinalPrestamo(Convert.ToString(this.dtgCuotas["id_prestamos", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString())).Tables[0];
                this.oEPrestamos.encabezado           = oReimprimir.encabezado;
                this.oEPrestamos.clientePrestamo      = this.cliente;
                this.oEPrestamos.nombreCliente        = dataTable.Rows[0].ItemArray.GetValue(1).ToString();
                this.oEPrestamos.telefonoCliente      = dataTable.Rows[0].ItemArray.GetValue(4).ToString();
                this.oEPrestamos.direccionCliente     = dataTable.Rows[0].ItemArray.GetValue(2).ToString();
                this.oEPrestamos.totalPrestamo        = Convert.ToDouble(this.dtgPrestamos["Total1", this.dtgPrestamos.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.fechaPactada         = Convert.ToDateTime(this.dtgCuotas["fecha_pactada", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.fechaAbono           = this.fechaPreliminarPago;
                this.oEPrestamos.numeroCuota          = Convert.ToInt32(this.dtgCuotas["num_cuota", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.idCuota              = Convert.ToInt32(this.dtgCuotas["id", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.prestamo             = Convert.ToString(this.dtgCuotas["id_prestamos", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.saldoPrestamo        = Convert.ToDouble(this.dtgCuotas["saldo", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.saldoPretamoAnterior = Convert.ToDouble(this.dtgCuotas["saldo", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString()) + Convert.ToDouble(this.dtgCuotas["monto_cuota", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.montoAbono           = Convert.ToDouble(this.dtgCuotas["monto_cuota", this.dtgCuotas.CurrentCell.RowIndex].Value.ToString());
                this.oEPrestamos.fechaFinalPrestamo   = Convert.ToDateTime(dataTable2.Rows[0].ItemArray.GetValue(0).ToString());
                this.ImprimirTicket.Print();
            }
        }