Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Worksheet currentSheet = Globals.Hoja1.GetActiveWorkSheet();

            if (val_vacios())
            {
                if (!val_monto())
                {
                    MessageBox.Show("El monto debe ser un valor numerico mayor a 0");
                }
                else
                {
                    if (!val_plazo())
                    {
                        MessageBox.Show("El plazo debe ser un valor numerico y entero mayor a 0");
                    }
                    else
                    {
                        if (!val_interes())
                        {
                            MessageBox.Show("El interes debe ser un valor numerico mayor a 0");
                        }
                        else
                        {
                            double monto   = Double.Parse(this.monto.Text);
                            int    plazo   = Int32.Parse(this.plazo.Text);
                            double interes = Double.Parse(this.interes.Text);
                            double couta;

                            //vamos a calcular el monto
                            using (WSFinanciera.Service1Client cliente = new WSFinanciera.Service1Client())
                            {
                                //calculamos la cuta que nos quedara
                                couta = Math.Round(cliente.getCuota(monto, plazo, interes), 4);

                                Worksheet currentSheet = Globals.Hoja1.GetActiveWorkSheet();
                                currentSheet.Range["C16"].Value = couta;
                                cliente.Close();
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe completar todos los campos");
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            double monto   = Double.Parse(this.txtMonto.Text);
            int    plazo   = Int32.Parse(this.txtPlazo.Text);
            double interes = Double.Parse(this.txtInteres.Text);
            double couta;

            //vamos a calcular el monto
            using (WSFinanciera.Service1Client cliente = new WSFinanciera.Service1Client())
            {
                //calculamos la cuta que nos quedara
                couta = Math.Round(cliente.getCuota(monto, plazo, interes), 4);

                Worksheet currentSheet = Globals.Hoja1.GetActiveWorkSheet();
                currentSheet.Range["B4"].Value = couta;
                cliente.Close();
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            limpiar();

            if (!val_monto())
            {
                MessageBox.Show("El monto debe ser un valor numerico mayor a 0");
            }
            else
            {
                if (!val_plazo())
                {
                    MessageBox.Show("El inters debe ser un valor numerico mayor a 0");
                }
                else
                {
                    if (!val_interes())
                    {
                        MessageBox.Show("El interes debe ser un valor numerico mayor a 0");
                    }
                    else
                    {
                        limpiar();
                        double monto   = Double.Parse(this.monto.Text);
                        int    plazo   = Int32.Parse(this.plazo.Text);
                        double interes = Double.Parse(this.interes.Text);
                        double couta;
                        using (WSFinanciera.Service1Client cliente = new WSFinanciera.Service1Client())
                        {
                            //calculamos la cuta que nos quedara
                            couta = Math.Round(cliente.getCuota(monto, plazo, interes), 4);

                            Worksheet currentSheet = Globals.Hoja1.GetActiveWorkSheet();
                            currentSheet.Range["C16"].Value = couta;
                            //tamaño de la fila

                            //llenar la lista
                            var Datos = cliente.getTabla_Amortizacion(monto, plazo, interes);

                            filaF = Datos.Length;
                            int i = 17;

                            foreach (var dato in Datos)
                            {
                                currentSheet.Range["F" + i].Value             = dato.periodo;
                                currentSheet.Range["F" + i].Borders.LineStyle = XlLineStyle.xlContinuous;

                                currentSheet.Range["G" + i].Value             = dato.cuota;
                                currentSheet.Range["G" + i].Borders.LineStyle = XlLineStyle.xlContinuous;

                                currentSheet.Range["H" + i].Value             = dato.interes;
                                currentSheet.Range["H" + i].Borders.LineStyle = XlLineStyle.xlContinuous;

                                currentSheet.Range["I" + i].Value             = dato.abonoKs;
                                currentSheet.Range["I" + i].Borders.LineStyle = XlLineStyle.xlContinuous;

                                currentSheet.Range["J" + i].Value             = dato.saldo;
                                currentSheet.Range["J" + i].Borders.LineStyle = XlLineStyle.xlContinuous;
                                i++;
                            }
                            //currentSheet.Columns.AutoFit();
                            cliente.Close();
                        }
                    }
                }
            }
        }