예제 #1
0
        public bool GuardarDB(fa_Equipo_graf_Info Info, ref int IdEquipo, ref string mensaje)
        {
            try
            {
                IdEquipo = Get_Id(Info.IdEmpresa, ref mensaje);

                using (EntitiesFacturacion_Grafinpren Context = new EntitiesFacturacion_Grafinpren())
                {
                    fa_Equipo_graf contact = new fa_Equipo_graf();

                    contact.IdEmpresa         = Info.IdEmpresa;
                    contact.IdEquipo          = Info.IdEquipo = IdEquipo;
                    contact.nom_Equipo        = Info.nom_Equipo;
                    contact.estado            = Info.estado;
                    contact.IdUsuario         = Info.IdUsuario;
                    contact.Fecha_Transaccion = Info.Fecha_Transaccion;
                    contact.nom_pc            = Info.nom_pc;
                    contact.ip = Info.ip;

                    Context.fa_Equipo_graf.Add(contact);
                    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());
            }
        }
예제 #2
0
        public bool AnularDB(fa_Equipo_graf_Info Info, ref string mensaje)
        {
            try
            {
                using (EntitiesFacturacion_Grafinpren Context = new EntitiesFacturacion_Grafinpren())
                {
                    fa_Equipo_graf contact = Context.fa_Equipo_graf.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdEquipo == Info.IdEquipo);
                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                        contact.MotivoAnulacion = Info.MotivoAnulacion;
                        contact.estado          = false;

                        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());
            }
        }
예제 #3
0
        public Boolean ModificarDB(fa_guia_remision_graf_Info info, ref string msg)
        {
            try
            {
                using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren())
                {
                    var contact = context.fa_guia_remision_graf.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdGuiaRemision == info.IdGuiaRemision);

                    if (contact != null)
                    {
                        contact.fecha_Cotizacion = info.fecha_Cotizacion;
                        contact.Num_Cotizacion   = info.Num_Cotizacion;
                        contact.Num_OP           = info.Num_OP;
                        contact.IdEquipo         = info.IdEquipo;
                        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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #4
0
 public int Get_Id(int IdEmpresa, ref string mensaje)
 {
     try
     {
         int Id;
         EntitiesFacturacion_Grafinpren db = new EntitiesFacturacion_Grafinpren();
         var selecte = db.fa_Equipo_graf.Count(q => q.IdEmpresa == IdEmpresa);
         if (selecte == 0)
         {
             Id = 1;
         }
         else
         {
             var select_em = (from q in db.fa_Equipo_graf
                              where q.IdEmpresa == IdEmpresa
                              select q.IdEquipo).Max();
             Id = Convert.ToInt32(select_em.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());
     }
 }
예제 #5
0
        public Boolean GrabarDB(fa_factura_graf_Info info, decimal id, ref string msg)
        {
            try
            {
                using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren())
                {
                    fa_factura_graf address = new fa_factura_graf();

                    address.IdEmpresa        = info.IdEmpresa;
                    address.IdSucursal       = info.IdSucursal;
                    address.IdBodega         = info.IdBodega;
                    address.IdCbteVta        = (info.IdCbteVta == 0) ? id : info.IdCbteVta;
                    address.num_op           = info.num_op;
                    address.fecha_op         = info.fecha_op;
                    address.num_cotizacion   = info.num_cotizacion;
                    address.fecha_cotizacion = info.fecha_cotizacion;
                    address.IdEquipo         = info.IdEquipo;
                    address.porc_comision    = info.porc_comision;

                    context.fa_factura_graf.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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #6
0
        public Boolean GrabarDB(fa_notaCreDeb_graf_Info info, ref string msg)
        {
            try
            {
                Boolean res = false;


                using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren())
                {
                    var contact = context.fa_notaCreDeb_graf.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa &&
                                                                            minfo.IdSucursal == info.IdSucursal &&
                                                                            minfo.IdBodega == info.IdBodega && minfo.IdNota == info.IdNota);

                    if (contact == null)  //no hay datos en la base hay q grabar
                    {
                        fa_notaCreDeb_graf address = new fa_notaCreDeb_graf();
                        address.IdEmpresa        = info.IdEmpresa;
                        address.IdSucursal       = info.IdSucursal;
                        address.IdBodega         = info.IdBodega;
                        address.IdNota           = info.IdNota;
                        address.num_op           = info.num_op;
                        address.fecha_op         = info.fecha_op;
                        address.num_cotizacion   = info.num_cotizacion;
                        address.fecha_cotizacion = info.fecha_cotizacion;
                        address.IdEquipo         = info.IdEquipo;
                        address.porc_comision    = info.porc_comision;

                        context.fa_notaCreDeb_graf.Add(address);
                        context.SaveChanges();
                        res = true;
                    }
                    else
                    {
                        res = ModificarDB(info, ref msg);
                    }
                }
                return(res);
            }
            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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #7
0
        public List <fa_Equipo_graf_Info> Get_List_Equipo(int IdEmpresa, DateTime FechaIni, DateTime FechaFin, ref string mensaje)
        {
            try
            {
                DateTime Fecha_Ini = Convert.ToDateTime(FechaIni.ToShortDateString());
                DateTime Fecha_Fin = Convert.ToDateTime(FechaFin.ToShortDateString());
                List <fa_Equipo_graf_Info> Lista = new List <fa_Equipo_graf_Info>();

                using (EntitiesFacturacion_Grafinpren Context = new EntitiesFacturacion_Grafinpren())
                {
                    var lst = from q in Context.fa_Equipo_graf
                              where q.IdEmpresa == IdEmpresa &&
                              q.Fecha_Transaccion >= Fecha_Ini &&
                              q.Fecha_Transaccion <= Fecha_Fin
                              select q;

                    foreach (var item in lst)
                    {
                        fa_Equipo_graf_Info Info = new fa_Equipo_graf_Info();
                        Info.IdEmpresa         = item.IdEmpresa;
                        Info.IdEquipo          = item.IdEquipo;
                        Info.nom_Equipo        = item.nom_Equipo;
                        Info.estado            = item.estado;
                        Info.IdUsuario         = item.IdUsuario;
                        Info.Fecha_Transaccion = Convert.ToDateTime(item.Fecha_Transaccion);
                        Info.IdUsuarioUltModi  = item.IdUsuarioUltModi;
                        Info.Fecha_UltMod      = Convert.ToDateTime(item.Fecha_UltMod);
                        Info.IdUsuarioUltAnu   = item.IdUsuarioUltAnu;
                        Info.Fecha_UltAnu      = Convert.ToDateTime(item.Fecha_UltAnu);
                        Info.MotivoAnulacion   = item.MotivoAnulacion;
                        Info.nom_pc            = item.nom_pc;
                        Info.ip = item.ip;
                        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.ToString();
                throw new Exception(ex.ToString());
            }
        }
예제 #8
0
        public List <fa_notaCreDeb_graf_Info> Get_List_Notas(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota, ref string msg)
        {
            try
            {
                List <fa_notaCreDeb_graf_Info> lst   = new List <fa_notaCreDeb_graf_Info>();
                EntitiesFacturacion            OEnti = new EntitiesFacturacion();

                EntitiesFacturacion_Grafinpren Base = new EntitiesFacturacion_Grafinpren();
                var query = from v in Base.vwfa_NotaCre_graf
                            where v.IdEmpresa == IdEmpresa &&
                            v.IdSucursal == IdSucursal &&
                            v.IdBodega == IdBodega &&
                            v.IdNota == IdNota
                            select v;
                foreach (var item in query)
                {
                    fa_notaCreDeb_graf_Info info = new fa_notaCreDeb_graf_Info();

                    info.num_cotizacion   = item.num_cotizacion;
                    info.num_op           = item.num_op;
                    info.fecha_cotizacion = Convert.ToDateTime(item.fecha_cotizacion);
                    info.IdEquipo         = item.IdEquipo;
                    info.nom_equipo       = item.nom_Equipo;
                    info.porc_comision    = item.porc_comision;
                    info.fecha_op         = item.fecha_op;

                    //datos adicionales
                    info.sc_observacion = item.sc_observacion;
                    info.pe_direccion   = item.pe_direccion;
                    info.pe_correo      = item.pe_correo;

                    lst.Add(info);
                }
                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #9
0
        public List <fa_factura_graf_Info> Get_List_factura(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdCbteVta)
        {
            try
            {
                EntitiesFacturacion_Grafinpren OEFAC = new EntitiesFacturacion_Grafinpren();

                List <fa_factura_graf_Info> FacturaInfo = new List <fa_factura_graf_Info>();

                var CabeceraFactura = from q in OEFAC.vwfa_factura_graf
                                      where q.IdEmpresa == IdEmpresa &&
                                      q.IdSucursal == IdSucursal &&
                                      q.IdBodega == IdBodega &&
                                      q.IdCbteVta == IdCbteVta
                                      select q;

                foreach (var item in CabeceraFactura)
                {
                    fa_factura_graf_Info info = new fa_factura_graf_Info();

                    //datos internos
                    info.num_op           = item.num_op;
                    info.num_cotizacion   = item.num_cotizacion;
                    info.porc_comision    = Convert.ToDouble(item.porc_comision);
                    info.IdEquipo         = Convert.ToInt32(item.IdEquipo);
                    info.fecha_op         = Convert.ToDateTime(item.fecha_op);
                    info.fecha_cotizacion = Convert.ToDateTime(item.fecha_cotizacion);
                    info.pe_direccion     = item.pe_direccion;
                    info.Observacion      = item.vt_Observacion;

                    FacturaInfo.Add(info);
                }
                return(FacturaInfo);
            }
            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());
            }
        }
예제 #10
0
        public fa_notaCreDeb_graf_Info get_Info_graf(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota)
        {
            try
            {
                fa_notaCreDeb_graf_Info info = new fa_notaCreDeb_graf_Info();
                using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren())
                {
                    var contact = context.fa_notaCreDeb_graf.FirstOrDefault(minfo => minfo.IdEmpresa == IdEmpresa &&
                                                                            minfo.IdSucursal == IdSucursal &&
                                                                            minfo.IdBodega == IdBodega && minfo.IdNota == IdNota);

                    if (contact != null) //no hay datos en la base hay q grabar
                    {
                        info.IdEmpresa        = contact.IdEmpresa;
                        info.IdSucursal       = contact.IdSucursal;
                        info.IdBodega         = contact.IdBodega;
                        info.IdNota           = contact.IdNota;
                        info.num_op           = contact.num_op;
                        info.fecha_op         = contact.fecha_op;
                        info.num_cotizacion   = contact.num_cotizacion;
                        info.fecha_cotizacion = contact.fecha_cotizacion;
                        info.IdEquipo         = contact.IdEquipo;
                        info.porc_comision    = contact.porc_comision;
                    }
                }
                return(info);
            }
            catch (Exception ex)
            {
                string msg     = "";
                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #11
0
        public Boolean ModificarDB(fa_factura_graf_Info info, ref string msg)
        {
            try
            {
                using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren())
                {
                    var contact = context.fa_factura_graf.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdCbteVta == info.IdCbteVta);

                    if (contact != null)
                    {
                        contact.num_op           = info.num_op;
                        contact.fecha_op         = info.fecha_op;
                        contact.num_cotizacion   = info.num_cotizacion;
                        contact.fecha_cotizacion = info.fecha_cotizacion;
                        contact.IdEquipo         = info.IdEquipo;
                        contact.porc_comision    = info.porc_comision;

                        context.SaveChanges();
                    }
                    else
                    {
                        decimal id = 0;
                        GrabarDB(info, id, ref mensaje);
                    }
                }
                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #12
0
        public List <fa_factura_Info> Get_List_factura(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, int IdBodegaIni, int IdBodegaFin, DateTime FechaIni, DateTime FechaFin)
        {
            try
            {
                List <fa_factura_Info>         FacturaInfo = new List <fa_factura_Info>();
                EntitiesFacturacion_Grafinpren OEFAC       = new EntitiesFacturacion_Grafinpren();

                FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString());


                IQueryable <Facturacion_Grafinpren.vwfa_factura_graf> SelectFactura;
                if (IdSucursalIni == 0)
                {
                    SelectFactura = from q in OEFAC.vwfa_factura_graf
                                    where q.IdEmpresa == IdEmpresa && q.vt_fecha >= FechaIni && q.vt_fecha <= FechaFin
                                    select q;
                }
                else
                {
                    if (IdBodegaIni == 0)
                    {
                        SelectFactura = from q in OEFAC.vwfa_factura_graf
                                        where q.IdEmpresa == IdEmpresa &&
                                        q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                        q.vt_fecha >= FechaIni && q.vt_fecha <= FechaFin
                                        select q;
                    }
                    else
                    {
                        SelectFactura = from q in OEFAC.vwfa_factura_graf
                                        where q.IdEmpresa == IdEmpresa &&
                                        q.IdBodega >= IdBodegaIni && q.IdBodega <= IdBodegaFin &&
                                        q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                        q.vt_fecha >= FechaIni && q.vt_fecha <= FechaFin
                                        select q;
                    }
                }

                var CabeceraFactura = from cab in SelectFactura
                                      group cab by new
                {
                    cab.IdEmpresa,
                    cab.IdSucursal,
                    cab.IdBodega,
                    cab.bo_Descripcion,
                    cab.IdCbteVta,
                    cab.vt_NumFactura,
                    cab.IdCliente,
                    cab.vt_tipoDoc,
                    cab.vt_flete,
                    cab.vt_serie1,
                    cab.vt_autorizacion,
                    cab.vt_serie2,
                    cab.IdUsuario,
                    cab.pe_nombreCompleto,
                    cab.pe_razonSocial,
                    cab.IdVendedor,
                    cab.Ve_Vendedor,
                    cab.vt_tipo_venta,
                    cab.Su_Descripcion,
                    cab.vt_OtroValor1,
                    cab.vt_OtroValor2,
                    cab.CodCbteVta,
                    cab.vt_seguro,
                    cab.vt_interes,
                    cab.vt_fecha,
                    cab.vt_fech_venc,
                    cab.vt_plazo,
                    cab.vt_Observacion,
                    cab.Estado,
                    cab.IdCaja,
                    cab.IdEmpresa_nc_anu,
                    cab.IdSucursal_nc_anu,
                    cab.IdBodega_nc_anu,
                    cab.IdNota_nc_anu,

                    //datos internos
                    cab.num_op,
                    cab.num_cotizacion,
                    cab.IdEquipo,
                    cab.fecha_op,
                    cab.fecha_cotizacion,
                    cab.porc_comision,
                    cab.pe_direccion
                }
                into grouping
                    select new { grouping.Key, subototal = grouping.Sum(p => p.vt_Subtotal), iva = grouping.Sum(p => p.vt_iva), Total = grouping.Sum(p => p.vt_total) };
                foreach (var item in CabeceraFactura)
                {
                    fa_factura_Info info = new fa_factura_Info();

                    List <fa_factura_det_info> ListDet = new List <fa_factura_det_info>();

                    info.IdCbteVta       = item.Key.IdCbteVta;
                    info.IdEmpresa       = item.Key.IdEmpresa;
                    info.IdSucursal      = item.Key.IdSucursal;
                    info.IdBodega        = item.Key.IdBodega;
                    info.vt_serie1       = item.Key.vt_serie1;
                    info.vt_serie2       = item.Key.vt_serie2;
                    info.vt_tipo_venta   = item.Key.vt_tipo_venta;
                    info.Bodega          = item.Key.bo_Descripcion;
                    info.vt_NumFactura   = item.Key.vt_NumFactura;
                    info.Cliente         = item.Key.pe_razonSocial;
                    info.Vendedor        = item.Key.Ve_Vendedor;
                    info.Sucursal        = item.Key.Su_Descripcion;
                    info.vt_autorizacion = item.Key.vt_autorizacion;
                    info.IdCliente       = item.Key.IdCliente;
                    info.vt_fecha        = item.Key.vt_fecha;
                    info.IdVendedor      = item.Key.IdVendedor;
                    info.CodCbteVta      = item.Key.CodCbteVta;
                    info.vt_fech_venc    = item.Key.vt_fech_venc;
                    info.vt_plazo        = item.Key.vt_plazo;
                    info.IdUsuario       = item.Key.IdUsuario;
                    info.vt_Observacion  = item.Key.vt_Observacion;
                    info.Subtotal        = Convert.ToDouble(item.subototal);
                    info.vt_OtroValor1   = item.Key.vt_OtroValor1;
                    info.vt_OtroValor2   = item.Key.vt_OtroValor2;
                    info.vt_flete        = item.Key.vt_flete;
                    info.vt_interes      = item.Key.vt_interes;
                    info.vt_seguro       = item.Key.vt_seguro;
                    info.vt_tipoDoc      = item.Key.vt_tipoDoc;
                    info.Estado          = item.Key.Estado;
                    info.IVA             = item.iva;
                    info.Total           = item.Total;
                    info.IdCaja          = item.Key.IdCaja;

                    //datos internos
                    info.Factura_Graf.num_op           = item.Key.num_op;
                    info.Factura_Graf.num_cotizacion   = item.Key.num_cotizacion;
                    info.Factura_Graf.porc_comision    = Convert.ToDouble(item.Key.porc_comision);
                    info.Factura_Graf.IdEquipo         = Convert.ToInt32(item.Key.IdEquipo);
                    info.Factura_Graf.fecha_op         = Convert.ToDateTime(item.Key.fecha_op);
                    info.Factura_Graf.fecha_cotizacion = Convert.ToDateTime(item.Key.fecha_cotizacion);
                    info.Factura_Graf.pe_direccion     = item.Key.pe_direccion;

                    info.IdEmpresa_nc_anu  = Convert.ToInt32(item.Key.IdEmpresa_nc_anu);
                    info.IdSucursal_nc_anu = Convert.ToInt32(item.Key.IdSucursal_nc_anu);
                    info.IdBodega_nc_anu   = Convert.ToInt32(item.Key.IdBodega_nc_anu);
                    info.IdNota_nc_anu     = Convert.ToDecimal(item.Key.IdNota_nc_anu);

                    FacturaInfo.Add(info);
                }
                return(FacturaInfo);
            }
            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());
            }
        }
예제 #13
0
        public List <Core.Erp.Info.Facturacion.fa_guia_remision_Info> Get_List_guia_remision(int idEmpresa, int idSucursalIni, int idSucursalFin, int idBodegaIni, int idBodegaFin, DateTime FechaIni, DateTime FechaFin)
        {
            try
            {
                List <Core.Erp.Info.Facturacion.fa_guia_remision_Info> lst = new List <Core.Erp.Info.Facturacion.fa_guia_remision_Info>();
                if (idSucursalFin == 0)
                {
                    idSucursalIni = 0;
                    idSucursalFin = 5000;
                }

                if (idBodegaFin == 0)
                {
                    idBodegaIni = 0;
                    idBodegaFin = 5000;
                }

                EntitiesFacturacion_Grafinpren Base = new EntitiesFacturacion_Grafinpren();
                var query = from v in Base.vwfa_Guia_Remision_graf
                            where v.IdEmpresa == idEmpresa &&
                            v.IdBodega >= idBodegaIni && v.IdBodega <= idBodegaFin &&
                            v.IdSucursal >= idSucursalIni && v.IdSucursal <= idSucursalFin &&
                            v.gi_fecha >= FechaIni && v.gi_fecha <= FechaFin
                            select v;
                foreach (var item in query)
                {
                    Core.Erp.Info.Facturacion.fa_guia_remision_Info info = new Core.Erp.Info.Facturacion.fa_guia_remision_Info();
                    info.Info_Guia_Remision_x_Grafinpren.Num_Cotizacion   = Convert.ToDecimal(item.Num_Cotizacion);
                    info.Info_Guia_Remision_x_Grafinpren.Num_OP           = item.Num_OP;
                    info.Info_Guia_Remision_x_Grafinpren.fecha_Cotizacion = Convert.ToDateTime(item.fecha_Cotizacion);
                    info.Info_Guia_Remision_x_Grafinpren.IdEquipo         = item.IdEquipo;
                    info.Info_Guia_Remision_x_Grafinpren.nom_equipo       = item.nom_Equipo;
                    info.IdEmpresa          = item.IdEmpresa;
                    info.IdSucursal         = item.IdSucursal;
                    info.IdBodega           = item.IdBodega;
                    info.Ve_Vendedor        = item.Ve_Vendedor;
                    info.Cliente            = item.pe_razonSocial;
                    info.IdGuiaRemision     = item.IdGuiaRemision;
                    info.gi_fecha           = item.gi_fecha;
                    info.gi_FecIniTraslado  = item.gi_FechaIniTraslado;
                    info.gi_FecFinTraslado  = item.gi_FechaFinTraslado;
                    info.gi_fech_venc       = item.gi_fech_venc;
                    info.gi_TotalQuintales  = item.gi_TotalQuintales;
                    info.gi_TotalKilos      = item.gi_TotalKilos;
                    info.IdTransportista    = item.IdTransportista;
                    info.IdVendedor         = item.IdVendedor;
                    info.IdCliente          = item.IdCliente;
                    info.Estado             = item.Estado;
                    info.CodDocumentoTipo   = item.CodDocumentoTipo;
                    info.Serie1             = item.Serie1;
                    info.Serie2             = item.Serie2;
                    info.NumGuia_Preimpresa = item.NumGuia_Preimpresa;
                    info.ruta                  = item.ruta;
                    info.placa                 = item.placa;
                    info.Direccion_Origen      = item.Direccion_Origen;
                    info.Direccion_Destino     = item.Direccion_Destino;
                    info.em_nombre             = item.em_nombre;
                    info.RazonSocial           = item.RazonSocial;
                    info.NombreComercial       = item.NombreComercial;
                    info.ContribuyenteEspecial = item.ContribuyenteEspecial;
                    info.ObligadoAllevarConta  = item.ObligadoAllevarConta;
                    info.em_ruc                = item.em_ruc;
                    info.Cedula                = item.Cedula;
                    info.nom_Transportista     = item.nom_Transportista;
                    info.gi_Observacion        = item.gi_Observacion;

                    info.IdTipoDocumento   = item.IdTipoDocumento;
                    info.pe_cedulaRuc      = item.pe_cedulaRuc;
                    info.pe_direccion      = item.pe_direccion;
                    info.pe_telefonoCasa   = item.pe_telefonoCasa;
                    info.pe_telefonoOfic   = item.pe_telefonoOfic;
                    info.pe_celular        = item.pe_celular;
                    info.pe_correo         = item.pe_correo;
                    info.pe_Naturaleza     = item.pe_Naturaleza;
                    info.pe_nombreCompleto = item.pe_nombreCompleto;
                    info.pe_apellido       = item.pe_apellido;
                    info.pe_nombre         = item.pe_nombre;
                    info.IdTipoPersona     = item.IdTipoPersona;
                    lst.Add(info);
                }

                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
예제 #14
0
        public List <Core.Erp.Info.Facturacion.fa_notaCreDeb_Info> Get_List_Notas(int idEmpresa, int idSucursalIni, int idSucursalFin, int idBodegaIni, int idBodegaFin, DateTime FechaIni, DateTime FechaFin, string CreDeb, ref string msg)
        {
            try
            {
                List <Core.Erp.Info.Facturacion.fa_notaCreDeb_Info> lst = new List <Core.Erp.Info.Facturacion.fa_notaCreDeb_Info>();
                EntitiesFacturacion OEnti = new EntitiesFacturacion();
                if (idSucursalFin == 0)
                {
                    idSucursalIni = 0;
                    idSucursalFin = 5000;
                }

                if (idBodegaFin == 0)
                {
                    idBodegaIni = 0;
                    idBodegaFin = 5000;
                }

                EntitiesFacturacion_Grafinpren Base = new EntitiesFacturacion_Grafinpren();
                var query = from v in Base.vwfa_NotaCre_graf
                            where v.IdEmpresa == idEmpresa &&
                            v.IdBodega >= idBodegaIni &&
                            v.IdBodega <= idBodegaFin &&
                            v.IdSucursal >= idSucursalIni &&
                            v.IdSucursal <= idSucursalFin &&
                            v.CreDeb == CreDeb
                            orderby v.IdNota descending
                            select v;
                foreach (var item in query)
                {
                    Core.Erp.Info.Facturacion.fa_notaCreDeb_Info info = new Core.Erp.Info.Facturacion.fa_notaCreDeb_Info();

                    info.NotaCreDeb_Graf_Info.IdNota           = item.IdNota;
                    info.NotaCreDeb_Graf_Info.num_cotizacion   = item.num_cotizacion;
                    info.NotaCreDeb_Graf_Info.num_op           = item.num_op;
                    info.NotaCreDeb_Graf_Info.fecha_cotizacion = item.fecha_cotizacion;
                    info.NotaCreDeb_Graf_Info.IdEquipo         = item.IdEquipo;
                    info.NotaCreDeb_Graf_Info.nom_equipo       = item.nom_Equipo;
                    info.NotaCreDeb_Graf_Info.porc_comision    = item.porc_comision;
                    info.NotaCreDeb_Graf_Info.fecha_op         = item.fecha_op;
                    info.IdEmpresa  = item.IdEmpresa;
                    info.IdSucursal = item.IdSucursal;
                    info.IdBodega   = item.IdBodega;
                    info.Vendedor   = item.Vendedor;
                    info.Cliente    = item.Cliente;

                    info.CodDocumentoTipo = item.CodDocumentoTipo;
                    info.Serie1           = item.Serie1;
                    info.Serie2           = item.Serie2;
                    info.NumNota_Impresa  = item.NumNota_Impresa;


                    info.NaturalezaNota         = item.NaturalezaNota;
                    info.IdCliente              = item.IdCliente;
                    info.IdVendedor             = item.IdVendedor;
                    info.IdNota                 = item.IdNota;
                    info.IdTipoNota             = item.IdTipoNota;
                    info.IdCtaCble_TipoNota     = item.IdCtaCble_TipoNota;
                    info.CodNota                = item.CodNota;
                    info.no_fecha               = item.no_fecha;
                    info.CreDeb                 = item.CreDeb;
                    info.no_fecha_venc          = item.no_fecha_venc;
                    info.fecha_Ctble            = item.fecha_Ctble == null ? item.no_fecha : item.fecha_Ctble;
                    info.sc_observacion         = item.sc_observacion;
                    info.IdCaja                 = item.IdCaja;
                    info.Estado                 = item.Estado;
                    info.IdEmpresa_fac_doc_mod  = item.IdEmpresa_fac_doc_mod;
                    info.IdSucursal_fac_doc_mod = item.IdSucursal_fac_doc_mod;
                    info.IdBodega_fac_doc_mod   = item.IdBodega_fac_doc_mod;
                    info.IdCbteVta_fac_doc_mod  = item.IdCbteVta_fac_doc_mod;
                    info.Total = item.sc_total == null ? 0 : (double)item.sc_total;
                    lst.Add(info);
                }

                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }