Nothing Special   »   [go: up one dir, main page]

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

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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