Esempio n. 1
0
        private void Tcredito_LostFocus(Object sender, EventArgs e)// Handles Tcredito.LostFocus
        {
            string sMil = P.Auxiliar.getSeparadorMil;

            if (Tcredito.Text != string.Empty)
            {
                string procesar;
                int    valor;
                procesar = Tcredito.Text;
                procesar = procesar.Replace(sMil, "");
                if (int.TryParse(procesar, out valor))
                {
                    Tcredito.Text = valor.ToString("#,##0");
                }
                else
                {
                    P.Mensaje.Info("Solo puede ingresar números en la cantidad");
                    Tcredito.Focus();
                    Tcredito.Text = string.Empty;
                }
            }
        }
Esempio n. 2
0
        private void btn_guardar_Click(Object sender, EventArgs e) //Handles btn_guardar.Click
        {
            //validar información ingresada
            if (Tfecha_compra.Value.ToString() == string.Empty)
            {
                P.Mensaje.Advert("Debe indicar la fecha de ingreso por Obra en Construcción");
                Tfecha_compra.Focus();
                return;
            }
            if (Tfecha_conta.Value.ToString() == string.Empty)
            {
                P.Mensaje.Advert("Debe indicar la fecha de contabilizacion de Obra en Construcción");
                Tfecha_conta.Focus();
                return;
            }
            if (cboZona.SelectedIndex == -1)
            {
                P.Mensaje.Advert("Debe indicar la zona de la Obra en Construcción");
                cboZona.Focus();
                return;
            }
            if (Tcredito.Text == string.Empty)
            {
                P.Mensaje.Advert("Debe indicar el monto de Obra en Construcción");
                Tcredito.Focus();
                return;
            }
            if (Tdoc.Text == string.Empty)
            {
                DialogResult eleccion;
                eleccion = P.Mensaje.Confirmar("Desea continuar sin indicar el Nº de documento de Obra en Construcción");
                if (eleccion != DialogResult.Yes)      //no marco SI
                {
                    Tdoc.Focus();
                    return;
                }
            }
            if (Tdescrip.Text == string.Empty)
            {
                P.Mensaje.Advert("Debe indicar la descripción o referencia de la Obra en Construcción");
                Tdescrip.Focus();
                return;
            }
            //fin validación
            //inicio preparar datos para ingresar
            string   documento, proveedor, descp;
            decimal  credit_amo;
            DateTime fechaC, fechaGL;

            PD.GENERIC_VALUE zona;
            fechaC  = Tfecha_compra.Value;
            fechaGL = Tfecha_conta.Value;
            zona    = (PD.GENERIC_VALUE)cboZona.SelectedItem;
            descp   = Tdescrip.Text;
            if (!decimal.TryParse(Tcredito.Text, out credit_amo))
            {
                P.Mensaje.Advert("Monto ingresado no es valido");
                Tcredito.Focus();
                return;
            }

            if (Tdoc.Text == string.Empty)
            {
                documento = P.Consultas.documentos.defaultDocument;
            }
            else
            {
                documento = Tdoc.Text;
            }
            if (cboProveedor.SelectedIndex == -1)
            {
                proveedor = P.Consultas.documentos.defaultProveed;
            }
            else
            {
                proveedor = ((PD.SV_PROVEEDOR)cboProveedor.SelectedItem).COD;
            }
            //Valido que no se haya ingresado duplicado comprobando el documento, proveedor y zona
            int contar;

            contar = P.Consultas.documentos.buscar_entrada_obc(documento, proveedor, zona.id);
            if (contar > 0)
            {
                P.Mensaje.Error("La entrada indicada ya existe en el sistema");
                return;
            }
            //ingreso en obra_cons
            PD.RespuestaAccion mRS;
            mRS = P.Consultas.obc.INGRESO_OBC(fechaC, zona.id, proveedor, documento, descp, credit_amo, fechaGL);
            if (mRS.codigo < 0)
            {
                P.Mensaje.Error(mRS.descripcion);
            }
            else
            {
                //fin ingreso en obra_cons
                P.Mensaje.Info("Registro de Obra en Construccion ingresado correctamente");
                btn_guardar.BackColor = Color.OrangeRed;
            }
        }