예제 #1
0
 private void Btn_Guardar_Click(object sender, EventArgs e)
 {
     if (Cmb_SelectCredito.SelectedIndex == -1)
     {
         MessageBox.Show("Ingrese un Tipo de Credito Por Favor", "Gestion Ventas", MessageBoxButtons.OK);
         return;
     }
     else
     {
         C_Credito objetoCredito = new C_Credito();
         C_Compra  objetoCompra  = new C_Compra();
         C_Venta   objetoVenta   = new C_Venta();
         if (Cmb_SelectCredito.Text == "Credito de Compra")
         {
             if (Cmb_I_Proveedor.SelectedIndex == -1)
             {
                 MessageBox.Show("Ingrese un Proveedor Por Favor", "Gestion Ventas", MessageBoxButtons.OK);
                 return;
             }
             else
             {
                 objetoCompra.CodigoProveedor = Int32.Parse(Cmb_I_Proveedor.SelectedValue.ToString());
             }
             objetoCompra.NumeroDocumento = Txt_I_NumDocumento.Text;
             objetoCredito.CodigoCompra   = _shalong.CompraCodigo(objetoCompra);
             objetoCredito.CodigoVenta    = -1;
             MessageBox.Show("Se Ingreso Correctamente el Credito de Compra", "Gestion Ventas", MessageBoxButtons.OK);
         }
         else if (Cmb_SelectCredito.Text == "Credito de Venta")
         {
             objetoVenta.NumeroDocumentoVenta = Txt_I_NumDocumento.Text;
             objetoCredito.CodigoVenta        = _codigoVenta;
             objetoCredito.CodigoCompra       = -1;
             objetoCredito.CodigoTrabajador   = -1;
             objetoCredito.FechaProxPago      = dtp_proximoPago.Value;
             objetoCredito.TotalDeuda         = Double.Parse(Txt_I_TotalDeuda.Text);
             objetoCredito.Monto          = Double.Parse(Txt_I_MontoPagado.Text);
             objetoCredito.CodigoCaja     = _objetoParametros.CodigoCaja;
             objetoCredito.CodigoTipoPago = 10;
             _shalong.CreditoCompraVenta(1, objetoCredito);
             MessageBox.Show("Se Ingreso Correctamente el Credito de Venta", "Gestion Ventas", MessageBoxButtons.OK);
             this.Hide();
         }
     }
 }
        //GUARDA EN LA TABLA CREDITO
        public void GuardarEnCredito()
        {
            C_CreditoTrabajador objCT = new C_CreditoTrabajador();

            objCT.CodigoUsuario   = Int32.Parse(Txt_CodigoUsuario.Text);
            objCT.CodigoTipoPago  = Int32.Parse(Cmb_TipoPago.SelectedValue.ToString());
            objCT.MontoPrestamo   = Double.Parse(Txt_Monto.Text);
            objCT.NumeroDocumento = Txt_nroDocumento.Text;
            objCT.Observacion     = Txt_Observacion.Text;
            objCT.CodigoCaja      = _codigoCaja;

            C_Credito objCredito = new C_Credito();

            objCredito.CodigoCompra = -1;
            objCredito.CodigoVenta  = -1;
            if (_shalong.CodigoTrabajadorCredito(objCT) == 0)
            {
                MessageBox.Show("El Credito Anterior no existe actualmente", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                objCredito.CodigoTrabajador = _shalong.CodigoTrabajadorCredito(objCT);
            }
            objCredito.FechaProxPago  = DateTime.Now;
            objCredito.TotalDeuda     = Double.Parse(Txt_Monto.Text);
            objCredito.Monto          = 0.0;
            objCredito.CodigoCaja     = _codigoCaja;
            objCredito.CodigoTipoPago = Int32.Parse(Cmb_TipoPago.SelectedValue.ToString());
            if (!_shalong.CreditoCompraVenta(1, objCredito))
            {
                MessageBox.Show("El Credito al Trabajador No se Guardo en Credito Correctamente", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            this.Hide();
        }
예제 #3
0
        //BOTONES

        // GUARDA EN CREDITO COMO COMPRA
        private void GuardarCreditoCompra()
        {
            C_Credito objetoCredito = new C_Credito();

            // Datos para SumaFecha
            if (Cmb_I_Proveedor.SelectedIndex == -1)
            {
                MessageBox.Show("Ingrese un Proveedor", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                objetoCredito.CodigoProveedor = Int32.Parse(Cmb_I_Proveedor.SelectedValue.ToString());
            }
            objetoCredito.Fecha = dtp_I_Fecha.Value;
            // ----------
            // Datos para CompraCodigo
            C_Compra objetoCompra = new C_Compra();

            if (Txt_I_NroDocumento.Text == string.Empty)
            {
                MessageBox.Show("Ingrese un Nro de Documento", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                objetoCompra.NumeroDocumento = Txt_I_NroDocumento.Text;
            }
            objetoCompra.CodigoProveedor = Int32.Parse(Cmb_I_Proveedor.SelectedValue.ToString());
            // -------------
            objetoCredito.CodigoCompra     = _shalong.CompraCodigo(objetoCompra);
            objetoCredito.CodigoVenta      = -1;
            objetoCredito.CodigoTrabajador = -1;
            objetoCredito.FechaProxPago    = _shalong.SumaFecha(objetoCredito);
            if (chk_Credito.Checked == true)
            {
                if (Txt_I_Total.Text == string.Empty)
                {
                    MessageBox.Show("Ingrese un Producto", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else
                {
                    objetoCredito.TotalDeuda = double.Parse(Txt_I_Total.Text);
                    objetoCredito.Monto      = 0;
                }
            }
            else
            {
                if (Txt_I_Total.Text == string.Empty)
                {
                    MessageBox.Show("Ingrese un Producto", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else
                {
                    objetoCredito.TotalDeuda = 0.0;
                    objetoCredito.Monto      = double.Parse(Txt_I_Total.Text);
                }
            }

            if (_codigoCaja == null)
            {
                MessageBox.Show("No se ingreso desde una caja", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                objetoCredito.CodigoCaja = _codigoCaja;
            }
            objetoCredito.CodigoTipoPago = 10;
            if (_shalong.CreditoCompraVenta(1, objetoCredito))
            {
            }
            else
            {
                MessageBox.Show("No se pudo guardar la Compra", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }