private bool CrearNotaDeCredito()
        {
            notasDeCreditoEntidad.FacturaID        = Convert.ToInt32(txtFacturaID.Text);
            notasDeCreditoEntidad.FacturaAplicarID = Convert.ToInt32(CBFacturasPendientes.Text);
            notasDeCreditoEntidad.Fecha            = System.DateTime.Now;
            notasDeCreditoEntidad.UserID           = Login.userID;
            NCF = Properties.Settings.Default.CNotaDeCredito + 1;
            notasDeCreditoEntidad.NCF = "00000000B04" + NCF.ToString("D8");
            notasDeCreditoEntidad.FechaVencimiento = Properties.Settings.Default.FechaVencimiento;
            notasDeCreditoEntidad.ValorAplicado    = Convert.ToDecimal(txtValorAAplicar.Text);

            var result = notasDeCreditoNegocio.AgregarNotaDeCredito(notasDeCreditoEntidad);

            if (result.Item1)
            {
                notaDeCreditoID = result.Item2;
                MessageBox.Show(string.Format("La nota de credito {0} fue creada exitosamente...", notaDeCreditoID), "Nota De Credito Creada Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CrearDetalleNotaDeCredito();
                Properties.Settings.Default.CNotaDeCredito = NCF;
                Properties.Settings.Default.Save();
                return(true);
            }
            else
            {
                MessageBox.Show("Ha ocurrido un error en la crecion de la nota de credito...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 2
0
        private void CrearFacturaComprobante()
        {
            if (checkboxClienteAnonimo.Checked == true)
            {
                facturaEntidad.ClienteID = 1;
            }
            else
            {
                facturaEntidad.ClienteID = Convert.ToInt32(txtClienteID.Text);
            }

            NCF = Properties.Settings.Default.CFiscalSecuencia + 1;
            facturaEntidad.Fecha            = DateTime.Now;
            facturaEntidad.TipoPagoID       = (int)char.GetNumericValue(cbTipoPago.Text[0]);
            facturaEntidad.TipoFacturaID    = (int)char.GetNumericValue(cbTipoFactura.Text[0]);
            facturaEntidad.NCF              = "00000000B01" + NCF.ToString("D8");
            facturaEntidad.UserID           = Login.userID;
            facturaEntidad.RNC              = txtRNC.Text;
            facturaEntidad.Entidad          = txtNombre.Text;
            facturaEntidad.FechaVencimiento = Properties.Settings.Default.FechaVencimiento;

            var result = facturasNegocio.InsertarFactura(facturaEntidad);

            if (result.Item1)
            {
                Properties.Settings.Default.CFiscalSecuencia = NCF;
                Properties.Settings.Default.Save();
                facturaID = result.Item2;
                CrearDetalleFactura();
            }
        }
Exemplo n.º 3
0
        private void cmdAgregarNCF_Click(object sender, EventArgs e)
        {
            datos objDato = new datos();

            objDato.Conectar();
            string sql = "";

            sql = ("select n.ncf_ncf from NCF n where n.codigo_tncf = " + this.cmbTipoNCF.SelectedValue.ToString() + " and estado = 1");
            objDato.Consulta_llenar_datos(sql);
            this.txtCantidad.Focus();

            if (objDato.ds.Tables[0].Rows.Count > 0)
            {
                string NCF;
                NCF = objDato.ds.Tables[0].Rows[0][0].ToString();
                this.txtNCF.Text = NCF.ToString();
            }
            else
            {
                MessageBox.Show("No hay NCF disponibles de este tipo");
            }
            objDato.Desconectar();
        }