private void btnGuardar_Click(object sender, EventArgs e) { try { ParametroNCFBL ObjetoParametro = new ParametroNCFBL(); //Parametro de comprobantes fiscales //Verificamos que la factura tenga elementos en el detalle if (dgvDetalleFactura.RowCount > 0) { //Verificamos si existe disponibilidad del comprobante y el cliente posee RNC para el mismo. if (ObjetoParametro.Disponibilidad(ObtenerTipoComprobante())) { FacturaBL ObjetoFactura = new FacturaBL(); //Numero de Factura Generada Int32 FacturaID = Convert.ToInt32(ObjetoFactura.Crear(ObtenerFactura())); //Insertamos el detalle de factura if (FacturaID != -1) { try { //Insertamos el detalle de la factura InsertarDetalle(FacturaID); //Generamos un # de comprobante fiscal dependiendo del tipo de comprobante seleccionado AsignarNCF(FacturaID); //Mostramos el modulo de pagos //frmPagoFactura PagarFactura = new frmPagoFactura(FacturaID, _TotalGeneral); //PagarFactura.ShowDialog(this); //Inhabilitamos el boton de guardar para evitar que se guarde nuevamente la factura; btnGuardar.Enabled = false; } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Error en facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("El tipo de comprobante seleccionado esta agotado o no existe, favor verificar", "Error en Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Debe agregar elementos a la presente factura", "Error en facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); IniciarBusquedaArticulo(); } } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Error en facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAceptar_Click(object sender, EventArgs e) { try { ParametroNCFBL ObjetoParametro = new ParametroNCFBL(); ObjetoParametro.GuardarCambios(ObtenerDatos()); this.Close(); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void btnEliminar_Click(object sender, EventArgs e) { //Actualizamos el estatus del parametro DialogResult Resultado; Resultado = MessageBox.Show("Esta seguro de suspender el uso de este parametro de comprobante fiscal?", "Suspender parametro", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Resultado == DialogResult.Yes) { ParametroNCFBL ObjetoParametro = new ParametroNCFBL(); cParametroNCF Parametro = ObjetoParametro.BuscarPorID(ParametroID); //Buscamos el parametro por codigo ObjetoParametro.Eliminar(Parametro); //Actualizamos el estatus del parametro } }
private void frmAgregarEditarComprobantes_Load(object sender, EventArgs e) { CargarDependencias(); if (ParametroID.HasValue) { //Mostramos la informacion del parametro Int32 ID = Convert.ToInt32(ParametroID); ParametroNCFBL ObjetoParametro = new ParametroNCFBL(); MostrarDatos(ObjetoParametro.BuscarPorID(ID)); } else { lblCodigo.Text = "-1"; } }
private void CargarParametros() { try { ParametroNCFBL ObjetoParametro = new ParametroNCFBL(); CargaComprobantesConCreditoFiscal(ObjetoParametro.Listar(1)); CargaComprobantesParaConsumidorFinal(ObjetoParametro.Listar(2)); CargarComprobantesGubernamentales(ObjetoParametro.Listar(3)); CargaComprobanteRegimenEspecial(ObjetoParametro.Listar(4)); CargaComprobanteNotasCredito(ObjetoParametro.Listar(5)); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }