Esempio n. 1
0
        public ActionResult Modificar(fa_notaCreDeb_Info model)
        {
            model.lst_cruce = List_cruce.get_list(model.IdTransaccionSession);
            var nota = bus_tipo_nota.get_info(model.IdEmpresa, model.IdTipoNota);

            if (nota != null)
            {
                if (nota.IdCtaCble == null | nota.IdCtaCble == "")
                {
                    ViewBag.mensaje = "No existe cuenta contable para el tipo de nota de credito";
                    cargar_combos(model);
                    return(View(model));
                }
            }
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                cargar_combos(model);
                return(View(model));
            }
            model.IdUsuario = SessionFixed.IdUsuario;
            if (!bus_nota.modificarDB(model))
            {
                ViewBag.mensaje = "No se ha podido modificar el registro";
                cargar_combos(model);
                return(View(model));
            }
            ;

            return(RedirectToAction("Modificar", new { IdEmpresa = model.IdEmpresa, IdSucursal = model.IdSucursal, IdBodega = model.IdBodega, IdNota = model.IdNota, Exito = true }));
        }
        public ActionResult Nuevo(fa_notaCreDeb_Info model)
        {
            var nota = bus_nota_x_empresa_sucursal.get_info(model.IdEmpresa, model.IdTipoNota, model.IdSucursal);

            if (nota != null)
            {
                if (nota.IdCtaCble == null | nota.IdCtaCble == "")
                {
                    ViewBag.mensaje = "No existe cuenta contable para el tipo de nota de credito";
                    cargar_combos(model);
                    return(View(model));
                }
            }
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                cargar_combos(model);
                return(View(model));
            }
            model.IdUsuario = SessionFixed.IdUsuario.ToString();
            if (!bus_nota.guardarDB(model))
            {
                ViewBag.mensaje = "No se ha podido guardar el registro";
                cargar_combos(model);
                return(View(model));
            }
            ;
            return(RedirectToAction("Modificar", new { IdEmpresa = model.IdEmpresa, IdSucursal = model.IdSucursal, IdBodega = model.IdBodega, IdNota = model.IdNota, Exito = true }));
        }
Esempio n. 3
0
        public decimal GetId(fa_notaCreDeb_Info Info)
        {
            try
            {
                decimal             Id;
                EntitiesFacturacion OEP = new EntitiesFacturacion();
                var select = from q in OEP.fa_notaCreDeb
                             where q.IdEmpresa == Info.IdEmpresa &&
                             q.IdSucursal == Info.IdSucursal &&
                             q.IdBodega == Info.IdBodega
                             select q;

                if (select.ToList().Count < 1)
                {
                    Id = 1;
                }
                else
                {
                    var select_pv = (from q in OEP.fa_notaCreDeb
                                     where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucursal && q.IdBodega == Info.IdBodega
                                     select q.IdNota).Max();
                    Id = Convert.ToDecimal(select_pv.ToString()) + 1;
                }
                return(Id);
            }
            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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 4
0
 void ucGe_Menu_Mantenimiento_x_usuario_event_btnAnular_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         Info = (fa_notaCreDeb_Info)this.gridViewNota.GetFocusedRow();
         if (Info == null)
         {
             MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Por_favor_seleccione_item_a_anular), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             if (Info.Estado != "I")
             {
                 llama_frm(Cl_Enumeradores.eTipo_action.Anular);
             }
             else
             {
                 MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.El_registro_se_encuentra_anulado), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
        public Boolean EliminarDB(fa_notaCreDeb_Info info)
        {
            try
            {
                List <fa_notaCreDeb_det_Info> ListaEliminar = new List <fa_notaCreDeb_det_Info>();
                ListaEliminar = Get_List_notaCreDeb_det(info);

                foreach (var item in ListaEliminar)
                {
                    using (EntitiesFacturacion context = new EntitiesFacturacion())
                    {
                        var contact = context.fa_notaCreDeb_det.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdNota == item.IdNota && obj.Secuencia == item.Secuencia);
                        if (contact != null)
                        {
                            context.fa_notaCreDeb_det.Remove(contact);
                            context.SaveChanges();
                            context.Dispose();
                        }
                    }
                }

                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 6
0
 public Boolean AnularDB(fa_notaCreDeb_Info oDeT)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_notaCreDeb.FirstOrDefault(minfo => minfo.IdEmpresa == oDeT.IdEmpresa && minfo.IdNota == oDeT.IdNota && minfo.IdSucursal == oDeT.IdSucursal && minfo.IdBodega == oDeT.IdBodega);
             if (contact != null)
             {
                 contact.MotiAnula       = oDeT.MotiAnula;
                 contact.Fecha_UltAnu    = oDeT.Fecha_UltAnu;
                 contact.IdUsuarioUltAnu = oDeT.IdUsuarioUltAnu;
                 contact.Estado          = "I";
                 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.ToString();
         throw new Exception(ex.ToString());
     }
 }
Esempio n. 7
0
        public ActionResult Importar(fa_notaCreDeb_Info model)
        {
            try
            {
                var ListaFactura = Lista_Factura.get_list(model.IdTransaccionSession);

                foreach (var item in ListaFactura)
                {
                    if (item.IdCliente != 0)
                    {
                        if (!bus_nota.guardarDB(item))
                        {
                            ViewBag.mensaje = "Error al importar el archivo";
                            return(View(model));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //SisLogError.set_list((ex.InnerException) == null ? ex.Message.ToString() : ex.InnerException.ToString());
                ViewBag.error = ex.Message.ToString();
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
        public Boolean GrabarDB(fa_notaCreDeb_Info info, ref decimal idnota, ref string mensajeDocumentoDupli, ref string mensaje)
        {
            try
            {
                Boolean res = false;



                res = BusGeneral.GuardarDB(info, ref idnota, ref mensajeDocumentoDupli, ref mensaje);
                if (res)
                {
                    info.NotaCreDeb_Graf_Info.IdNota = idnota;
                    data.GrabarDB(info.NotaCreDeb_Graf_Info, ref mensaje);
                    res = true;
                }
                return(res);
            }
            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("", "GuardarDB", ex.Message), ex)
                      {
                          EntityType = typeof(fa_notaCreDeb_graf_Bus)
                      };
            }
        }
 public ActionResult Nuevo(int IdEmpresa = 0)
 {
     #region Validar Session
     if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
     {
         return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
     }
     SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
     SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
     #endregion
     fa_notaCreDeb_Info model = new fa_notaCreDeb_Info
     {
         IdEmpresa            = IdEmpresa,
         IdSucursal           = Convert.ToInt32(SessionFixed.IdSucursal),
         no_fecha             = DateTime.Now,
         no_fecha_venc        = DateTime.Now,
         lst_det              = new List <fa_notaCreDeb_det_Info>(),
         lst_cruce            = new List <fa_notaCreDeb_x_fa_factura_NotaDeb_Info>(),
         CodDocumentoTipo     = "NTCR",
         CreDeb               = "C",
         IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
     };
     List_det.set_list(model.lst_det, model.IdTransaccionSession);
     List_cruce.set_list(model.lst_cruce, model.IdTransaccionSession);
     cargar_combos(model);
     return(View(model));
 }
        public ActionResult Modificar(fa_notaCreDeb_Info model)
        {
            var nota = bus_nota_x_empresa_sucursal.get_info(model.IdEmpresa, model.IdTipoNota, model.IdSucursal);

            if (nota != null)
            {
                if (nota.IdCtaCble == null | nota.IdCtaCble == "")
                {
                    ViewBag.mensaje = "No existe cuenta contable para el tipo de nota de credito";
                    cargar_combos(model);
                    return(View(model));
                }
            }
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                cargar_combos(model);
                return(View(model));
            }
            model.IdUsuario = Session["IdUsuario"].ToString();
            if (!bus_nota.modificarDB(model))
            {
                ViewBag.mensaje = "No se ha podido modificar el registro";
                cargar_combos(model);
                return(View(model));
            }
            ;
            return(RedirectToAction("Index"));
        }
Esempio n. 11
0
        private void cargar_combos(fa_notaCreDeb_Info model)
        {
            var lst_sucursal = bus_sucursal.GetList(model.IdEmpresa, SessionFixed.IdUsuario, false);

            ViewBag.lst_sucursal = lst_sucursal;

            var lst_punto_venta = bus_punto_venta.get_list(model.IdEmpresa, model.IdSucursal, false);

            ViewBag.lst_punto_venta = lst_punto_venta;

            var lst_contacto = bus_contacto.get_list(model.IdEmpresa, model.IdCliente);

            ViewBag.lst_contacto = lst_contacto;

            Dictionary <string, string> lst_naturaleza = new Dictionary <string, string>();

            lst_naturaleza.Add("INT", "INTERNO");
            lst_naturaleza.Add("SRI", "SRI");
            ViewBag.lst_naturaleza = lst_naturaleza;

            var lst_tipo_nota = bus_tipo_nota.get_list(model.IdEmpresa, "C", false);

            ViewBag.lst_tipo_nota = lst_tipo_nota;

            fa_Vendedor_Bus bus_vendedor = new fa_Vendedor_Bus();
            var             lst_vendedor = bus_vendedor.get_list(model.IdEmpresa, false);

            ViewBag.lst_vendedor = lst_vendedor;

            var lst_cliente_contactos = bus_cliente_contactos.get_list(model.IdEmpresa, model.IdCliente);

            ViewBag.lst_cliente_contactos = lst_cliente_contactos;
        }
Esempio n. 12
0
 public ActionResult Anular(int IdEmpresa = 0, int IdSucursal = 0, int IdBodega = 0, decimal IdNota = 0)
 {
     #region Validar Session
     if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
     {
         return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
     }
     SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
     SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
     #endregion
     fa_notaCreDeb_Info model = bus_nota.get_info(IdEmpresa, IdSucursal, IdBodega, IdNota);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
     model.lst_det = bus_det.get_list(IdEmpresa, IdSucursal, IdBodega, IdNota);
     List_det.set_list(model.lst_det, model.IdTransaccionSession);
     model.lst_cruce = bus_cruce.get_list(IdEmpresa, IdSucursal, IdBodega, IdNota);
     List_cruce.set_list(model.lst_cruce, model.IdTransaccionSession);
     cargar_combos(model);
     #region Validacion Periodo
     ViewBag.MostrarBoton = true;
     if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.no_fecha, cl_enumeradores.eModulo.FAC, model.IdSucursal, ref mensaje))
     {
         ViewBag.mensaje      = mensaje;
         ViewBag.MostrarBoton = false;
     }
     #endregion
     return(View(model));
 }
Esempio n. 13
0
 public bool anularDB(fa_notaCreDeb_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult Anular(fa_notaCreDeb_Info model)
 {
     model.IdUsuarioUltAnu = SessionFixed.IdUsuario.ToString();
     if (!bus_nota.anularDB(model))
     {
         ViewBag.mensaje = "No se ha podido anular el registro";
         cargar_combos(model);
         return(View(model));
     }
     ;
     return(RedirectToAction("Index"));
 }
        public List <fa_notaCreDeb_det_Info> Get_List_notaCreDeb_det(fa_notaCreDeb_Info Info)
        {
            try
            {
                List <fa_notaCreDeb_det_Info> lst = new List <fa_notaCreDeb_det_Info>();

                EntitiesFacturacion oEnti = new EntitiesFacturacion();
                var cons = from q in oEnti.fa_notaCreDeb_det
                           where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucursal && q.IdBodega == Info.IdBodega && q.IdNota == Info.IdNota
                           select q;

                foreach (var item  in cons)
                {
                    fa_notaCreDeb_det_Info infogrid = new fa_notaCreDeb_det_Info();
                    infogrid.IdNota                         = item.IdNota;
                    infogrid.IdEmpresa                      = item.IdEmpresa;
                    infogrid.IdProducto                     = (decimal)item.IdProducto;
                    infogrid.IdBodega                       = item.IdBodega;
                    infogrid.IdSucursal                     = item.IdSucursal;
                    infogrid.sc_cantidad                    = (float)item.sc_cantidad;
                    infogrid.sc_descUni                     = (float)item.sc_descUni;
                    infogrid.sc_observacion                 = item.sc_observacion;
                    infogrid.sc_iva                         = (float)item.sc_iva;
                    infogrid.sc_PordescUni                  = (float)item.sc_PordescUni;
                    infogrid.sc_Precio                      = (float)item.sc_Precio;
                    infogrid.sc_precioFinal                 = (float)item.sc_precioFinal;
                    infogrid.sc_subtotal                    = (float)item.sc_subtotal;
                    infogrid.sc_total                       = (float)item.sc_total;
                    infogrid.IdPunto_cargo                  = item.IdPunto_Cargo;
                    infogrid.IdPunto_cargo_grupo            = item.IdPunto_cargo_grupo;
                    infogrid.Secuencia                      = item.Secuencia;
                    infogrid.IdCod_Impuesto_Iva             = item.IdCod_Impuesto_Iva;
                    infogrid.IdCod_Impuesto_Ice             = item.IdCod_Impuesto_Ice;
                    infogrid.IdCentroCosto                  = item.IdCentroCosto;
                    infogrid.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                    lst.Add(infogrid);
                }

                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 16
0
        public fa_notaCreDeb_Info get_info(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota)
        {
            try
            {
                fa_notaCreDeb_Info info;

                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    var Entity = Context.fa_notaCreDeb.Where(q => q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal && q.IdBodega == IdBodega && q.IdNota == IdNota).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }
                    info = new fa_notaCreDeb_Info
                    {
                        IdEmpresa          = Entity.IdEmpresa,
                        IdSucursal         = Entity.IdSucursal,
                        IdBodega           = Entity.IdBodega,
                        IdNota             = Entity.IdNota,
                        IdPuntoVta         = Entity.IdPuntoVta,
                        dev_IdEmpresa      = Entity.dev_IdEmpresa,
                        dev_IdDev_Inven    = Entity.dev_IdDev_Inven,
                        CodNota            = Entity.CodNota,
                        CreDeb             = Entity.CreDeb.Trim(),
                        CodDocumentoTipo   = Entity.CodDocumentoTipo,
                        Serie1             = Entity.Serie1,
                        Serie2             = Entity.Serie2,
                        NumNota_Impresa    = Entity.NumNota_Impresa,
                        NumAutorizacion    = Entity.NumAutorizacion,
                        Fecha_Autorizacion = Entity.Fecha_Autorizacion,
                        IdCliente          = Entity.IdCliente,
                        IdContacto         = Entity.IdContacto,
                        no_fecha           = Entity.no_fecha,
                        no_fecha_venc      = Entity.no_fecha_venc,
                        IdTipoNota         = Entity.IdTipoNota,
                        sc_observacion     = Entity.sc_observacion,
                        Estado             = Entity.Estado,
                        NaturalezaNota     = Entity.NaturalezaNota,
                        IdCtaCble_TipoNota = Entity.IdCtaCble_TipoNota
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 17
0
 public bool modificarDB(fa_notaCreDeb_Info info)
 {
     try
     {
         return(odata.modificarDB(info));
     }
     catch (Exception ex)
     {
         tb_LogError_Bus LogData = new tb_LogError_Bus();
         LogData.GuardarDB(new tb_LogError_Info {
             Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "fa_notaCreDeb_Bus", Metodo = "modificarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }
Esempio n. 18
0
 public Boolean AnularDB(fa_notaCreDeb_Info oNota, ref string mensajeError)
 {
     try
     {
         return(BusGeneral.AnularDB(oNota, ref mensajeError));
     }
     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("", "AnularNota", ex.Message), ex)
               {
                   EntityType = typeof(fa_notaCreDeb_graf_Bus)
               };
     }
 }
Esempio n. 19
0
 public List <fa_notaCreDeb_det_Info> Get_List_notaCreDeb_det(fa_notaCreDeb_Info info)
 {
     try
     {
         return(BusGeneral_det.Get_List_notaCreDeb_det(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("", "Get_List_notaCreDeb_det", ex.Message), ex)
               {
                   EntityType = typeof(fa_notaCreDeb_graf_Bus)
               };
     }
 }
Esempio n. 20
0
 public List <fa_notaCreDeb_det_Info> Get_List_notaCreDeb_det(fa_notaCreDeb_Info Info)
 {
     try
     {
         return(odata.Get_List_notaCreDeb_det(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("", "ObtenerLista", ex.Message), ex)
               {
                   EntityType = typeof(fa_notaCreDeb_det_bus)
               };
     }
 }
Esempio n. 21
0
        private cxc_cobro_Info armar_cobro(fa_notaCreDeb_Info info)
        {
            try
            {
                cxc_cobro_Info cobro = new cxc_cobro_Info
                {
                    IdEmpresa         = info.IdEmpresa,
                    IdSucursal        = info.IdSucursal,
                    IdCobro           = 0,
                    IdCobro_tipo      = info.CreDeb.Trim() == "C" ? "NTCR" : "NTDB",
                    cr_fecha          = info.no_fecha,
                    cr_fechaCobro     = info.no_fecha,
                    cr_fechaDocu      = info.no_fecha,
                    cr_NumDocumento   = info.CodDocumentoTipo + (info.NaturalezaNota == "SRI" ? ("-" + info.Serie1 + "-" + info.Serie2 + "-" + info.NumNota_Impresa) : info.IdNota.ToString("000000000")),
                    cr_observacion    = info.CodDocumentoTipo + (info.NaturalezaNota == "SRI" ? ("-" + info.Serie1 + "-" + info.Serie2 + "-" + info.NumNota_Impresa) : info.IdNota.ToString("000000000")),
                    cr_TotalCobro     = Math.Round(info.lst_cruce.Sum(q => q.Valor_Aplicado), 2, MidpointRounding.AwayFromZero),
                    IdCaja            = 1,
                    IdCliente         = info.IdCliente,
                    IdUsuario         = info.IdUsuario,
                    IdTipoNotaCredito = info.IdTipoNota,
                    lst_det           = new List <cxc_cobro_det_Info>()
                };

                int Secuencia = 1;
                foreach (var item in info.lst_cruce)
                {
                    cobro.lst_det.Add(new cxc_cobro_det_Info
                    {
                        IdEmpresa        = cobro.IdEmpresa,
                        IdSucursal       = cobro.IdSucursal,
                        IdCobro          = cobro.IdCobro,
                        secuencial       = Secuencia++,
                        IdCobro_tipo_det = cobro.IdCobro_tipo,
                        IdBodega_Cbte    = item.IdBodega_fac_nd_doc_mod,
                        IdCbte_vta_nota  = item.IdCbteVta_fac_nd_doc_mod,
                        dc_TipoDocumento = item.vt_tipoDoc,
                        dc_ValorPago     = item.Valor_Aplicado,
                    });
                }

                return(cobro);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 22
0
        private void GetNotaDC()
        {
            try
            {
                Info_NDC         = new fa_notaCreDeb_Info();
                Info_NDC.CodNota = "";

                Info_NDC.IdEmpresa  = param.IdEmpresa;
                Info_NDC.IdSucursal = Info_Cobro.IdSucursal;
                Info_NDC.IdBodega   = 1;
                Info_NDC.IdCliente  = Info_Cobro.IdCliente;
                Info_NDC.IdVendedor = Info_Cobro.IdVendedorCliente;

                Info_NDC.ip     = param.ip;
                Info_NDC.nom_pc = param.nom_pc;

                //NDCInfo.Serie1 = "";
                //NDCInfo.Serie2 = "";
                Info_NDC.NumNota_Impresa = "";
                //NDCInfo.NumAutorizacion = "";
                Info_NDC.NaturalezaNota = "INT";
                Info_NDC.no_dev_venta   = "";
                Info_NDC.CreDeb         = "D";
                Info_NDC.no_fecha       = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                Info_NDC.no_fecha_venc  = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                Info_NDC.no_dev_venta   = "";

                Info_NDC.IdTipoNota     = InfoParam_cxc.pa_tipoND_x_CheqProtestado;
                Info_NDC.sc_observacion = "NDEB Por Cheque Protestado # " + Info_Cobro.cr_NumDocumento.ToString() + " Del Banco " + Info_Cobro.cr_Banco.ToString() + " de la Cuenta # " + ((Info_Cobro.cr_cuenta == null) ? "" : Info_Cobro.cr_cuenta) + " ==> " + ObservacionProtesta;
                Info_NDC.sc_usuario     = param.IdUsuario;

                Info_NDC.IdUsuarioUltAnu = "";

                //NDCInfo.IdUsuario = param.IdUsuario;
                Info_NDC.Estado = "A";
                //NDCInfo.IdDevolucion = Convert.ToDecimal(txtidDev.Text);
                Info_NDC.nom_pc             = param.nom_pc;
                Info_NDC.ip                 = param.ip;
                Info_NDC.IdCaja             = Info_Cobro.IdCaja;
                Info_NDC.IdCtaCble_TipoNota = "";
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 23
0
        private ct_Cbtecble_Info Armar_diario(fa_notaCreDeb_Info info_ND)
        {
            try
            {
                ct_Cbtecble_Info info_diario = new ct_Cbtecble_Info();
                #region Cabecera
                info_diario.IdEmpresa       = param.IdEmpresa;
                info_diario.cb_Fecha        = Fecha_contabilizacion;
                info_diario.cb_Observacion  = info_ND.sc_observacion;
                info_diario.cb_Valor        = Math.Round(Convert.ToDouble(info_ND.Total), 2, MidpointRounding.AwayFromZero);
                info_diario.IdTipoCbte      = info_parametro.IdTipoCbteCble_ND;
                info_diario.IdUsuario       = "SysAdmin";
                info_diario.cb_FechaTransac = param.Fecha_Transac;
                info_diario.Estado          = "A";
                info_diario.IdPeriodo       = info_periodo.IdPeriodo;
                info_diario.Mayorizado      = "N";

                #endregion

                #region Detalle
                ct_Cbtecble_det_Info debe = new ct_Cbtecble_det_Info();
                debe.IdEmpresa      = param.IdEmpresa;
                debe.IdTipoCbte     = info_diario.IdTipoCbte;
                debe.IdCtaCble      = info_ND.info_cliente.IdCtaCble_cxc;
                debe.dc_Valor       = Math.Round(Convert.ToDouble(info_ND.Total), 2, MidpointRounding.AwayFromZero);
                debe.dc_Observacion = info_ND.sc_observacion;
                info_diario._cbteCble_det_lista_info.Add(debe);

                ct_Cbtecble_det_Info haber = new ct_Cbtecble_det_Info();
                haber.IdEmpresa      = param.IdEmpresa;
                haber.IdTipoCbte     = info_diario.IdTipoCbte;
                haber.IdCtaCble      = info_ND.info_cliente.IdCtaCble_cxc;
                haber.dc_Valor       = Math.Round(Convert.ToDouble(info_ND.Total), 2, MidpointRounding.AwayFromZero) * -1;
                haber.dc_Observacion = info_ND.sc_observacion;
                info_diario._cbteCble_det_lista_info.Add(haber);

                #endregion
                return(info_diario);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
Esempio n. 24
0
 public ActionResult Importar(int IdEmpresa = 0)
 {
     #region Validar Session
     if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
     {
         return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
     }
     SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
     SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
     #endregion
     fa_notaCreDeb_Info model = new fa_notaCreDeb_Info
     {
         IdEmpresa            = IdEmpresa,
         IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
     };
     return(View(model));
 }
Esempio n. 25
0
        private void ucGe_Menu_Mantenimiento_x_usuario_event_btnNuevoChq_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (cartera_I.vt_NunDocumento != null)
                {
                    frmCxc_CobrosRetenciones frm = new frmCxc_CobrosRetenciones();
                    if (cartera_I.vt_tipoDoc == "FACT")
                    {
                        fa_factura_Info Infofac = new fa_factura_Info();
                        fa_factura_Bus  busFac  = new fa_factura_Bus();
                        Infofac = busFac.Get_Info_factura(cartera_I.IdEmpresa, cartera_I.IdSucursal, cartera_I.IdBodega, cartera_I.IdComprobante);
                        frm.setInfo(Infofac, null, cartera_I.pe_nombreCompleto, Convert.ToInt32(Infofac.IdCaja), cartera_I.vt_tipoDoc);
                    }
                    else
                    {
                        fa_notaCreDeb_Info InfoND = new fa_notaCreDeb_Info();
                        fa_notaCredDeb_Bus busND  = new fa_notaCredDeb_Bus();
                        InfoND = busND.Get_Info_notaCreDeb_x_ND(cartera_I.IdEmpresa, cartera_I.IdSucursal, cartera_I.IdBodega, cartera_I.IdComprobante);
                        frm.setInfo(null, InfoND, cartera_I.pe_nombreCompleto, Convert.ToInt32(InfoND.IdCaja), cartera_I.vt_tipoDoc);
                    }

                    frm.Accion = Cl_Enumeradores.eTipo_action.grabar;


                    if (cartera_I.Saldo > 0)
                    {
                        frm.ShowDialog();
                        cargar();
                    }
                    else
                    {
                        MessageBox.Show("El Documento seleccionado Debe Tener Saldo a Cobrar", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Antes de continuar seleccione un Documento a Cobrar", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 26
0
 public Boolean ModificarDB(fa_notaCreDeb_Info info, ref string msg, ref string mensajeDocumentoDupli)
 {
     try
     {
         Boolean Res = false;
         Res = BusGeneral.ActualizarDB(info, ref msg, ref mensajeDocumentoDupli);
         if (Res)
         {
             data.ModificarDB(info.NotaCreDeb_Graf_Info, ref msg);
             Res = true;
         }
         return(Res);
     }
     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("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(fa_notaCreDeb_graf_Bus)
               };
     }
 }
 public ActionResult Anular(int IdEmpresa = 0, int IdSucursal = 0, int IdBodega = 0, decimal IdNota = 0)
 {
     #region Validar Session
     if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
     {
         return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
     }
     SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
     SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
     #endregion
     fa_notaCreDeb_Info model = bus_nota.get_info(IdEmpresa, IdSucursal, IdBodega, IdNota);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
     model.lst_det = bus_det.get_list(IdEmpresa, IdSucursal, IdBodega, IdNota);
     List_det.set_list(model.lst_det, model.IdTransaccionSession);
     model.lst_cruce = bus_cruce.get_list(IdEmpresa, IdSucursal, IdBodega, IdNota);
     List_cruce.set_list(model.lst_cruce, model.IdTransaccionSession);
     cargar_combos(model);
     return(View(model));
 }
        private void Llamar_formulario_NTDB(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota)
        {
            try
            {
                info_NotaDebito = bus_NotaDebito.Get_Info_notaCreDeb_x_ND(IdEmpresa, IdSucursal, IdBodega, IdNota);

                if (info_NotaDebito != null)
                {
                    info_NotaDebito.NotaCreDeb_Graf_Info = bus_NotaDebito_graf.get_Info_graf(IdEmpresa, IdSucursal, IdBodega, IdNota);
                    frmFa_Nota_Deb_Graf_Mant frm = new frmFa_Nota_Deb_Graf_Mant();
                    frm.setAccion(Info.General.Cl_Enumeradores.eTipo_action.actualizar);
                    frm.SetInfo(info_NotaDebito);
                    frm.MdiParent = this.MdiParent;
                    frm.Show();
                    frm.Event_frmFA_NotaCreditoDebito_FormClosing += frm_Event_frmFA_NotaCreditoDebito_FormClosing;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void cargar_combos(fa_notaCreDeb_Info model)
        {
            var lst_sucursal = bus_sucursal.get_list(model.IdEmpresa, false);

            ViewBag.lst_sucursal = lst_sucursal;

            var lst_punto_venta = bus_punto_venta.get_list(model.IdEmpresa, model.IdSucursal, false);

            ViewBag.lst_punto_venta = lst_punto_venta;

            var lst_contacto = bus_contacto.get_list(model.IdEmpresa, model.IdCliente);

            ViewBag.lst_contacto = lst_contacto;

            Dictionary <string, string> lst_naturaleza = new Dictionary <string, string>();

            lst_naturaleza.Add("INT", "Interno");
            lst_naturaleza.Add("SRI", "Autorizado por el SRI");
            ViewBag.lst_naturaleza = lst_naturaleza;

            var lst_tipo_nota = bus_tipo_nota.get_list(model.IdEmpresa, "C", false);

            ViewBag.lst_tipo_nota = lst_tipo_nota;
        }
        private bool validar(fa_notaCreDeb_Info i_validar, ref string msg)
        {
            i_validar.lst_det   = List_det.get_list(i_validar.IdTransaccionSession);
            i_validar.lst_cruce = List_cruce.get_list(i_validar.IdTransaccionSession).Where(q => q.seleccionado == true).ToList();

            if (!bus_periodo.ValidarFechaTransaccion(i_validar.IdEmpresa, i_validar.no_fecha, cl_enumeradores.eModulo.FAC, ref msg))
            {
                return(false);
            }

            if (i_validar.lst_det.Count == 0)
            {
                msg = "No ha ingresado registros en el detalle";
                return(false);
            }
            if (i_validar.lst_det.Where(q => q.sc_cantidad == 0).Count() > 0)
            {
                msg = "Existen registros con cantidad 0 en el detalle";
                return(false);
            }
            if (i_validar.lst_det.Where(q => q.IdProducto == 0).Count() > 0)
            {
                msg = "Existen registros sin producto en el detalle";
                return(false);
            }

            decimal valorAplicado = Convert.ToDecimal(i_validar.lst_cruce.Sum(q => q.Valor_Aplicado));
            decimal valorDevuelto = Convert.ToDecimal(i_validar.lst_det.Sum(q => q.sc_total));
            decimal diferencia    = valorDevuelto - valorAplicado;

            if (Convert.ToDecimal(i_validar.lst_det.Sum(q => q.sc_total)) < Convert.ToDecimal(i_validar.lst_cruce.Sum(q => q.Valor_Aplicado)) && diferencia > 1)
            {
                msg = "El valor aplicado en facturas es mayor al valor total de la nota de crédito";
                return(false);
            }

            i_validar.IdBodega        = (int)bus_punto_venta.get_info(i_validar.IdEmpresa, i_validar.IdSucursal, Convert.ToInt32(i_validar.IdPuntoVta)).IdBodega;
            i_validar.IdUsuario       = SessionFixed.IdUsuario;
            i_validar.IdUsuarioUltMod = SessionFixed.IdUsuario;
            var tipo_nota = bus_tipo_nota_x_sucursal.get_info(i_validar.IdEmpresa, i_validar.IdTipoNota, i_validar.IdSucursal);

            if (tipo_nota != null)
            {
                i_validar.IdCtaCble_TipoNota = tipo_nota.IdCtaCble;
            }

            if (i_validar.IdNota == 0 && i_validar.NaturalezaNota == "SRI")
            {
                var talonario = bus_talonario.get_info(i_validar.IdEmpresa, i_validar.CodDocumentoTipo, i_validar.Serie1, i_validar.Serie2, i_validar.NumNota_Impresa);
                if (talonario == null)
                {
                    msg = "No existe un talonario creado con la numeración: " + i_validar.Serie1 + "-" + i_validar.Serie2 + "-" + i_validar.NumNota_Impresa;
                    return(false);
                }
                if (talonario.Usado == true)
                {
                    msg = "El talonario: " + i_validar.Serie1 + "-" + i_validar.Serie2 + "-" + i_validar.NumNota_Impresa + " se encuentra utilizado.";
                    return(false);
                }
                if (bus_nota.DocumentoExiste(i_validar.IdEmpresa, i_validar.CodDocumentoTipo, i_validar.Serie1, i_validar.Serie2, i_validar.NumNota_Impresa))
                {
                    msg = "Existe una nota de crédito con el talonario: " + i_validar.Serie1 + "-" + i_validar.Serie2 + "-" + i_validar.NumNota_Impresa + " utilizado.";
                    return(false);
                }
                if (talonario.es_Documento_Electronico == false)
                {
                    i_validar.NumAutorizacion = talonario.NumAutorizacion;
                }
            }

            if (i_validar.NaturalezaNota != "SRI")
            {
                i_validar.Serie1          = null;
                i_validar.Serie2          = null;
                i_validar.NumNota_Impresa = null;
            }

            foreach (var item in i_validar.lst_det)
            {
                if (item.sc_cantidad > item.sc_cantidad_factura)
                {
                    msg = "No puede devolver una cantidad mayor a la facturado, Facturado[" + item.sc_cantidad_factura + "]:  intenta devolver [" + item.sc_cantidad + "]  produdcto [" + item.pr_descripcion + "]";
                    return(false);
                }
            }
            return(true);
        }