示例#1
0
        public com_Catalogo_Info Get_Info_EstadoAprobacion(string IdEAprob)
        {
            try
            {
                com_Catalogo_Info info  = new com_Catalogo_Info();
                EntitiesCompras   oEnti = new EntitiesCompras();
                var select = from q in oEnti.vwcom_EstadoAprobacion
                             where q.Codigo == IdEAprob
                             select q;

                foreach (var item in select)
                {
                    info.IdTipoCatalogo   = item.IdTipoCatalogo;
                    info.CodCatalogo      = item.Codigo;
                    info.IdCatalogocompra = item.Id;
                    info.descripcion      = item.descripcion;
                    info.estado           = item.Estado;
                    info.orden            = (item.Orden == null) ? 0 : (Int32)item.Orden;

                    info.name   = (item.name == null) ? "" : item.name;
                    info.Nombre = item.descripcion;
                }
                return(info);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#2
0
        public frmCom_OrdenCompra_Aprobar()
        {
            try
            {
                InitializeComponent();

                LstEA = BusEstAP.Get_ListEstadoAprobacion();
                com_Catalogo_Info todos = new com_Catalogo_Info();
                todos.CodCatalogo = "TODOS";
                todos.descripcion = "TODOS";
                LstEA.Add(todos);

                cmbEstadoApro.Properties.DataSource    = LstEA;
                cmbEstadoApro.Properties.ValueMember   = "IdCatalogocompra";
                cmbEstadoApro.Properties.DisplayMember = "descripcion";
                cmbEstadoApro.EditValue = "xAPRO";
                DateTime fecha = new DateTime();
                fecha             = DateTime.Now;
                dTPFechaFin.Value = fecha.AddDays(1);
                dTPFechaIni.Value = fecha.AddDays(-30);

                ucGe_Menu.event_btnGuardar_Click         += ucGe_Menu_event_btnGuardar_Click;
                ucGe_Menu.event_btnGuardar_y_Salir_Click += ucGe_Menu_event_btnGuardar_y_Salir_Click;
                ucGe_Menu.event_btnImprimir_Click        += ucGe_Menu_event_btnImprimir_Click;
                ucGe_Menu.event_btnSalir_Click           += ucGe_Menu_event_btnSalir_Click;
                ucGe_Menu.event_btnlimpiar_Click         += ucGe_Menu_event_btnlimpiar_Click;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 public bool ModificarDB(com_Catalogo_Info info)
 {
     try
     {
         EntitiesCompras context   = new EntitiesCompras();
         var             contenido = context.com_catalogo.FirstOrDefault(var => var.IdCatalogocompra == info.IdCatalogocompra);
         if (contenido != null)
         {
             contenido.Nombre          = info.Nombre;
             contenido.Orden           = info.orden;
             contenido.Estado          = info.estado;
             contenido.IdUsuarioUltMod = info.IdUsuarioUltMod;
             contenido.FechaUltMod     = info.FechaUltMod;
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.InnerException + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
示例#4
0
        public Boolean AnularDB(com_Catalogo_Info Info)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_catalogo.FirstOrDefault(var => var.IdCatalogocompra == Info.IdCatalogocompra && var.IdCatalogocompra_tipo == Info.IdCatalogocompra_tipo);

                    if (contact != null)
                    {
                        contact.Estado          = "I";
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.FechaHoraAnul;
                        contact.MotiAnula       = Info.MotivoAnulacion;
                        context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#5
0
        public List <com_Catalogo_Info> Get_ListEstadoAprobacion_solicitud_compra()
        {
            List <com_Catalogo_Info> Lst   = new List <com_Catalogo_Info>();
            EntitiesCompras          oEnti = new EntitiesCompras();

            try
            {
                var Query = from q in oEnti.vwcom_EstadoAprobacion_sol_compra
                            select q;
                foreach (var item in Query)
                {
                    com_Catalogo_Info Obj = new com_Catalogo_Info();
                    Obj.IdTipoCatalogo   = item.IdTipoCatalogo;
                    Obj.CodCatalogo      = item.Codigo;
                    Obj.IdCatalogocompra = item.Id;
                    Obj.descripcion      = item.descripcion;
                    Obj.estado           = item.Estado;
                    Obj.orden            = (item.Orden == null) ? 0 : (Int32)item.Orden;
                    Obj.name             = (item.name == null) ? "" : item.name;
                    Obj.Nombre           = item.descripcion;
                    Lst.Add(Obj);
                }
                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#6
0
        public Boolean GuardarDB(com_Catalogo_Info Info)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var Address = new com_catalogo();
                    Address.IdCatalogocompra = Info.IdCatalogocompra;

                    Address.IdCatalogocompra_tipo = Info.IdCatalogocompra_tipo;
                    Address.Nombre    = Info.Nombre;
                    Address.Estado    = "A";
                    Address.Orden     = Info.orden;
                    Address.IdUsuario = Info.IdUsuario;
                    Address.nom_pc    = Info.nom_pc;
                    Address.ip        = Info.ip;
                    Context.com_catalogo.Add(Address);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#7
0
 public Boolean AnularDB(com_Catalogo_Info Info)
 {
     try { return(Data.AnularDB(Info)); }
     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("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(com_Catalogo_Bus)
               };
     }
 }
示例#8
0
        private void cargar_combos()
        {
            try
            {
                ucGe_Sucursal_combo1.cargar_comboTodos();
                ucGe_Sucursal_combo1.set_SucursalInfo(0);

                ParamInfo = ParamBus.Get_Info_parametro(param.IdEmpresa);

                List <com_Catalogo_Info> listEstadoAprob = new List <com_Catalogo_Info>();
                listEstadoAprob = com_cataBus.Get_ListEstadoAprobacion_solicitud_compra();

                com_Catalogo_Info InfoEstaAprob = new com_Catalogo_Info();
                InfoEstaAprob.IdCatalogocompra_tipo = "EST_APRO_SOL";
                InfoEstaAprob.IdCatalogocompra      = "TODOS";
                InfoEstaAprob.descripcion           = "TODOS";

                listEstadoAprob.Add(InfoEstaAprob);

                // carga combo Punto de cargo en el grid
                ct_punto_cargo_Bus         bus_puntocargo = new ct_punto_cargo_Bus();
                List <ct_punto_cargo_Info> listpuntoCargo = new List <ct_punto_cargo_Info>();
                listpuntoCargo = bus_puntocargo.Get_List_PuntoCargo(param.IdEmpresa);
                cmbIdPunto_cargo_grid.DataSource = listpuntoCargo;

                cp_proveedor_Bus         bus_proveedor = new cp_proveedor_Bus();
                List <cp_proveedor_Info> listProveedor = new List <cp_proveedor_Info>();
                listProveedor = bus_proveedor.Get_List_proveedor(param.IdEmpresa);
                cmbProveedor_grid.DataSource = listProveedor;

                cmbEstadoAprobacion.Properties.DataSource = listEstadoAprob;
                cmbEstadoAprobacion.EditValue             = "TODOS";

                cmbEstadoPreAprobacion.Properties.DataSource = listEstadoAprob;
                cmbEstadoPreAprobacion.EditValue             = "PEN_SOL";

                ucGe_Sucursal_combo1.set_SucursalInfo(param.IdSucursal);

                listEstadoAprobacion = listEstadoAprob.FindAll(q => q.IdCatalogocompra != "PEN_SOL");

                cmb_Estado_Aprobacion_grid.DataSource    = listEstadoAprobacion;
                cmb_Estado_Aprobacion_grid.DisplayMember = "descripcion";
                cmb_Estado_Aprobacion_grid.ValueMember   = "IdCatalogocompra";
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#9
0
 public com_Catalogo_Info Get_EstadoAprobacion(string IdEAprob)
 {
     try
     {
         com_Catalogo_Info listCatalogo = new com_Catalogo_Info();
         listCatalogo = Data.Get_Info_EstadoAprobacion(IdEAprob);
         return(listCatalogo);
     }
     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("", "Get_EstadoAprobacion", ex.Message), ex)
               {
                   EntityType = typeof(com_Catalogo_Bus)
               };
     }
 }
        void LimpiarDatos()
        {
            try
            {
                _Info          = new com_Catalogo_Info();
                txtId.Text     = "";
                txtOrden.Value = 0;

                txtDescripcion.Text = "";
                cbxEstado.Checked   = true;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#11
0
        public List <com_Catalogo_Info> Get_List_Catalogo()
        {
            try
            {
                List <com_Catalogo_Info> lista = new List <com_Catalogo_Info>();

                EntitiesCompras oEnt = new EntitiesCompras();



                var select = from q in oEnt.com_catalogo
                             select q;

                foreach (var item in select)
                {
                    com_Catalogo_Info info = new com_Catalogo_Info();


                    info.IdCatalogocompra = item.IdCatalogocompra;
                    info.Nombre           = item.Nombre;
                    info.Abrebiatura      = item.Abrebiatura;
                    info.CodCatalogo      = item.CodCatalogo;
                    info.name             = item.NombreIngles;
                    info.orden            = item.Orden;
                    info.estado           = item.Estado;

                    lista.Add(info);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#12
0
        public List <com_Catalogo_Info> Get_list_IdTipoLista(string cod)
        {
            try
            {
                List <com_Catalogo_Info> lista = new List <com_Catalogo_Info>();

                EntitiesCompras context = new EntitiesCompras();
                var             Existe  = from q in context.com_catalogo
                                          where q.IdCatalogocompra_tipo == cod
                                          select q;

                foreach (var item in Existe)
                {
                    com_Catalogo_Info info = new com_Catalogo_Info();

                    info.IdCatalogocompra      = item.IdCatalogocompra;
                    info.IdCatalogocompra_tipo = item.IdCatalogocompra_tipo;
                    info.Nombre      = item.Nombre;
                    info.orden       = item.Orden;
                    info.Abrebiatura = item.Abrebiatura;
                    info.estado      = item.Estado;
                    lista.Add(info);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#13
0
        public Boolean Validar_objeto(com_ordencompra_local_Info Info, ref string msg)
        {
            try
            {
                if (Info.IdEmpresa == 0 || Info.IdSucursal == 0 || Info.IdProveedor == 0 || Info.IdDepartamento == 0)
                {
                    msg = "las variables estan en cero... Info.IdEmpresa == 0 || Info.IdSucursal == 0 || Info.IdProveedor == 0 || Info.IdDepartamento == 0 ";
                    return(false);
                }

                /*
                 * if (Info.IdMotivo == null || Info.IdMotivo == 0)
                 * {
                 *  msg = "Ingrese el motivo de la Compra";
                 *  com_Catalogo_Bus bUS = new com_Catalogo_Bus();
                 *  List<com_Catalogo_Info> listc = new List<com_Catalogo_Info>(bUS.Get_List_Catalogo());
                 *  return false;
                 *
                 * }*/

                if (Info.listDetalle.Count == 0)
                {
                    msg = "la OC no tiene items q grabar";
                    return(false);
                }

                int c = 0;

                foreach (var item in Info.listDetalle)
                {
                    if (item.do_Cantidad == 0)
                    {
                        msg = "Ingrese la cantidad al item : " + item.codproducto + "  ";
                        return(false);
                    }

                    if (item.do_precioCompra == 0)
                    {
                        msg = "Ingrese el costo al item : " + item.codproducto + "  ";
                        return(false);
                    }

                    if (item.IdUnidadMedida == "" || item.IdUnidadMedida == null)
                    {
                        in_producto_Bus  BusProducto  = new in_producto_Bus();
                        in_Producto_Info InfoProducto = new in_Producto_Info();
                        InfoProducto        = BusProducto.Get_info_Product(item.IdEmpresa, item.IdProducto);
                        item.IdUnidadMedida = InfoProducto.IdUnidadMedida;
                    }


                    if (item.IdCentroCosto == "")
                    {
                        item.IdCentroCosto = null;
                    }

                    if (item.IdCentroCosto_sub_centro_costo == "")
                    {
                        item.IdCentroCosto_sub_centro_costo = null;
                    }

                    if (item.IdCod_Impuesto == "" || item.IdCod_Impuesto == null) // Arreglando si no viene iva y codigo de iva
                    {
                        tb_sis_impuesto_Bus         BusImpuestoIva    = new tb_sis_impuesto_Bus();
                        List <tb_sis_impuesto_Info> ListInfo_Impuesto = new List <tb_sis_impuesto_Info>();
                        tb_sis_impuesto_Info        Info_Impuesto     = new tb_sis_impuesto_Info();
                        ListInfo_Impuesto = BusImpuestoIva.Get_List_impuesto_para_Compras("IVA");

                        Info_Impuesto       = ListInfo_Impuesto.FirstOrDefault();
                        item.IdCod_Impuesto = Info_Impuesto.IdCod_Impuesto;
                        item.Por_Iva        = Info_Impuesto.porcentaje;
                    }


                    //item.do_ManejaIva = (item.do_iva == 0) ? false : true;
                    c = c + 1;
                    item.Secuencia = c;


                    item.IdEmpresa     = Info.IdEmpresa;
                    item.IdSucursal    = Info.IdSucursal;
                    item.IdOrdenCompra = Info.IdOrdenCompra;
                }

                if (Info.IdMotivo == 0 && Info.IdMotivo == null)
                {
                    //consulta motivo compra
                    com_Motivo_Orden_Compra_Data        odataMoti = new com_Motivo_Orden_Compra_Data();
                    List <com_Motivo_Orden_Compra_Info> listMoti  = new List <com_Motivo_Orden_Compra_Info>();

                    listMoti = odataMoti.Get_List_Motivo_Orden_Compra(Info.IdEmpresa);
                    var itemMoti = listMoti.FirstOrDefault(q => q.IdMotivo == Info.IdMotivo);
                    Info.IdMotivo = itemMoti.IdMotivo;
                }


                if (Info.IdEstadoAprobacion_cat == "" || Info.IdEstadoAprobacion_cat == null)
                {
                    List <com_Catalogo_Info> listEstadoAproba = new List <com_Catalogo_Info>();
                    listEstadoAproba = CatCom.Get_ListEstadoAprobacion();
                    com_Catalogo_Info resEstadoApro = new com_Catalogo_Info();
                    resEstadoApro = listEstadoAproba.FirstOrDefault();
                    Info.IdEstadoAprobacion_cat = resEstadoApro.IdCatalogocompra;
                }

                if (Info.IdEstadoRecepcion_cat == "" || Info.IdEstadoRecepcion_cat == null)
                {
                    List <com_Catalogo_Info> listEstadoRecep = new List <com_Catalogo_Info>();
                    com_Catalogo_Info        resEstadoRece   = new com_Catalogo_Info();
                    listEstadoRecep            = CatCom.Get_ListEstadoRecepcion();
                    resEstadoRece              = listEstadoRecep.First();
                    Info.IdEstadoRecepcion_cat = resEstadoRece.IdCatalogocompra;
                }


                if (Info.IdTerminoPago == "" || Info.IdTerminoPago == null)
                {
                    List <com_TerminoPago_Info> listTerminoPago = new List <com_TerminoPago_Info>();
                    listTerminoPago = BusTerPago.Get_List_TerminoPago();
                    com_TerminoPago_Info TerminoPago = new com_TerminoPago_Info();
                    TerminoPago        = listTerminoPago.FirstOrDefault();
                    Info.IdTerminoPago = TerminoPago.IdTerminoPago;
                }


                if (Info.IdEstado_cierre == null || Info.IdEstado_cierre == "")
                {
                    com_estado_cierre_Bus busEstCierre = new com_estado_cierre_Bus();
                    com_parametro_Bus     paraBus      = new com_parametro_Bus();
                    string idestadoCierrexDefault      = "";
                    idestadoCierrexDefault = paraBus.Get_List_parametro(Info.IdEmpresa).FirstOrDefault().IdEstado_cierre;
                    Info.IdEstado_cierre   = busEstCierre.Get_List_estado_cierre().FirstOrDefault(v => v.IdEstado_cierre == idestadoCierrexDefault).IdEstado_cierre;
                }



                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_objeto", ex.Message), ex)
                      {
                          EntityType = typeof(com_ordencompra_local_Bus)
                      };
            }
        }