private bool verificaValidacionesFactura() { epProvider.Clear(); if (!formularioFacturaCompleto()) { return(false); } if (!facturaVerificaTiposDeDatos()) { return(false); } if (FacturasRepositorio.esFacturaExistente(tx_numero_factura.Text)) { MessageBox.Show("Ya existe una factura con el numero ingresado", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (tabla_items.Rows.Count == 0) { MessageBox.Show("No se han registrado items para la factura", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } DateTime fecha_alta = date_fecha_alta_factura.Value; DateTime fecha_vencimiento = date_vencimiento_factura.Value; ComparadorFechas comparadorFechas = new ComparadorFechas(); if (comparadorFechas.esMenor(fecha_vencimiento, fecha_alta)) { MessageBox.Show("La fecha de vencimiento no puede ser menor a la fecha de alta", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (comparadorFechas.esMenor(fecha_vencimiento, DateTime.Now)) { MessageBox.Show("La fecha de vencimiento no puede ser menor al dia de hoy", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (comparadorFechas.esMenor(DateTime.Now, fecha_alta)) { MessageBox.Show("La fecha de alta no puede ser mayor al dia de hoy", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
private void btn_buscar_Click(object sender, EventArgs e) { if (!verificaValidaciones()) { return; } tabla_facturas.Rows.Clear(); List <Factura> facturas = FacturasRepositorio.getFacturas(tx_numero_factura.Text, tx_cliente.Text, combo_empresas.Text, date_fecha_alta.Value, date_fecha_vencimiento.Value, cb_fecha_alta.Checked, cb_fecha_vencimiento.Checked); foreach (Factura factura in facturas) { String[] row = new String[] { factura.numero.ToString(), factura.empresa_cuit, factura.cliente.ToString(), factura.total.ToString(), factura.fecha_alta.ToString(), factura.fecha_vencimiento.ToString(), factura.habilitada.ToString() }; tabla_facturas.Rows.Add(row); } actualizarTablaFacturas(); }
private void bajarFactura(string factura, int indice) { if (FacturasRepositorio.esFacturaRendida(factura)) { MessageBox.Show("La factura no puede ser inhabilitada porque ya fue rendida", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (FacturasRepositorio.esFacturaPagada(factura)) { MessageBox.Show("La factura no puede ser inhabilitada porque ya fue pagada", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FacturasRepositorio.inhabilitar(factura); tabla_facturas.Rows[indice].Delete(); actualizarTablaFacturas(); MessageBox.Show("La factura ha sido inhabilitada exitosamente", "Inhabilitacion de factura", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btn_alta_factura_Click(object sender, EventArgs e) { if (!verificaValidacionesFactura()) { return; } factura.habilitada = true; factura.numero = Convert.ToInt32(tx_numero_factura.Text); factura.cliente = ((Cliente)combo_clientes.SelectedItem).dni; factura.empresa_cuit = ((Empresa)combo_empresas.SelectedItem).cuit; factura.fecha_alta = Convert.ToDateTime(date_fecha_alta_factura.Value); factura.fecha_vencimiento = Convert.ToDateTime(date_vencimiento_factura.Value); factura.setMontoTotal(); factura.setItemsNumeroFactura(); FacturasRepositorio.agregar(factura); limpiarVentana(); MessageBox.Show("La factura ha sido dada de alta exitosamente", "Alta de Factura", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public ModificacionFactura(string numero_factura) { InitializeComponent(); var materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); tabla_items.Columns.Add("Detalle", typeof(string)); tabla_items.Columns.Add("Cantidad", typeof(string)); tabla_items.Columns.Add("Monto", typeof(string)); cargarEmpresas(); cargarClientes(); factura = FacturasRepositorio.getFactura(Convert.ToInt32(numero_factura)); combo_clientes.Text = factura.cliente.ToString(); combo_empresas.Text = factura.empresa_cuit; tx_numero_factura.Text = factura.numero.ToString(); date_fecha_alta_factura.Value = factura.fecha_alta; date_vencimiento_factura.Value = factura.fecha_vencimiento; foreach (ItemFactura item in factura.get_items_factura) { tabla_items.Rows.Add(item.detalle, item.cantidad, item.monto); } actualizarTablaItems(); if (factura.habilitada) { check_box_habilitacion.Checked = true; check_box_habilitacion.Enabled = false; } else { check_box_habilitacion.Checked = false; check_box_habilitacion.Enabled = true; } }
private void btn_buscar_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(tx_numero_cliente.Text)) { MessageBox.Show("Debe ingresar un DNI", "Devolucion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!Regex.IsMatch(tx_numero_cliente.Text, @"^[0-9]{7,8}$")) { MessageBox.Show("Ingrese un DNI válido.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tabla_facturas_pagas.Rows.Clear(); List <Factura> facturas = FacturasRepositorio.getFacturasPagasActualesDeCliente(tx_numero_cliente.Text); foreach (Factura factura in facturas) { String[] row = new String[] { factura.cliente.ToString(), factura.numero.ToString(), factura.total.ToString(), factura.fecha_vencimiento.ToString() }; tabla_facturas_pagas.Rows.Add(row); } actualizarTablaFacturasPagas(); }
private void btn_buscar_Click(object sender, EventArgs e) { limpiarFacturas(); tabla_facturas.Rows.Clear(); List <Factura> facturas = FacturasRepositorio.getFacturasARendirDeEmpresa(combo_empresas.Text, Convert.ToDateTime(date_fecha_rendicion.Text)); if (facturas.Count == 0) { mensajeDeErrorEmpresa(); } foreach (Factura factura in facturas) { total += factura.total; cantidadFacturas += 1; String[] row = new String[] { factura.numero.ToString(), factura.empresa_cuit, factura.cliente.ToString(), factura.total.ToString() }; tabla_facturas.Rows.Add(row); } actualizarTablaFacturas(); }
private void button_realizar_rendicion_Click(object sender, EventArgs e) { List <int> listaNumFact = new List <int>(); if (tabla_facturas.Rows.Count == 0) { MessageBox.Show("No se encontraron facturas", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { foreach (DataGridViewRow factura in data_facturas.Rows) { listaNumFact.Add(Convert.ToInt32(tabla_facturas.Rows[factura.Index]["numero"])); } double porcentajeComision = Convert.ToDouble(tx_porcentaje_comision.Value); string empresa = combo_empresas.Text; FacturasRepositorio.rendir(listaNumFact, comision, cantidadFacturas, total, porcentajeComision, empresa); tabla_facturas.Rows.Clear(); MessageBox.Show("Facturas rendidas correctamente", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool verificaValidacionesFactura() { bool error = true; errorProvider1.Clear(); if (!verificaFormularioCompleto()) { return(error); } if (!verificaTiposDatosFactura()) { return(error); } DateTime fecha_vencimiento = date_fecha_vencimiento.Value; DateTime fecha_actual = DateTime.Now; if (!clienteDefinido()) { inicializarCliente(); } else { if (this.cliente != Convert.ToInt32(combo_clientes.Text)) { MessageBox.Show("El pago solo puede realizarse para un unico cliente", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } } if (esFacturaYaAgregadaParaPagar(tx_numero_factura.Text)) { MessageBox.Show("La factura ya fue ingresada para pagar", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.esFacturaExistente(tx_numero_factura.Text)) { MessageBox.Show("La factura no existe", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (FacturasRepositorio.esFacturaPagada(tx_numero_factura.Text)) { MessageBox.Show("La factura ya fue pagada", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.esFacturaHabilitada(tx_numero_factura.Text)) { MessageBox.Show("La factura no esta habilitada para pagar", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!EmpresasRepositorio.esEmpresaHabilitada(((Empresa)(combo_empresas.SelectedItem)).cuit)) { MessageBox.Show("La empresa no esta habilitada", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.esFacturaDelCliente(tx_numero_factura.Text, combo_clientes.Text)) { MessageBox.Show("La factura no le corresponde al cliente", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.esFacturaDeLaEmpresa(tx_numero_factura.Text, ((Empresa)combo_empresas.SelectedItem).cuit)) { MessageBox.Show("La factura no le corresponde a la empresa", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (Convert.ToDouble(tx_importe.Text) <= 0) { MessageBox.Show("El importe ingresado no puede ser menor o igual a 0", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.verificaFechaVencimiento(tx_numero_factura.Text, fecha_vencimiento)) { MessageBox.Show("La fecha de vencimiento ingresada no coincide con la fecha de vencimiento de la factura", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } ComparadorFechas comparadorFechas = new ComparadorFechas(); if (comparadorFechas.esMenor(fecha_vencimiento, fecha_actual)) { MessageBox.Show("La fecha de vencimiento ha expirado, el cliente debera regularizar su situacion con su proveedor del servicio", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } if (!FacturasRepositorio.esImporteCorrecto(tx_numero_factura.Text, tx_importe.Text)) { MessageBox.Show("El importe ingresado no coincide con el importe de la factura", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(error); } error = false; return(error); }