예제 #1
0
 public void ObtenerDatosAdmisiones_x_Cedula()
 {
     try
     {
         string msj = string.Empty;
         neg           = new tb_persona_bus();
         infoPersona   = new tb_persona_Info();
         AspiranteInfo = new Aca_Aspirante_Info();
         AspBus        = new Aca_Aspirante_Bus();
         infoPersona   = neg.Get_Info_Persona(txtCedRuc.Text.Trim());
         AspiranteInfo = AspBus.Get_Info_Aspirante(infoPersona.IdPersona, ref msj);
         admisionInfo.IdInstitucion = param.IdInstitucion;
         admisionInfo.IdAspirante   = AspiranteInfo.IdAspirante;
         admisionInfo.aspiranteInfo.Persona_Info.IdPersona          = infoPersona.IdPersona;
         admisionInfo.aspiranteInfo.Persona_Info.pe_nombre          = infoPersona.pe_nombre;
         admisionInfo.aspiranteInfo.Persona_Info.pe_apellido        = infoPersona.pe_apellido;
         admisionInfo.aspiranteInfo.Persona_Info.pe_cedulaRuc       = infoPersona.pe_cedulaRuc;
         admisionInfo.aspiranteInfo.Persona_Info.pe_fechaNacimiento = infoPersona.pe_fechaNacimiento;
         admisionInfo.aspiranteInfo.Persona_Info.pe_correo          = infoPersona.pe_correo;
         admisionInfo.aspiranteInfo.Persona_Info.pe_direccion       = infoPersona.pe_direccion;
         admisionInfo.aspiranteInfo.Persona_Info.pe_sexo            = infoPersona.pe_sexo;
         admisionInfo.aspiranteInfo.Persona_Info.pe_telefonoCasa    = infoPersona.pe_telefonoCasa;
         admisionInfo.aspiranteInfo.Persona_Info.IdTipoDocumento    = infoPersona.IdTipoDocumento;
         admisionInfo.aspiranteInfo.Persona_Info.pe_celular         = infoPersona.pe_celular;
         admisionInfo.aspiranteInfo.Persona_Info.pe_estado          = infoPersona.pe_estado;
         admisionInfo.aspiranteInfo.Pais_Info.IdPais = AspiranteInfo.Pais_Info.IdPais;
         admisionInfo.Estado = infoPersona.pe_estado;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + NameMetodo + " - " + ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
예제 #2
0
        public Boolean Anular(tb_persona_Info _PersonaInfo)
        {
            try
            {
                if (!(_PersonaInfo == null))
                {
                    get_Persona();
                    tb_persona_bus perBu = new tb_persona_bus();


                    return(perBu.AnularDB(_PersonaInfo, ref MensajeError));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(false);
            }
        }
예제 #3
0
 public void ObtenerDatosAspirante_x_Cedula()
 {
     try
     {
         tb_persona_bus  neg         = new tb_persona_bus();
         tb_persona_Info infoPersona = new tb_persona_Info();
         infoPersona = neg.Get_Info_Persona(txtCedRuc.Text.Trim());
         infoAspirante.IdInstitucion                   = param.IdInstitucion;
         infoAspirante.IdAspirante                     = Convert.ToDecimal(txtIdAspirante.Text);
         infoAspirante.Persona_Info.IdPersona          = infoPersona.IdPersona;
         infoAspirante.Persona_Info.pe_nombre          = infoPersona.pe_nombre;
         infoAspirante.Persona_Info.pe_apellido        = infoPersona.pe_apellido;
         infoAspirante.Persona_Info.pe_cedulaRuc       = infoPersona.pe_cedulaRuc;
         infoAspirante.Persona_Info.pe_fechaNacimiento = infoPersona.pe_fechaNacimiento;
         infoAspirante.Persona_Info.pe_correo          = infoPersona.pe_correo;
         infoAspirante.Persona_Info.pe_direccion       = infoPersona.pe_direccion;
         infoAspirante.Persona_Info.pe_sexo            = infoPersona.pe_sexo;
         infoAspirante.Persona_Info.pe_telefonoCasa    = infoPersona.pe_telefonoCasa;
         infoAspirante.Persona_Info.IdTipoDocumento    = infoPersona.IdTipoDocumento;
         infoAspirante.Persona_Info.pe_celular         = infoPersona.pe_celular;
         infoAspirante.Persona_Info.pe_estado          = infoPersona.pe_estado;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
0
        public Boolean Actualizar()
        {
            try
            {
                string megError = "";
                if (Validaciones() == false)
                {
                    return(false);
                }


                if (_PersonaInfo != null)
                {
                    get_Persona();
                    tb_persona_bus perBu = new tb_persona_bus();
                    return(perBu.ModificarDB(_PersonaInfo, ref megError));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(false);
            }
        }
예제 #5
0
        public Boolean grabar()
        {
            try
            {
                string  msgError = "";
                Boolean resultB;

                if (Validaciones() == false)
                {
                    return(false);
                }


                if (!(_PersonaInfo == null))
                {
                    decimal idPersonaOut;
                    idPersonaOut = 0;

                    get_Persona();
                    tb_persona_bus perBu = new tb_persona_bus();

                    if (perBu.GrabarDB(_PersonaInfo, ref idPersonaOut, ref msgError))
                    {
                        //llenando tipo persona
                        List <tb_personaxPersonaTipo_Info> lpersonaxPersonaTipo = new List <tb_personaxPersonaTipo_Info>();

                        for (int i = 0; i < chkListTipoPersona.CheckedItems.Count; i++)
                        {
                            if (chkListTipoPersona.GetItemChecked(i))
                            {
                                tb_personaTipo_Info         itemxPer      = (tb_personaTipo_Info)chkListTipoPersona.Items[i];
                                tb_personaxPersonaTipo_Info itemxTipoPero = new tb_personaxPersonaTipo_Info();
                            }
                        }



                        resultB = true;
                    }
                    else
                    {
                        resultB = false;
                    }

                    return(resultB);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(false);
            }
        }
예제 #6
0
        Boolean ValidarCedula(string txt_cedulaRucEmpleado)
        {
            // haac 24/09/2013
            tb_persona_bus BusPersona = new tb_persona_bus();

            try
            {
                string variable = (txt_cedulaRucEmpleado).TrimEnd();

                //int variable = Convert.ToInt32((this.txt_cedulaRucEmpleado.Text.Length));
                int cedula = Convert.ToInt32(variable.Length);

                // valida por cedula
                if (cedula != 10)
                {
                    MessageBox.Show("Numero Cedula Invalido");
                    //this.txt_cedulaRucEmpleado.Text = "";

                    return(false);
                }
                else
                {
                    try
                    {
                        if ((Convert.ToInt32(txt_cedulaRucEmpleado.Substring(0, 2)) > 25) || (Convert.ToInt32(txt_cedulaRucEmpleado.Substring(2, 1)) > 5))
                        {
                            MessageBox.Show("Numero Cedula Invalido");

                            return(false);
                        }
                        if (!BusPersona.Verifica_Ruc(txt_cedulaRucEmpleado, ref msg))
                        {
                            MessageBox.Show("Numero Cedula Invalido");
                            return(false);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log_Error_bus.Log_Error(ex.ToString());
                        MessageBox.Show("Numero Cedula Invalido");

                        return(false);
                    }
                }
                return(true);
            }


            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        public void load_combos()
        {
            try
            {
                cmb_PlanCta_Credito.cargar_PlanCta();
                cmb_PlanCtaAnti.cargar_PlanCta();
                cmb_plancta.cargar_PlanCta();
                ucGe_Sucursal_combo1.set_SucursalInfo(param.IdSucursal);
                tb_Ciudad_Bus         bus_ciudad = new tb_Ciudad_Bus();
                List <tb_ciudad_Info> lst_ciudad = bus_ciudad.Get_List_Ciudad();
                cmb_ciudad.DataSource = lst_ciudad;
                tb_parroquia_Bus bus_parroquia = new tb_parroquia_Bus();
                lst_parroquia            = bus_parroquia.Get_List_Parroquia();
                cmb_parroquia.DataSource = lst_parroquia;
                tb_persona_bus bus_persona = new tb_persona_bus();
                listaCliente   = new List <fa_Cliente_Info>();
                listaCliente   = bus_cliente.Get_List_Cliente(param.IdEmpresa);
                listaCliente   = listaCliente.Where(q => q.IdCliente != 0).ToList();
                listaformapago = busFormapago.Get_List_fa_formaPago();
                cmbformapago.Properties.DataSource = listaformapago;
                listaterminoPago = busterminoPago.Get_List_TerminoPago();
                cmbterminopago.Properties.DataSource = listaterminoPago;
                switch (_Accion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:
                    this.ucGe_Sucursal_combo1.get_SucursalInfo();

                    break;

                case Cl_Enumeradores.eTipo_action.actualizar:

                    break;

                case Cl_Enumeradores.eTipo_action.Anular:
                    break;

                case Cl_Enumeradores.eTipo_action.consultar:
                    break;

                default:
                    break;
                }
                this.cmb_cliente_principal.Properties.DataSource    = listaCliente;
                this.cmb_cliente_principal.Properties.DisplayMember = "Nombre_Cliente";
                this.cmb_cliente_principal.Properties.ValueMember   = "IdCliente";
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #8
0
 public bool Buscar_x_Persona(ref string mensaje)
 {
     try
     {
         Bus_Persona = new tb_persona_bus();
         bool existe = Bus_Persona.VericarCedulaExiste(txt_cedulaRucContacto.Text.Trim(), ref mensaje);
         return(existe);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #9
0
        private void cargar_Personas()
        {
            try
            {
                tb_persona_bus         perB    = new tb_persona_bus();
                List <tb_persona_Info> listPer = new List <tb_persona_Info>();

                listPer = perB.Get_List_Persona();
                this.gridControlPersona.DataSource = listPer;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #10
0
        private void load_Información()
        {
            try
            {
                tb_persona_bus bus_pers = new tb_persona_bus();
                lista_persona = bus_pers.Get_List_Persona();

                fa_Cliente_Bus bus_client = new fa_Cliente_Bus();
                lista_clientes = new BindingList <fa_Cliente_Info>(bus_client.Get_List_Clientes(param.IdEmpresa));
                gridControl_Clientes.DataSource = lista_clientes;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
예제 #11
0
        private void txt_ci_ruc_Leave(object sender, EventArgs e)
        {
            fa_Vendedor_Bus vendedor_bus = new fa_Vendedor_Bus();

            try
            {
                string         Mensaje = "";
                tb_persona_bus busPer  = new tb_persona_bus();
                if (!busPer.VericarCedulaExiste(txt_ci_ruc.Text, ref Mensaje))
                {
                    fa_Vendedor_Bus  busvend  = new fa_Vendedor_Bus();
                    fa_Vendedor_Info info_ven = new fa_Vendedor_Info();

                    info_ven                 = new fa_Vendedor_Info();
                    info_ven.IdEmpresa       = param.IdEmpresa;
                    info_ven.IdVendedor      = (this.lbl_id_vendedor.Text == "") ? 0 : Convert.ToInt32(this.lbl_id_vendedor.Text);
                    info_ven.Ve_Vendedor     = this.txt_vendedor.Text;
                    info_ven.Ve_Comision     = Convert.ToDouble(this.txt_comision.Text);
                    info_ven.ve_cedula       = txt_ci_ruc.Text;
                    info_ven.Estado          = (chk_estado.Checked == true) ? "A" : "I";
                    info_ven.IdUsuario       = param.IdUsuario;
                    info_ven.Fecha_Transac   = DateTime.Now;
                    info_ven.IdUsuarioUltAnu = param.IdUsuario;
                    info_ven.Fecha_UltAnu    = DateTime.Now;
                    info_ven.IdUsuarioUltMod = param.IdUsuario;
                    info_ven.Fecha_UltMod    = DateTime.Now;
                    info_ven.nom_pc          = param.nom_pc;
                    info_ven.ip              = param.ip;

                    if (busvend.VerificaSiExisteVendedor(info_ven, ref Mensaje))
                    {
                        _Accion = Cl_Enumeradores.eTipo_action.actualizar;
                        MessageBox.Show("El Vendedor ya existe se procedera a Modificarlo");
                    }
                    else
                    {
                        _Accion = Cl_Enumeradores.eTipo_action.grabar;
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #12
0
        public void load_combos()
        {
            try
            {
                fa_Cliente_Bus bus_cliente = new fa_Cliente_Bus();

                tb_persona_bus bus_persona = new tb_persona_bus();



                listaPersona = bus_persona.Get_List_Persona();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
예제 #13
0
        public tb_persona_Info Get_Info_Persona()
        {
            try
            {
                tb_persona_Info InfoPersona = new tb_persona_Info();


                if (cmb_beneficiario.EditValue != null && IdTipo_Persona == Cl_Enumeradores.eTipoPersona.PERSONA)
                {
                    Info_Beneficiario = list_Beneficiario.FirstOrDefault(v => v.IdBeneficiario == Convert.ToString(cmb_beneficiario.EditValue));
                    tb_persona_bus BusPersona = new tb_persona_bus();
                    InfoPersona = BusPersona.Get_Info_Persona(Info_Beneficiario.IdPersona);
                }

                return(InfoPersona);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(new tb_persona_Info());
            }
        }
        Boolean ValidarCedula()
        {
            try
            {
                info_doc_personal = UC_Doc_per.get_TipoDoc_Personales();
                tb_persona_bus tbPersona = new tb_persona_bus();
                string         msj       = "";

                if (info_doc_personal.codigo == "CED")
                {
                    if (txt_cedula.Text != "")
                    {
                        if (txt_cedula.Text.TrimStart().TrimEnd().Count() != 10)
                        {
                            MessageBox.Show("Cedula Incorrecta");
                            return(false);
                        }

                        if (!tbPersona.Verifica_Ruc(txt_cedula.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                            return(false);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite la Cedula");
                        return(false);
                    }
                }
                else if (info_doc_personal.codigo == "RUC")
                {
                    if (txt_cedula.Text != "")
                    {
                        if (txt_cedula.Text.Substring(10, 3) != "001")
                        {
                            MessageBox.Show("RUC Incorrecto");
                            return(false);
                        }
                        if (txt_cedula.Text.TrimStart().TrimEnd().Count() != 13)
                        {
                            MessageBox.Show("RUC Incorrecto");
                            return(false);
                        }
                        if (!tbPersona.Verifica_Ruc(txt_cedula.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite el Cedula");
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        private void gridViewCafa_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                if (e.Column.Name == "colTipoFamiliar")
                {
                    string valor = Convert.ToString(e.Value);

                    if (!Convert.ToBoolean(gridViewCafa.GetFocusedRowCellValue("Estado")))
                    {
                        gridViewCafa.SetFocusedRowCellValue(colEstado1, true);
                    }
                }

                if (e.Column.Name == "colCedula")
                {
                    if (e.Value != null || e.Value != "")
                    {
                        String caracteres = Convert.ToString(e.Value);
                        if (caracteres.Length == 10 || caracteres.Length == 13)
                        {
                            tb_persona_bus bus  = new tb_persona_bus();
                            string         mens = "";
                            if (!bus.Verifica_Ruc(Convert.ToString(e.Value), ref mens))
                            {
                                MessageBox.Show(mens, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            //mnuNuevo.Enabled = true;
                        }
                        else
                        {
                            if (caracteres.Length > 10 && caracteres.Length < 13)
                            {
                                MessageBox.Show("Faltan " + (13 - caracteres.Length) + " caracteres en el Ruc");
                                //mnuNuevo.Enabled = false;
                            }
                            else
                            {
                                if (caracteres.Length > 0 && caracteres.Length < 10)
                                {
                                    MessageBox.Show("Faltan " + (10 - caracteres.Length) + " caracteres en la Cédula");
                                    //mnuNuevo.Enabled = false;
                                }
                                else
                                {
                                    //igual a 0
                                    //mnuNuevo.Enabled = true;
                                }
                            }
                        }
                    }
                    if (!Convert.ToBoolean(gridViewCafa.GetFocusedRowCellValue("Estado")))
                    {
                        gridViewCafa.SetFocusedRowCellValue(colEstado1, true);
                    }
                }
                //gridViewCafa.SetFocusedRowCellValue(colEstado1, true);
                //repositoryItemCheckEditEstado.ValueChecked = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log_Error_bus.Log_Error(ex.Message); return;
            }
        }
예제 #16
0
        Boolean ValidarCedula()
        {
            try
            {
                Cl_TipoDoc_Personales_Info info_doc_personal = new Cl_TipoDoc_Personales_Info();
                info_doc_personal = ucGe_Docu_PerIdentificacion.get_TipoDoc_Personales();
                tb_persona_bus tbPersona = new tb_persona_bus();
                string         msj       = "";

                if (info_doc_personal.codigo == "CED")
                {
                    if (this.txtCedula.Text != "")
                    {
                        if (txtCedula.Text.TrimStart().TrimEnd().Length != 10)
                        {
                            MessageBox.Show("Cédula Incorrecta", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }

                        if (!tbPersona.Verifica_Ruc(txtCedula.Text, ref msj))
                        {
                            MessageBox.Show(msj, "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite la Cedula", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                else if (info_doc_personal.codigo == "RUC")
                {
                    if (txtCedula.Text != "")
                    {
                        if (txtCedula.Text.Substring(10, 3) != "001")
                        {
                            MessageBox.Show("RUC Incorrecto", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (txtCedula.Text.TrimStart().TrimEnd().Length != 13)
                        {
                            MessageBox.Show("RUC Incorrecto", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (!tbPersona.Verifica_Ruc(txtCedula.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite Ruc", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                return(false);
            }
        }
예제 #17
0
 public void ObtenerDatos_x_Cedula()
 {
     try
     {
         string msj = string.Empty;
         Bus_Persona   = new tb_persona_bus();
         infoPersona   = new tb_persona_Info();
         bus_contacto  = new tb_contacto_Bus();
         info_contacto = new tb_contacto_Info();
         infoPersona   = Bus_Persona.Get_Info_Persona(txt_cedulaRucContacto.Text.Trim());
         if (infoPersona != null)
         {
             if (infoPersona.IdPersona != 0)
             {
                 info_contacto = bus_contacto.Get_Info_contacto_x_Persona(param.IdEmpresa, infoPersona.IdPersona, ref msj);
                 if (info_contacto != null)
                 {
                     if (info_contacto.IdContacto != 0)
                     {
                         info_contacto.IdContacto         = info_contacto.IdContacto;
                         info_contacto.IdEmpresa          = info_contacto.IdEmpresa;
                         info_contacto.IdPais             = info_contacto.IdPais;
                         info_contacto.IdProvincia        = info_contacto.IdProvincia;
                         info_contacto.IdCiudad           = info_contacto.IdCiudad;
                         info_contacto.IdNacionalidad     = info_contacto.IdNacionalidad;
                         info_contacto.Organizacion       = info_contacto.Organizacion;
                         info_contacto.CodContacto        = info_contacto.CodContacto;
                         info_contacto.Cargo              = info_contacto.Cargo;
                         info_contacto.Pagina_Web         = info_contacto.Pagina_Web;
                         info_contacto.Notas              = info_contacto.Notas;
                         info_contacto.Mostrar_como       = info_contacto.Mostrar_como;
                         info_contacto.Codigo_postal      = info_contacto.Codigo_postal;
                         info_contacto.Fecha_alta         = info_contacto.Fecha_alta;
                         info_contacto.Fecha_Ult_Contacto = info_contacto.Fecha_Ult_Contacto;
                         //info_contacto.foto = info_contacto.foto;
                         txt_idContacto.ReadOnly     = true;
                         txt_codigoContacto.ReadOnly = true;
                     }
                 }
                 txt_cedulaRucContacto.Properties.ReadOnly = true;
                 txtIdPersona.Properties.ReadOnly          = true;
             }
             info_contacto.Persona_Info.IdPersona          = infoPersona.IdPersona;
             info_contacto.Persona_Info.pe_nombre          = infoPersona.pe_nombre;
             info_contacto.Persona_Info.pe_apellido        = infoPersona.pe_apellido;
             info_contacto.Persona_Info.pe_cedulaRuc       = infoPersona.pe_cedulaRuc;
             info_contacto.Persona_Info.pe_fechaNacimiento = infoPersona.pe_fechaNacimiento;
             info_contacto.Persona_Info.pe_Naturaleza      = infoPersona.pe_Naturaleza;
             info_contacto.Persona_Info.pe_razonSocial     = infoPersona.pe_razonSocial;
             info_contacto.Persona_Info.pe_direccion       = infoPersona.pe_direccion;
             //info_contacto.Persona_Info.pe_sexo = infoPersona.pe_sexo;
             info_contacto.Persona_Info.pe_telefonoCasa = infoPersona.pe_telefonoCasa;
             info_contacto.Persona_Info.IdTipoDocumento = infoPersona.IdTipoDocumento;
             info_contacto.Persona_Info.pe_celular      = infoPersona.pe_celular;
             info_contacto.Persona_Info.pe_estado       = infoPersona.pe_estado;
             info_contacto.Estado = infoPersona.pe_estado;
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show("Error " + ex.Message.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #18
0
        Boolean ValidarCedula()
        {
            try
            {
                Cl_TipoDoc_Personales_Info info_doc_personal = new Cl_TipoDoc_Personales_Info();
                info_doc_personal = ucGe_Docu_PerIdentificacion.get_TipoDoc_Personales();
                tb_persona_bus tbPersona = new tb_persona_bus();
                string         msj       = "";

                if (info_doc_personal.codigo == "CED")
                {
                    if (this.txtCedRuc.Text != "")
                    {
                        if (txtCedRuc.Text.TrimStart().TrimEnd().Length != 10)
                        {
                            MessageBox.Show("Cédula Incorrecta", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }

                        if (!tbPersona.Verifica_Ruc(txtCedRuc.Text, ref msj))
                        {
                            MessageBox.Show(msj, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                    }
                    else
                    {
                        MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Ingrese_CI_Ruc_Pasaporte), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                else if (info_doc_personal.codigo == "RUC")
                {
                    if (txtCedRuc.Text != "")
                    {
                        if (txtCedRuc.Text.Substring(10, 3) != "001")
                        {
                            MessageBox.Show("RUC Incorrecto", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (txtCedRuc.Text.TrimStart().TrimEnd().Length != 13)
                        {
                            MessageBox.Show("RUC Incorrecto", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (!tbPersona.Verifica_Ruc(txtCedRuc.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                        }
                    }
                    else
                    {
                        MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Ingrese_CI_Ruc_Pasaporte), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(false);
            }
        }
예제 #19
0
        private iva CargaDatos()
        {
            iva iva = new iva();

            try
            {
                progressBar1.Value = 40;

                cp_codigo_SRI_Bus         dat_ti             = new cp_codigo_SRI_Bus();
                List <cp_codigo_SRI_Info> ListCodigoSRI      = new List <cp_codigo_SRI_Info>();
                List <cp_codigo_SRI_Info> ListCodigoSustento = new List <cp_codigo_SRI_Info>();
                ListCodigoSRI = dat_ti.Get_List_codigo_SRI_(param.IdEmpresa);

                ListCodigoSustento = ListCodigoSRI.FindAll(c => c.co_estado == "A" && c.IdTipoSRI == "COD_IDCREDITO");

                List <cp_TipoDocumento_Info> LstTipDoc = new List <cp_TipoDocumento_Info>();
                cp_TipoDocumento_Bus         TipDoc_B  = new cp_TipoDocumento_Bus();
                LstTipDoc = TipDoc_B.Get_List_TipoDocumento();


                cp_orden_giro_pagos_sri_Bus   formasPago_B   = new cp_orden_giro_pagos_sri_Bus();
                cp_orden_giro_Bus             OGB            = new cp_orden_giro_Bus();
                cp_proveedor_Autorizacion_Bus Autorizacion_B = new cp_proveedor_Autorizacion_Bus();
                cp_proveedor_Bus Proveedor_B = new cp_proveedor_Bus();
                tb_persona_bus   Persona_B   = new tb_persona_bus();

                List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras> lstDetalleCompras = new List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras>();
                List <cp_orden_giro_Info> listaOG = new List <cp_orden_giro_Info>();
                listaOG = OGB.Get_List_orden_giro_SRI(param.IdEmpresa, Convert.ToInt32(cmb_anio.Text), Convert.ToInt32(cmb_periodo.SelectedValue));



                iva.IdInformante = Empresa_I.em_ruc;
                iva.razonSocial  = Empresa_I.RazonSocial.Replace(".", " ").Replace("ñ", "n").Replace("Ñ", "N");
                iva.Anio         = cmb_anio.Text;
                iva.Mes          = (cmb_periodo.SelectedValue.ToString().Length == 1) ? "0" + cmb_periodo.SelectedValue.ToString() : cmb_periodo.SelectedValue.ToString();

                tb_Sucursal_Bus bus_sucursal       = new tb_Sucursal_Bus();
                int             numEstablecimiento = bus_sucursal.Get_numEstablecimiento_x_empresa_SRI(param.IdEmpresa);
                iva.numEstabRuc = numEstablecimiento.ToString("000");


                iva.TipoIDInformante = ivaTypeTipoIDInformante.R;
                iva.codigoOperativo  = codigoOperativoType.IVA;
                iva.totalVentas      = 0;



                foreach (cp_orden_giro_Info item in listaOG)
                {
                    try
                    {
                        Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras itemDetalleCompras = new Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras();
                        if (item.IdCbteCble_Ogiro == 9)
                        {
                        }
                        info_Retencion_x_RF   = Retencion_B.Get_Info_retencion_X_Retecion_FT(param.IdEmpresa, item.IdCbteCble_Ogiro, item.IdTipoCbte_Ogiro);
                        info_Retencion_x_RIVA = Retencion_B.Get_Info_retencion_X_Retecion_RTIVA(param.IdEmpresa, item.IdCbteCble_Ogiro, item.IdTipoCbte_Ogiro);

                        string secuenci_numReten = "";
                        List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir> LstdetalleAir = new List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir>();
                        string fecRet = info_Retencion_x_RF.fecha.ToString("dd/MM/yyyy");


                        if (info_Retencion_x_RF.ListDetalle.Count != 0)
                        {
                            foreach (var item2 in info_Retencion_x_RF.ListDetalle)
                            {
                                Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir detalleAir = new Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir();
                                detalleAir.codRetAir = item2.CodigoSRI.Trim();

                                detalleAir.porcentajeAir = Convert.ToDecimal(item2.re_Porcen_retencion).ToString();
                                detalleAir.baseImpAir    = Convert.ToDecimal(item2.re_baseRetencion).ToString();

                                fecRet = info_Retencion_x_RF.fecha.ToString("dd/MM/yyyy");
                                detalleAir.valRetAir = Convert.ToDecimal(item2.re_valor_retencion).ToString();
                                LstdetalleAir.Add(detalleAir);
                            }
                        }


                        itemDetalleCompras.valRetBien10      = "0";
                        itemDetalleCompras.valRetServ20      = "0";
                        itemDetalleCompras.valRetServ50      = "0";
                        itemDetalleCompras.valRetServ100     = "0";
                        itemDetalleCompras.valorRetBienes    = "0";
                        itemDetalleCompras.valorRetServicios = "0";
                        itemDetalleCompras.totbasesImpReemb  = "0";


                        if (info_Retencion_x_RIVA.ListDetalle.Count != 0)
                        {
                            foreach (var item_iva in info_Retencion_x_RIVA.ListDetalle)
                            {
                                if (item_iva.re_Porcen_retencion == 10)
                                {
                                    itemDetalleCompras.valRetBien10 = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }

                                if (item_iva.re_Porcen_retencion == 20)
                                {
                                    itemDetalleCompras.valRetServ20 = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }

                                if (item_iva.re_Porcen_retencion == 30)
                                {
                                    itemDetalleCompras.valorRetBienes = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }

                                if (item_iva.re_Porcen_retencion == 50)
                                {
                                    itemDetalleCompras.valRetServ50 = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }

                                if (item_iva.re_Porcen_retencion == 70)
                                {
                                    itemDetalleCompras.valorRetServicios = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }


                                if (item_iva.re_Porcen_retencion == 100)
                                {
                                    itemDetalleCompras.valRetServ100 = Convert.ToDecimal(item_iva.re_valor_retencion).ToString();
                                }
                            }
                        }



                        if (item.IdIden_credito != 0)
                        {
                            var sustento = ListCodigoSustento.First(c => c.IdCodigo_SRI == item.IdIden_credito);
                            itemDetalleCompras.codSustento = sustento.codigoSRI;
                        }


                        if (!String.IsNullOrEmpty(item.co_serie))
                        {
                            string[] serie = Convert.ToString(item.co_serie).Split('-');

                            itemDetalleCompras.establecimiento = serie[0];
                            itemDetalleCompras.puntoEmision    = serie[1];
                        }


                        itemDetalleCompras.secuencial = item.co_factura;

                        //if (item.co_factura == "000002133") { MessageBox.Show(""); }



                        itemDetalleCompras.fechaRegistro = Convert.ToDateTime(item.co_FechaContabilizacion).ToString("dd/MM/yyyy");
                        itemDetalleCompras.idProv        = item.InfoProveedor.Persona_Info.pe_cedulaRuc.Trim();
                        itemDetalleCompras.tpIdProv      = (item.InfoProveedor.Persona_Info.IdTipoDocumento.Trim() == "RUC") ? "01" : ((item.InfoProveedor.Persona_Info.IdTipoDocumento.Trim() == "CED") ? "02" : "03");
                        itemDetalleCompras.parteRel      = (item.InfoProveedor.es_empresa_relacionada == true) ? parteRelType.SI : parteRelType.NO;
                        itemDetalleCompras.autorizacion  = (item.Num_Autorizacion == null) ? "" : item.Num_Autorizacion;



                        if (itemDetalleCompras.tpIdProv == "03")
                        {
                            itemDetalleCompras.tipoProv = (item.InfoProveedor.Persona_Info.pe_Naturaleza == "NATUR") ? "01" : "02";

                            if (item.InfoProveedor.es_empresa_relacionada == true)
                            {
                                itemDetalleCompras.parteRel = parteRelType.SI;
                            }
                            else
                            {
                                itemDetalleCompras.parteRel = parteRelType.NO;
                            }
                        }


                        var tipD = LstTipDoc.First(c => c.CodTipoDocumento == item.IdOrden_giro_Tipo);
                        itemDetalleCompras.tipoComprobante = tipD.CodSRI;
                        itemDetalleCompras.fechaEmision    = item.co_FechaFactura.ToString("dd/MM/yyyy");
                        itemDetalleCompras.autorizacion    = item.Num_Autorizacion;

                        itemDetalleCompras.baseNoGraIva  = "0";                                                                                                 //base NO objeto de IVA
                        itemDetalleCompras.baseImponible = Math.Round(Convert.ToDecimal(item.co_subtotal_siniva), 2, MidpointRounding.AwayFromZero).ToString(); // sin iva
                        itemDetalleCompras.baseImpGrav   = Math.Round(Convert.ToDecimal(item.co_subtotal_iva), 2, MidpointRounding.AwayFromZero).ToString();    //con iva
                        itemDetalleCompras.baseImpExe    = "0";

                        itemDetalleCompras.montoIce = Math.Round(Convert.ToDecimal(item.co_Ice_valor), 2, MidpointRounding.AwayFromZero).ToString();
                        itemDetalleCompras.montoIva = Math.Round(Convert.ToDecimal(item.co_valoriva), 2, MidpointRounding.AwayFromZero).ToString();

                        itemDetalleCompras.valRetBien10Specified     = true;
                        itemDetalleCompras.valRetServ20Specified     = true;
                        itemDetalleCompras.valRetServ50Specified     = true;
                        itemDetalleCompras.totbasesImpReembSpecified = true;

                        if (tipD.CodSRI == "05")
                        {
                            itemDetalleCompras.docModificado    = item.Tipodoc_a_Modificar;
                            itemDetalleCompras.estabModificado  = item.estable_a_Modificar;
                            itemDetalleCompras.ptoEmiModificado = item.ptoEmi_a_Modificar;
                            itemDetalleCompras.secModificado    = item.num_docu_Modificar;
                            itemDetalleCompras.autModificado    = item.aut_doc_Modificar;
                        }

                        if (LstdetalleAir.Count > 0)
                        {
                            itemDetalleCompras.air = LstdetalleAir;     //AREGLAR
                        }
                        if (!string.IsNullOrEmpty(info_Retencion_x_RF.NAutorizacion))
                        {
                            secuenci_numReten = info_Retencion_x_RF.NumRetencion.ToString();
                            string sSerieRetencion = "";
                            sSerieRetencion = info_Retencion_x_RF.serie1 + '-' + info_Retencion_x_RF.serie2;
                            if (!string.IsNullOrEmpty(sSerieRetencion))
                            {
                                itemDetalleCompras.estabRetencion1  = info_Retencion_x_RF.serie1;
                                itemDetalleCompras.ptoEmiRetencion1 = info_Retencion_x_RF.serie2;
                            }
                            itemDetalleCompras.secRetencion1 = secuenci_numReten;
                            itemDetalleCompras.autRetencion1 = info_Retencion_x_RF.NAutorizacion;
                            itemDetalleCompras.fechaEmiRet1  = fecRet;
                        }

                        lstDetalleCompras.Add(itemDetalleCompras);

                        pagoExterior Item_pagoExterior = new pagoExterior();

                        if (item.PagoLocExt == "LOC")
                        {
                            Item_pagoExterior.pagoLocExt = pagoLocExtType.Item01;
                        }
                        else
                        {
                            Item_pagoExterior.pagoLocExt = pagoLocExtType.Item02;
                        }


                        Item_pagoExterior.paisEfecPago = (Item_pagoExterior.pagoLocExt == pagoLocExtType.Item01) ? "NA" : (item.PaisPago != null || item.PaisPago != "") ? item.PaisPago : "NA";

                        Item_pagoExterior.aplicConvDobTrib   = (item.ConvenioTributacion == "S") ? aplicConvDobTribType.SI : (item.ConvenioTributacion == "N") ? aplicConvDobTribType.NO :aplicConvDobTribType.NA;
                        Item_pagoExterior.pagExtSujRetNorLeg = (item.PagoSujetoRetencion == "S") ? aplicConvDobTribType.SI : (item.PagoSujetoRetencion == "N") ? aplicConvDobTribType.NO : aplicConvDobTribType.NA;



                        itemDetalleCompras.pagoExterior = Item_pagoExterior;



                        List <cp_orden_giro_pagos_sri_Info> formasDePagoOG = new List <cp_orden_giro_pagos_sri_Info>();
                        formasDePagoOG = formasPago_B.Get_List_orden_giro_pagos_sri(item.IdEmpresa, item.IdCbteCble_Ogiro, item.IdTipoCbte_Ogiro);

                        string  cadena = "";
                        string  coma   = "";
                        Boolean Hay_registros_de_pagos = false;


                        if (formasDePagoOG.Count > 0)
                        {
                            foreach (var itemfp in formasDePagoOG)
                            {
                                if (itemfp.check == true)
                                {
                                    cadena = cadena + coma + itemfp.codigo_pago_sri;
                                    coma   = ",";
                                    Hay_registros_de_pagos = true;
                                }
                            }
                            if (Hay_registros_de_pagos)
                            {
                                itemDetalleCompras.formasDePago = cadena.Split(',');
                            }
                        }


                        if (Hay_registros_de_pagos == false)
                        {
                            decimal Total = 0;
                            Total = Convert.ToDecimal(itemDetalleCompras.baseNoGraIva) + Convert.ToDecimal(itemDetalleCompras.baseImpGrav);

                            if (Total >= 1000)
                            {
                                string[] arr1 = new string[] { "01" };
                                itemDetalleCompras.formasDePago = arr1;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }

// Para las notas de debito y credito cxp
//*************************************

                cp_nota_DebCre_Bus         nota_B      = new cp_nota_DebCre_Bus();
                List <cp_nota_DebCre_Info> listaNotaDC = new List <cp_nota_DebCre_Info>();
                listaNotaDC = nota_B.Get_List_nota_DebCre(param.IdEmpresa, Convert.ToInt32(cmb_anio.Text), Convert.ToInt32(cmb_periodo.SelectedValue));



                progressBar1.Value = 70;
                foreach (cp_nota_DebCre_Info item in listaNotaDC)
                {
                    Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras itemDetalleCompras = new Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleCompras();



                    List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir> LstdetalleAir = new List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAir>();

                    cp_proveedor_Autorizacion_Info Autorizacion_I = new cp_proveedor_Autorizacion_Info();

                    var sustento = ListCodigoSustento.First(c => c.IdCodigo_SRI == item.IdIden_credito);
                    itemDetalleCompras.codSustento = sustento.codigoSRI;

                    itemDetalleCompras.establecimiento = item.cn_serie1;
                    itemDetalleCompras.puntoEmision    = item.cn_serie2;
                    itemDetalleCompras.secuencial      = item.cn_Nota;
                    itemDetalleCompras.autorizacion    = item.cn_Autorizacion;



                    //if ("000002133" == item.cn_Nota) { MessageBox.Show(""); }

                    if (item.Fecha_contable != null)
                    {
                        itemDetalleCompras.fechaRegistro = Convert.ToDateTime(item.Fecha_contable).ToString("dd/MM/yyyy");
                        itemDetalleCompras.fechaEmision  = Convert.ToDateTime(item.Fecha_contable).ToString("dd/MM/yyyy");
                    }

                    if (String.IsNullOrEmpty(itemDetalleCompras.fechaRegistro))
                    {
                        itemDetalleCompras.fechaRegistro = Convert.ToDateTime(item.cn_fecha).ToString("dd/MM/yyyy");
                        itemDetalleCompras.fechaEmision  = Convert.ToDateTime(item.cn_fecha).ToString("dd/MM/yyyy");
                    }



                    itemDetalleCompras.idProv   = item.InfoProveedor.Persona_Info.pe_cedulaRuc.Trim();
                    itemDetalleCompras.tpIdProv = (item.InfoProveedor.Persona_Info.IdTipoDocumento.Trim() == "RUC") ? "01" : ((item.InfoProveedor.Persona_Info.IdTipoDocumento.Trim() == "CED") ? "02" : "03");

                    if (itemDetalleCompras.tpIdProv == "03")
                    {
                        itemDetalleCompras.tipoProv = (item.InfoProveedor.Persona_Info.pe_Naturaleza == "NATUR") ? "01" : "02";
                        if (item.InfoProveedor.es_empresa_relacionada == true)
                        {
                            itemDetalleCompras.parteRel = parteRelType.SI;
                        }
                        else
                        {
                            itemDetalleCompras.parteRel = parteRelType.NO;
                        }
                    }



                    itemDetalleCompras.tipoComprobante = (item.DebCre == "C" || item.DebCre == "Credito") ? "04" : "05";
                    if (item.Fecha_contable != null)
                    {
                        itemDetalleCompras.fechaEmision = Convert.ToString(item.Fecha_contable);
                    }

                    itemDetalleCompras.baseNoGraIva  = "0";
                    itemDetalleCompras.baseImponible = Math.Round(Convert.ToDecimal(item.cn_subtotal_siniva), 2, MidpointRounding.AwayFromZero).ToString();    //sin iva
                    itemDetalleCompras.baseImpGrav   = Math.Round(Convert.ToDecimal(item.cn_subtotal_iva), 2, MidpointRounding.AwayFromZero).ToString();
                    itemDetalleCompras.baseImpExe    = "0";


                    itemDetalleCompras.montoIce = Math.Round(Convert.ToDecimal(item.cn_Ice_valor), 2, MidpointRounding.AwayFromZero).ToString();
                    itemDetalleCompras.montoIva = Math.Round(Convert.ToDecimal(item.cn_valoriva), 2, MidpointRounding.AwayFromZero).ToString();


                    itemDetalleCompras.valRetBien10      = "0.00";
                    itemDetalleCompras.valRetServ20      = "0.00";
                    itemDetalleCompras.valorRetBienes    = "0.00";
                    itemDetalleCompras.valRetServ50      = "0.00";
                    itemDetalleCompras.valorRetServicios = "0.00";
                    itemDetalleCompras.valRetServ100     = "0.00";
                    itemDetalleCompras.totbasesImpReemb  = "0.00";

                    itemDetalleCompras.valRetBien10Specified     = true;
                    itemDetalleCompras.valRetServ20Specified     = true;
                    itemDetalleCompras.valRetServ50Specified     = true;
                    itemDetalleCompras.totbasesImpReembSpecified = true;


                    if (LstdetalleAir.Count > 0)
                    {
                        itemDetalleCompras.air = LstdetalleAir;
                    }


                    itemDetalleCompras.docModificado    = item.docModificado;
                    itemDetalleCompras.estabModificado  = item.estabModificado;
                    itemDetalleCompras.ptoEmiModificado = item.ptoEmiModificado;
                    itemDetalleCompras.secModificado    = item.secModificado;
                    itemDetalleCompras.autModificado    = item.autModificado;

                    lstDetalleCompras.Add(itemDetalleCompras);

                    pagoExterior Item_pagoExterior = new pagoExterior();
                    Item_pagoExterior.pagoLocExt   = (item.PagoLocExt == "LOC") ? pagoLocExtType.Item01 : pagoLocExtType.Item02;
                    Item_pagoExterior.paisEfecPago = (Item_pagoExterior.pagoLocExt == pagoLocExtType.Item01) ? "NA"  : (item.PaisPago != null || item.PaisPago != "") ? item.PaisPago : "NA";

                    Item_pagoExterior.aplicConvDobTrib   = (item.ConvenioTributacion == "S") ? aplicConvDobTribType.SI : (item.ConvenioTributacion == "N") ? aplicConvDobTribType.NO :aplicConvDobTribType.NA;
                    Item_pagoExterior.pagExtSujRetNorLeg = (item.PagoSujetoRetencion == "S") ? aplicConvDobTribType.SI : (item.PagoSujetoRetencion == "N") ? aplicConvDobTribType.NO : aplicConvDobTribType.NA;

                    itemDetalleCompras.pagoExterior = Item_pagoExterior;
                }

                iva.compras        = lstDetalleCompras;
                progressBar1.Value = 85;

//*****ANULADOS*******
//********************

                tb_sis_Documento_Tipo_x_Empresa_Anulados_Bus         DocAnu_B  = new tb_sis_Documento_Tipo_x_Empresa_Anulados_Bus();
                List <tb_sis_Documento_Tipo_x_Empresa_Anulados_Info> LstDocAnu = new List <tb_sis_Documento_Tipo_x_Empresa_Anulados_Info>();

                LstDocAnu = DocAnu_B.ConsultaPorMesAnio(param.IdEmpresa, Convert.ToInt32(cmb_anio.Text), Convert.ToInt32(cmb_periodo.SelectedValue));

                List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAnulados> lstDetalleDocAnu = new List <Core.Erp.Info.CuentasxPagar.xmlATS_V_1_1_4.detalleAnulados>();
                foreach (var itemDA in LstDocAnu)
                {
                    if (itemDA.Autorizacion != null)
                    {
                        detalleAnulados info = new detalleAnulados();
                        info.autorizacion     = itemDA.Autorizacion;
                        info.establecimiento  = itemDA.Serie1;
                        info.puntoEmision     = itemDA.Serie2;
                        info.secuencialInicio = itemDA.Documento;
                        info.secuencialFin    = itemDA.DocumentoFin;
                        var tipD = LstTipDoc.First(c => c.CodTipoDocumento == itemDA.codDocumentoTipo);
                        info.tipoComprobante = tipD.CodSRI;
                        lstDetalleDocAnu.Add(info);
                    }
                }

                if (lstDetalleDocAnu.Count > 0)
                {
                    iva.anulados = lstDetalleDocAnu;
                }

                //// FACTURAS

                fa_factura_Bus fac_B = new fa_factura_Bus();

                List <detalleVentas> LstDV = new List <detalleVentas>();
                LstDV = fac_B.Get_List_VentasParaATS(param.IdEmpresa, Convert.ToInt32(cmb_anio.Text), Convert.ToInt32(cmb_periodo.SelectedValue));

                int IdPeriodo = (Convert.ToInt32(iva.Anio) * 100) + Convert.ToInt32(iva.Mes);

                foreach (var item in LstDV)
                {
                    item.montoIce          = 0;
                    item.montoIceSpecified = true;

                    #region Personalizacion de cliente Grafinpren

                    /// el cliente nos pide q enceremos el valor de la retencion de estos meses junio y julio 2016
                    if (param.IdCliente_Ven_x_Default == Cl_Enumeradores.eCliente_Vzen.GRAFINPRENT)
                    {
                        if (IdPeriodo >= 201606 && IdPeriodo <= 201611)
                        {
                            item.valorRetIva   = "0.00";
                            item.valorRetRenta = "0.00";
                        }
                    }
                    #endregion
                }



                if (LstDV.Count() > 0)
                {
                    iva.ventas = LstDV;
                }

                List <ventaEst> LstVenSum = new List <ventaEst>();
                LstVenSum = fac_B.Get_List_VentasXEstablecimientoParaATS(param.IdEmpresa, Convert.ToInt32(cmb_anio.Text), Convert.ToInt32(cmb_periodo.SelectedValue));

                foreach (var item in LstVenSum)
                {
                }
                if (LstVenSum.Count > 0)
                {
                    iva.ventasEstablecimiento = LstVenSum;
                    iva.totalVentas           = Math.Round(Math.Abs(LstVenSum.Sum(c => c.ventasEstab)), 2, MidpointRounding.AwayFromZero);
                }
                else
                {
                    iva.totalVentas = 0;
                }


                iva.totalVentasSpecified = true;

                return(iva);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString());
                return(iva);
            }
        }
예제 #20
0
        private void guardar()
        {
            try
            {
                string         msg         = "";
                Boolean        Res         = true;
                fa_Cliente_Bus bus_cliente = new fa_Cliente_Bus();
                tb_persona_bus bus_persona = new tb_persona_bus();



                get_Cliente();
                switch (_Accion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:

                    if (ValidarCajasTexto() == true)
                    {
                        return;
                    }

                    if (IdCliente_Registrado == true)
                    {
                        Res = bus_cliente.ModificarDB(info, ref msg);
                        listaCliente.Remove(info_tmp);
                        listaCliente.Add(info);
                    }
                    else
                    {
                        //Res = bus_cliente.GrabarDB(info, info_persona, ref id_persona, ref id_cliente, ref msg);
                        Res = bus_cliente.GrabarDB(info, ref id_persona, ref id_cliente, ref msg);
                    }

                    this.lbl_id_cliente.Text = id_cliente.ToString();
                    this.lbl_id_persona.Text = id_persona.ToString();

                    if (!Res)
                    {
                        MessageBox.Show("Error: " + msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Se Guardo Exitosamente el Cliente", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txt_cedula.Enabled = false;
                    }

                    break;

                case Cl_Enumeradores.eTipo_action.actualizar:
                    Res = bus_cliente.ModificarDB(info, ref msg);
                    if (!Res)
                    {
                        MessageBox.Show("Error: " + msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Se Actualizo Exitosamente el Cliente", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    break;

                case Cl_Enumeradores.eTipo_action.Anular:

                    break;

                case Cl_Enumeradores.eTipo_action.consultar:

                    break;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        private Boolean Validar_y_corregir_objeto(ref caj_Caja_Movimiento_Info Caja_Movi_Info, ref string msg)
        {
            try
            {
                #region 'Validaciones'
                /*--- validaciones */



                if (Caja_Movi_Info.IdCaja <= 0)
                {
                    msg = "Erro en la cabecera de id caja es <=0";
                    return(false);
                }



                if (Caja_Movi_Info.list_Caja_Movi_det.Count == 0)
                {
                    msg = "la factura no tiene detalle ";
                    return(false);
                }


                foreach (var item in Caja_Movi_Info.list_Caja_Movi_det)
                {
                    if (item.cr_Valor == 0)
                    {
                        msg = "el valor id:" + item.IdCobro_tipo + " tiene cantidad cero ";
                    }
                }

                /*--- Fin validaciones */


                /*--- corrigiendo data */

                Caja_Movi_Info.Estado = (string.IsNullOrEmpty(Caja_Movi_Info.Estado) == true) ? "A" : Caja_Movi_Info.Estado;

                if (Caja_Movi_Info.IdTipo_Persona == "" || Caja_Movi_Info.IdTipo_Persona == null)
                {
                    tb_persona_tipo_Bus  BusTipoPersona  = new tb_persona_tipo_Bus();
                    tb_persona_tipo_Info InfoTipoPersona = new tb_persona_tipo_Info();
                    InfoTipoPersona = BusTipoPersona.Get_List_persona_tipo().FirstOrDefault();
                    Caja_Movi_Info.IdTipo_Persona = InfoTipoPersona.IdTipo_Persona;
                }


                if (Caja_Movi_Info.IdPersona <= 0)
                {
                    tb_persona_bus  BusPersona  = new tb_persona_bus();
                    tb_persona_Info InfoPersona = new tb_persona_Info();
                    InfoPersona = BusPersona.Get_Info_Persona(1);
                    Caja_Movi_Info.IdPersona = InfoPersona.IdPersona;
                }



                /*--- corrigiendo data */

                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Validar_y_corregir_objeto", ex.Message), ex)
                      {
                          EntityType = typeof(caj_Caja_Movimiento_Bus)
                      };
            }
        }
        Boolean ValidarCedula()
        {
            try
            {
                Cl_TipoDoc_Personales_Info info_doc_personal = new Cl_TipoDoc_Personales_Info();

                info_doc_personal = ucGe_Docu_PersIdentificacion.get_TipoDoc_Personales();
                tb_persona_bus tbPersona = new tb_persona_bus();
                string         msj       = "";

                if (info_doc_personal.codigo == "CED")
                {
                    if (this.txtCedRuc.Text != "")
                    {
                        if (txtCedRuc.Text.TrimStart().TrimEnd().Length != 10)
                        {
                            MessageBox.Show("Cédula Incorrecta", "Operación Fallida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }

                        if (!tbPersona.Verifica_Ruc(txtCedRuc.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                            return(false);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digita la Cédula", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                else if (info_doc_personal.codigo == "RUC")
                {
                    if (txtCedRuc.Text != "")
                    {
                        if (txtCedRuc.Text.Substring(10, 3) != "001")
                        {
                            MessageBox.Show("Ruc Incorrecto", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (txtCedRuc.Text.TrimStart().TrimEnd().Length != 13)
                        {
                            MessageBox.Show("Ruc Incorrecto", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                        if (!tbPersona.Verifica_Ruc(txtCedRuc.Text, ref msj))
                        {
                            MessageBox.Show(msj);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digita Ruc", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(false);
            }
        }