0% found this document useful (0 votes)
55 views2 pages

Using Using Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Static Int Static String

This document contains code for a C# Windows Forms application that calculates loan details. It defines classes to represent credit products and customers. When the "Calculate" button is clicked, it collects form field data to create a Credit object, calculates pricing details, and adds a row to a list view. When the "Letters" button is clicked, it calculates interest amounts and payment schedules for 3, 6, 9, or 12 month terms based on the selected radio button, displaying the results in another list view.

Uploaded by

mike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Using Using Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Static Int Static String

This document contains code for a C# Windows Forms application that calculates loan details. It defines classes to represent credit products and customers. When the "Calculate" button is clicked, it collects form field data to create a Credit object, calculates pricing details, and adds a row to a list view. When the "Letters" button is clicked, it calculates interest amounts and payment schedules for 3, 6, 9, or 12 month terms based on the selected radio button, displaying the results in another list view.

Uploaded by

mike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using Capa_Entidad;

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Capa_Presentacion
{
public partial class FrmCredito : Form
{
static int[] letra = { 3, 6, 9, 12 };
static string[] productos =
{"Lavadora","Refrigeradora","Licuadora","Extractora","Radio","DVD","BluRay"};

ArrayList aProductos = new ArrayList(productos);


ArrayList aLetras = new ArrayList(letra);

double tsubtotal=0;
double tinteres=0;

public FrmCredito()
{
InitializeComponent();
}

private void FrmCredito_Load(object sender, EventArgs e)


{
cboLetras.DataSource = aLetras;
cboProducto.DataSource = aProductos;
mostrarFecha();
mostrarHora();
}

void mostrarFecha()
{
lblFecha.Text = DateTime.Now.ToShortDateString();
}
void mostrarHora()
{
lblHora.Text = DateTime.Now.ToShortTimeString();
}

private void btnCalcular_Click(object sender, EventArgs e)


{
//objeto
Credito objCre = new Credito();
objCre.Cliente = txtCliente.Text;
objCre.Ruc = txtRuc.Text;
objCre.Fecha = DateTime.Parse(lblFecha.Text);
objCre.Hora = DateTime.Parse(lblHora.Text);

objCre.Producto = cboProducto.Text;
objCre.Cantidad = int.Parse(txtCantidad.Text);
ListViewItem fila = new ListViewItem(objCre.getX().ToString());
fila.SubItems.Add(objCre.Producto);
fila.SubItems.Add(objCre.Cantidad.ToString());
fila.SubItems.Add(objCre.asignarPrecio().ToString("C"));
fila.SubItems.Add(objCre.calculaSubtotal().ToString());
lvDetalle.Items.Add(fila);
tsubtotal += objCre.calculaSubtotal();
lblNeto.Text = tsubtotal.ToString("0.00");

private void btnLetras_Click(object sender, EventArgs e)


{
Credito li = new Credito();
li.Letras = int.Parse(cboLetras.Text);
double x = li.calculaMontoInteres(tsubtotal);

double y = li.calculaMontoMensual(tsubtotal,x);
tinteres = y;
int letras = int.Parse(cboLetras.Text);
switch (letras)
{
case 3: montoLetras(3); break;
case 6: montoLetras(6); break;
case 9: montoLetras(9); break;
case 12: montoLetras(12); break;
}
}
void montoLetras(int le)
{
double monto = tinteres;
double x=0;
lvDetalle1.Items.Clear();
for (int i = 1; i <= le; i++)
{
ListViewItem fila = new ListViewItem(i.ToString());
fila.SubItems.Add(monto.ToString("C"));
lvDetalle1.Items.Add(fila);
x += monto;
}
lblInteres.Text = x.ToString("C");
}
}
}

You might also like