Ejemplo n.º 1
0
        public DataTable TraerRegistro(int n_Idregistro)
        {
            DataTable dtResul = new DataTable();

            Helper.Comunes.Funciones funfunciones = new Helper.Comunes.Funciones();
            CD_sun_tipdoccom         miFun        = new CD_sun_tipdoccom();

            miFun.mysConec = mysConec;

            miFun.TraerRegistro(n_Idregistro);
            if (miFun.booOcurrioError == true)
            {
                booOcurrioError = miFun.booOcurrioError;
                StrErrorMensaje = miFun.StrErrorMensaje;
                IntErrorNumber  = miFun.IntErrorNumber;
            }
            else
            {
                dtResul           = miFun.dtLista;
                e_DocCom.n_id     = Convert.ToInt32(dtResul.Rows[0]["n_id"]);
                e_DocCom.c_codsun = dtResul.Rows[0]["c_codsun"].ToString();
                e_DocCom.c_des    = dtResul.Rows[0]["c_des"].ToString();
                e_DocCom.c_abr    = dtResul.Rows[0]["c_abr"].ToString();
                e_DocCom.n_idtipo = Convert.ToInt32(dtResul.Rows[0]["n_idtipo"]);
                e_DocCom.n_essal  = Convert.ToInt32(funfunciones.NulosN(dtResul.Rows[0]["n_essal"]));
                e_DocCom.n_esent  = Convert.ToInt32(funfunciones.NulosN(dtResul.Rows[0]["n_esent"]));
                e_DocCom.n_seimp  = Convert.ToInt32(dtResul.Rows[0]["n_seimp"]);
                e_DocCom.n_numfil = Convert.ToInt32(dtResul.Rows[0]["n_numfil"]);
                e_DocCom.n_activo = Convert.ToInt32(dtResul.Rows[0]["n_activo"]);
                //e_DocCom.c_preser = Convert.ToInt32(dtResul.Rows[0]["c_preser"]);
                e_DocCom.n_escom = Convert.ToInt32(dtResul.Rows[0]["n_escom"]);
            }

            return(dtResul);
        }
Ejemplo n.º 2
0
        public XmlElement AgregarCarpeta(string c_Nombre, XmlElement ObjCarpetaPadre, string[,] arrAtributos, string c_Prefijo, string c_DireccionURL)
        {
            int        n_row             = 0;
            int        n_NumeroElementos = Convert.ToInt32(arrAtributos.GetLongLength(0)) - 1;
            XmlElement objElemento;

            Helper.Comunes.Funciones funFun = new Helper.Comunes.Funciones();

            String prefix        = c_Prefijo;
            String testNamespace = c_DireccionURL;

            if (funFun.NulosC(prefix) == "")
            {
                objElemento = DocXml.CreateElement(string.Empty, c_Nombre, string.Empty);
            }
            else
            {
                objElemento = DocXml.CreateElement(prefix, c_Nombre, testNamespace);
            }
            if (n_NumeroElementos != 0)
            {
                // RECORREMOS EL ARRAY DE ATRIBUTOS
                for (n_row = 0; n_row <= n_NumeroElementos - 1; n_row++)
                {
                    objElemento.SetAttribute(arrAtributos[0, n_row], arrAtributos[1, n_row]);
                }
            }
            ObjCarpetaPadre.AppendChild(objElemento);
            return(objElemento);
        }
Ejemplo n.º 3
0
        public BE_VTA_GUIAS TraerRegistro(int n_IdRegistro)
        {
            int          n_row    = 0;
            BE_VTA_GUIAS entGuias = new BE_VTA_GUIAS();
            DataTable    dtResult = new DataTable();
            DataTable    dtDatos  = new DataTable();
            CD_vta_guias miFun    = new CD_vta_guias();

            Helper.Comunes.Funciones ofun = new Helper.Comunes.Funciones();

            miFun.mysConec = mysConec;
            entGuias       = miFun.TraerRegistro(n_IdRegistro);
            LstDetalle     = miFun.LstDetalle;
            dtResult       = miFun.dtGuiasDoc;
            dtDatos        = miFun.dtGuiasDatos;

            if (miFun.IntErrorNumber == 0)
            {
                for (n_row = 0; n_row <= dtResult.Rows.Count - 1; n_row++)
                {
                    BE_VTA_GUIASDOC entguidoc = new BE_VTA_GUIASDOC();

                    entguidoc.n_idgui    = Convert.ToInt32(dtResult.Rows[n_row]["n_idgui"]);
                    entguidoc.n_idtipdoc = Convert.ToInt32(dtResult.Rows[n_row]["n_idtipdoc"]);
                    entguidoc.c_numdoc   = dtResult.Rows[n_row]["c_numdoc"].ToString();
                    entguidoc.n_iddoc    = Convert.ToInt32(dtResult.Rows[n_row]["n_iddoc"]);

                    LstGuiasDoc.Add(entguidoc);
                }

                if (dtDatos.Rows.Count != 0)
                {
                    e_GuiaDatos              = new BE_VTA_GUIASDATOS();
                    e_GuiaDatos.n_idgui      = Convert.ToInt32(ofun.NulosN(dtDatos.Rows[0]["n_idgui"]));
                    e_GuiaDatos.n_idtipdoc   = Convert.ToInt32(ofun.NulosN(dtDatos.Rows[0]["n_idtipdoc"]));
                    e_GuiaDatos._c_facnumser = ofun.NulosC(dtDatos.Rows[0]["c_facnumser"]).ToString();
                    e_GuiaDatos.c_facnumdoc  = ofun.NulosC(dtDatos.Rows[0]["c_facnumdoc"]).ToString();
                }
                else
                {
                    e_GuiaDatos = null;
                }
            }
            else
            {
                booOcurrioError = miFun.booOcurrioError;
                StrErrorMensaje = miFun.StrErrorMensaje;
                IntErrorNumber  = miFun.IntErrorNumber;
            }

            return(entGuias);
        }
Ejemplo n.º 4
0
        public bool TraerRegistro(int n_IdEmpresa)
        {
            bool           b_result = false;
            DataTable      dtResult = new DataTable();
            CD_sys_empresa miFun    = new CD_sys_empresa();

            Helper.Comunes.Funciones funFun = new Helper.Comunes.Funciones();
            miFun.mysConec       = mysConec;
            dtResult             = miFun.TraerRegistro(n_IdEmpresa);
            dtFolderDocImpresion = miFun.dtFolderDocImpresion;

            if (miFun.booOcurrioError == true)
            {
                return(b_result);
            }
            e_Empresa.n_id          = Convert.ToInt32(dtResult.Rows[0]["n_id"]);
            e_Empresa.c_nomemp      = dtResult.Rows[0]["c_nomemp"].ToString();
            e_Empresa.n_idtipdoc    = Convert.ToInt32(dtResult.Rows[0]["n_idtipdoc"]);
            e_Empresa.c_numdoc      = dtResult.Rows[0]["c_numdoc"].ToString();
            e_Empresa.c_nomcorto    = dtResult.Rows[0]["c_nomcorto"].ToString();
            e_Empresa.n_activo      = Convert.ToInt32(dtResult.Rows[0]["n_activo"]);
            e_Empresa.c_dir         = dtResult.Rows[0]["c_dir"].ToString();
            e_Empresa.c_codtempus   = dtResult.Rows[0]["c_codtempus"].ToString();
            e_Empresa.c_vtafearcdat = dtResult.Rows[0]["c_vtafearcdat"].ToString();
            e_Empresa.c_vtafearcenv = dtResult.Rows[0]["c_vtafearcenv"].ToString();
            e_Empresa.c_vtafearcrec = dtResult.Rows[0]["c_vtafearcrec"].ToString();
            e_Empresa.c_vtafealmenv = dtResult.Rows[0]["c_vtafealmenv"].ToString();
            e_Empresa.c_vtafealmrpt = dtResult.Rows[0]["c_vtafealmrpt"].ToString();
            e_Empresa.c_corctaven   = dtResult.Rows[0]["c_corctaven"].ToString();
            e_Empresa.c_corctalog   = dtResult.Rows[0]["c_corctalog"].ToString();
            e_Empresa.c_corctapro   = dtResult.Rows[0]["c_corctapro"].ToString();
            e_Empresa.c_corctager   = dtResult.Rows[0]["c_corctager"].ToString();
            e_Empresa.c_nomjefven   = dtResult.Rows[0]["c_nomjefven"].ToString();
            e_Empresa.c_nomjeflog   = dtResult.Rows[0]["c_nomjeflog"].ToString();

            e_Empresa.c_corrctapopcon = dtResult.Rows[0]["c_corrctapopcon"].ToString();
            e_Empresa.c_corrctapop    = dtResult.Rows[0]["c_corrctapop"].ToString();

            e_Empresa.n_aplife      = Convert.ToInt32(dtResult.Rows[0]["n_aplife"]);
            e_Empresa.c_folderimp   = dtResult.Rows[0]["c_folderimp"].ToString();
            e_Empresa.n_idclipro    = Convert.ToInt32(funFun.NulosN(dtResult.Rows[0]["n_idclipro"]));
            e_Empresa.n_idtipproven = Convert.ToInt32(funFun.NulosN(dtResult.Rows[0]["n_idtipproven"]));
            e_Empresa.c_verfe       = dtResult.Rows[0]["c_verfe"].ToString();
            e_Empresa.c_logo        = null;
            if (dtResult.Rows[0]["c_logo"] != DBNull.Value)
            {
                e_Empresa.c_logo = (byte[])dtResult.Rows[0]["c_logo"];
            }
            b_result = true;
            return(b_result);
        }
Ejemplo n.º 5
0
        public bool TraerRegistro(int n_IdRegistro)
        {
            int       n_row    = 0;
            bool      b_result = false;
            DataTable dtCab    = new DataTable();
            DataTable dtDet    = new DataTable();

            Helper.Genericas         funfunciones = new Helper.Genericas();
            Helper.Comunes.Funciones funfun       = new Helper.Comunes.Funciones();
            CD_vta_pedidocen         miFun        = new CD_vta_pedidocen();

            miFun.mysConec = mysConec;
            LstDetalle.Clear();
            miFun.TraerRegistro(n_IdRegistro);
            if (miFun.b_OcurrioError == true)
            {
                b_OcurrioError = miFun.b_OcurrioError;
                c_ErrorMensaje = miFun.c_ErrorMensaje;
                n_ErrorNumber  = miFun.n_ErrorNumber;
                b_result       = false;
            }
            dtCab = miFun.dtLista;
            dtDet = miFun.dtDetalle;

            entRegistro.n_idemp     = Convert.ToInt32(dtCab.Rows[0]["n_idemp"]);
            entRegistro.n_id        = Convert.ToInt32(dtCab.Rows[0]["n_id"]);
            entRegistro.c_codcli    = dtCab.Rows[0]["c_codcli"].ToString();
            entRegistro.c_codpunven = dtCab.Rows[0]["c_codpunven"].ToString();
            entRegistro.c_codpunent = dtCab.Rows[0]["c_codpunent"].ToString();
            entRegistro.d_fchemi    = Convert.ToDateTime(dtCab.Rows[0]["d_fchemi"]);
            entRegistro.d_fchent    = Convert.ToDateTime(dtCab.Rows[0]["d_fchent"]);
            entRegistro.n_numite    = Convert.ToInt32(dtCab.Rows[0]["n_numite"]);
            entRegistro.c_numped    = dtCab.Rows[0]["c_numped"].ToString();
            entRegistro.n_idguides  = Convert.ToInt32(funfun.NulosN(dtCab.Rows[0]["n_idguides"]));

            LstDetalle.Clear();
            for (n_row = 0; n_row <= dtDet.Rows.Count - 1; n_row++)
            {
                BE_VTA_PEDIDOCENDET detped = new BE_VTA_PEDIDOCENDET();

                detped.n_idped        = Convert.ToInt32(dtDet.Rows[n_row]["n_idped"]);
                detped.c_coditecen    = dtDet.Rows[n_row]["c_coditecen"].ToString();
                detped.n_canpro       = Convert.ToInt32(dtDet.Rows[n_row]["n_canpro"]);
                detped.c_codunimedcen = dtDet.Rows[n_row]["c_codunimedcen"].ToString();

                LstDetalle.Add(detped);
            }
            b_result = true;
            return(b_result);
        }
Ejemplo n.º 6
0
        void Aceptar()
        {
            int       n_row              = 0;
            DataTable dtResult           = new DataTable();
            string    strCondicionFiltro = "";
            string    c_dato             = "";
            string    c_tipdat           = "";

            Helper.Comunes.Funciones fun = new Helper.Comunes.Funciones();
            int n_NumeroElementos        = Convert.ToInt32(arrCabeceraFlex.GetLongLength(0)) - 1;

            dtResult = dtConsulta.Clone();


            for (n_row = 0; n_row <= n_NumeroElementos; n_row++)
            {
                if (arrCabeceraFlex[n_row, 4] == c_campobusqueda)
                {
                    c_tipdat = arrCabeceraFlex[n_row, 2];
                }
            }

            for (n_row = 0; n_row <= FgFiltro.Rows.Count - 1; n_row++)
            {
                if (fun.NulosC(FgFiltro.GetData(n_row, n_columnacheck)) == "True")
                {
                    c_dato = FgFiltro.GetData(n_row, n_columnabusqueda).ToString();

                    if (c_tipdat == "N")
                    {
                        strCondicionFiltro = "" + c_campobusqueda + " = " + c_dato + "";
                    }
                    if (c_tipdat == "C")
                    {
                        strCondicionFiltro = "" + c_campobusqueda + " = '" + c_dato + "'";
                    }

                    DataRow[] result = dtConsulta.Select(strCondicionFiltro);
                    foreach (DataRow row in result)
                    {
                        dtResult.ImportRow(row);
                    }
                }
            }
            dtResultado = dtResult;
            this.Hide();
        }
Ejemplo n.º 7
0
        public void TraerRegistro(int n_IdRegistro)
        {
            DataTable          dtResult = new DataTable();
            CD_est_movimientos miFun    = new CD_est_movimientos();

            miFun.mysConec = mysConec;

            miFun.TraerRegistro(n_IdRegistro);
            dtListar = miFun.dtListar;

            if (dtListar.Rows.Count != 0)
            {
                Helper.Comunes.Funciones funGen = new Helper.Comunes.Funciones();

                e_Movimiento.n_idemp      = Convert.ToInt16(dtListar.Rows[0]["n_idemp"]);
                e_Movimiento.n_idloc      = Convert.ToInt16(dtListar.Rows[0]["n_idloc"]);
                e_Movimiento.n_id         = Convert.ToInt16(dtListar.Rows[0]["n_id"]);
                e_Movimiento.n_idcaj      = Convert.ToInt16(dtListar.Rows[0]["n_idcaj"]);
                e_Movimiento.n_idcli      = Convert.ToInt16(dtListar.Rows[0]["n_idcli"]);
                e_Movimiento.d_fchdoc     = Convert.ToDateTime(dtListar.Rows[0]["d_fchdoc"]);
                e_Movimiento.c_horini     = dtListar.Rows[0]["c_horini"].ToString();
                e_Movimiento.c_horfin     = dtListar.Rows[0]["c_horfin"].ToString();
                e_Movimiento.n_tieuti     = Convert.ToInt16(dtListar.Rows[0]["n_tieuti"]);
                e_Movimiento.n_idser      = Convert.ToInt16(dtListar.Rows[0]["n_idser"]);
                e_Movimiento.n_importe    = Convert.ToDouble(dtListar.Rows[0]["n_importe"]);
                e_Movimiento.n_impser     = Convert.ToDouble(funGen.NulosN(dtListar.Rows[0]["n_impser"]));
                e_Movimiento.c_tieuit     = dtListar.Rows[0]["c_tieuit"].ToString();
                e_Movimiento.c_numpla     = dtListar.Rows[0]["c_numpla"].ToString();
                e_Movimiento.c_numdoc     = dtListar.Rows[0]["c_numdoc"].ToString();
                e_Movimiento.n_idtipdoc   = Convert.ToInt16(dtListar.Rows[0]["n_idtipdoc"]);
                e_Movimiento.n_finalizado = Convert.ToInt16(dtListar.Rows[0]["n_finalizado"]);
            }
            if (b_OcurrioError == true)
            {
                b_OcurrioError = miFun.b_OcurrioError;
                c_ErrorMensaje = miFun.c_ErrorMensaje;
                n_ErrorNumber  = miFun.n_ErrorNumber;
            }

            return;
        }
Ejemplo n.º 8
0
        void PrepararEntidad(string[] c_Cabecera, string[,] c_Detalle)
        {
            int n_row = 0;

            Helper.Comunes.Funciones funFunciones = new Helper.Comunes.Funciones();

            entRegistro.n_idemp     = STU_SISTEMA.EMPRESAID;
            entRegistro.n_id        = 0;
            entRegistro.c_codcli    = "7750174001558";
            entRegistro.c_codpunven = c_Cabecera[3];
            entRegistro.c_codpunent = c_Cabecera[7];
            entRegistro.d_fchemi    = Convert.ToDateTime(c_Cabecera[1].Substring(6, 2) + "/" + c_Cabecera[1].Substring(4, 2) + "/" + c_Cabecera[1].Substring(0, 4));
            entRegistro.d_fchent    = Convert.ToDateTime(c_Cabecera[2].Substring(6, 2) + "/" + c_Cabecera[2].Substring(4, 2) + "/" + c_Cabecera[2].Substring(0, 4));
            entRegistro.n_numite    = 0;
            entRegistro.c_numped    = c_Cabecera[0];
            entRegistro.d_fchdes    = DateTime.Now;
            entRegistro.n_anotra    = STU_SISTEMA.ANOTRABAJO;
            entRegistro.n_mestra    = STU_SISTEMA.MESTRABAJO;

            int n_numite = Convert.ToInt32(c_Detalle.GetLongLength(0));

            LstDetalle.Clear();
            for (n_row = 0; n_row <= n_numite - 1; n_row++)
            {
                BE_VTA_PEDIDOCENDET entDet = new BE_VTA_PEDIDOCENDET();

                if (funFunciones.NulosC(c_Detalle[n_row, 0]).ToString() != "")
                {
                    entDet.n_idped        = 0;
                    entDet.c_coditecen    = c_Detalle[n_row, 0];
                    entDet.n_canpro       = Convert.ToDouble(c_Detalle[n_row, 1]);
                    entDet.n_precio       = Convert.ToDouble(c_Detalle[n_row, 2]);
                    entDet.c_codunimedcen = "";
                    LstDetalle.Add(entDet);
                }
            }
        }
Ejemplo n.º 9
0
        public BE_MAE_CLIPRO TraerRegistro(int n_IdRegistro)
        {
            BE_MAE_CLIPRO Ent_CliPro = new BE_MAE_CLIPRO();
            DatosMySql    xMiFuncion = new DatosMySql();

            Helper.Comunes.Funciones fun = new Helper.Comunes.Funciones();
            DataTable DtResultado        = new DataTable();

            string[,] arrParametros = new string[1, 3] {
                { "n_id", "System.INT16", n_IdRegistro.ToString() }
            };
            DtResultado = xMiFuncion.StoreDTLLenar("mae_clipro_obtenerregistro", arrParametros, mysConec);

            if (DtResultado.Rows.Count != 0)
            {
                Ent_CliPro.n_id       = Convert.ToInt32(DtResultado.Rows[0]["n_id"].ToString());
                Ent_CliPro.n_idcatemp = Convert.ToInt32(DtResultado.Rows[0]["n_idcatemp"].ToString());
                Ent_CliPro.n_idtipcon = Convert.ToInt32(DtResultado.Rows[0]["n_idtipcon"].ToString());
                Ent_CliPro.n_idtipdoc = Convert.ToInt32(DtResultado.Rows[0]["n_idtipdoc"].ToString());
                Ent_CliPro.c_numdoc   = DtResultado.Rows[0]["c_numdoc"].ToString();
                Ent_CliPro.c_nombre   = DtResultado.Rows[0]["c_nombre"].ToString();
                Ent_CliPro.c_nomcli1  = DtResultado.Rows[0]["c_nomcli1"].ToString();
                Ent_CliPro.c_nomcli2  = DtResultado.Rows[0]["c_nomcli2"].ToString();
                Ent_CliPro.c_apecli1  = DtResultado.Rows[0]["c_apecli1"].ToString();
                Ent_CliPro.c_apecli2  = DtResultado.Rows[0]["c_apecli2"].ToString();
                Ent_CliPro.c_dir      = DtResultado.Rows[0]["c_dir"].ToString();
                Ent_CliPro.c_tel      = DtResultado.Rows[0]["c_tel"].ToString();
                Ent_CliPro.c_fax      = DtResultado.Rows[0]["c_fax"].ToString();
                Ent_CliPro.c_nomcon   = DtResultado.Rows[0]["c_nomcon"].ToString();
                Ent_CliPro.c_email    = DtResultado.Rows[0]["c_email"].ToString();
                Ent_CliPro.c_pagweb   = DtResultado.Rows[0]["c_pagweb"].ToString();

                if (DtResultado.Rows[0]["d_fchini"].ToString() != "")
                {
                    Ent_CliPro.d_fchini = Convert.ToDateTime(DtResultado.Rows[0]["d_fchini"].ToString());
                }

                Ent_CliPro.n_tipreg    = Convert.ToInt32(DtResultado.Rows[0]["n_tipreg"].ToString());
                Ent_CliPro.c_letnumdoc = DtResultado.Rows[0]["c_letnumdoc"].ToString();
                Ent_CliPro.c_letgirdir = DtResultado.Rows[0]["c_letgirdir"].ToString();
                Ent_CliPro.c_letnomgir = DtResultado.Rows[0]["c_letnomgir"].ToString();

                if (DtResultado.Rows[0]["n_idpro"].ToString() != "")
                {
                    Ent_CliPro.n_idpro = Convert.ToInt32(DtResultado.Rows[0]["n_idpro"].ToString());
                }

                Ent_CliPro.n_estado = Convert.ToInt32(DtResultado.Rows[0]["n_estado"].ToString());

                if (DtResultado.Rows[0]["n_iddep"].ToString() != "")
                {
                    Ent_CliPro.n_iddep = Convert.ToInt32(DtResultado.Rows[0]["n_iddep"].ToString());
                }


                if (DtResultado.Rows[0]["n_iddis"].ToString() != "")
                {
                    Ent_CliPro.n_iddis = Convert.ToInt32(DtResultado.Rows[0]["n_iddis"].ToString());
                }

                Ent_CliPro.n_ageret = Convert.ToInt32(fun.NulosN(DtResultado.Rows[0]["n_ageret"]));
                Ent_CliPro.c_codcen = DtResultado.Rows[0]["c_codcen"].ToString();

                if (DtResultado.Rows[0]["n_idven"].ToString() != "")
                {
                    Ent_CliPro.n_idven = Convert.ToInt32(DtResultado.Rows[0]["n_idven"].ToString());
                }

                if (DtResultado.Rows[0]["n_idcondpag"].ToString() != "")
                {
                    Ent_CliPro.n_idcondpag = Convert.ToInt32(DtResultado.Rows[0]["n_idcondpag"].ToString());
                }

                Ent_CliPro.c_lettel = DtResultado.Rows[0]["c_lettel"].ToString();
                Ent_CliPro.n_idemp  = Convert.ToInt32(DtResultado.Rows[0]["n_idemp"].ToString());
            }
            return(Ent_CliPro);
        }
Ejemplo n.º 10
0
        public BE_ALM_INVENTARIO_CONSULTA TraerRegistro(Int64 n_IdRegistro)
        {
            BE_ALM_INVENTARIO_CONSULTA EntInventario            = new BE_ALM_INVENTARIO_CONSULTA();
            List <BE_ALM_INVENTARIOUNIMED_CONSULTA> LstUnidades = new List <BE_ALM_INVENTARIOUNIMED_CONSULTA>();


            DataTable DtResultado    = new DataTable();
            DataTable DtUnidadMedida = new DataTable();

            Helper.Comunes.Funciones xFun = new Helper.Comunes.Funciones();

            string[,] arrParametros = new string[1, 3] {
                { "n_idregistro", "System.INT64", n_IdRegistro.ToString() }
            };
            DtResultado = xMiFuncion.StoreDTLLenar("alm_inventario_obtenerregistro", arrParametros, mysConec);

            string[,] arrParametrosUniMed = new string[1, 3] {
                { "n_iditem", "System.INT64", n_IdRegistro.ToString() }
            };
            DtUnidadMedida = xMiFuncion.StoreDTLLenar("alm_inventariounimed_obtener_x_item", arrParametrosUniMed, mysConec);

            if (DtUnidadMedida.Rows.Count != 0)
            {
                foreach (DataRow dr in DtUnidadMedida.Rows)
                {
                    BE_ALM_INVENTARIOUNIMED_CONSULTA Unidades = new BE_ALM_INVENTARIOUNIMED_CONSULTA();

                    Unidades.n_idite        = Convert.ToInt64(dr["n_idite"].ToString());
                    Unidades.n_id           = Convert.ToInt32(dr["n_id"].ToString());
                    Unidades.c_despre       = dr["c_despre"].ToString();
                    Unidades.c_abrpre       = dr["c_abrpre"].ToString();
                    Unidades.n_idunimedbas  = Convert.ToInt32(dr["n_idunimedbas"].ToString());
                    Unidades.n_canunimedbas = Convert.ToDouble(dr["n_canunimedbas"].ToString());
                    Unidades.n_default      = Convert.ToInt32(dr["n_default"].ToString());
                    Unidades.n_preuni       = Convert.ToDouble(dr["n_preuni"].ToString());
                    Unidades.n_preuniigv    = Convert.ToDouble(dr["n_preuniigv"].ToString());

                    //Unidades.n_idunimed = Convert.ToInt32(dr["n_idunimed"]);
                    //Unidades.c_abrsun = dr["c_abrsun"].ToString();
                    //Unidades.c_dessun = dr["c_dessun"].ToString();
                    //Unidades.c_desunimedbas = dr["c_desunimedbas"].ToString();
                    LstUnidades.Add(Unidades);
                }
            }

            if (DtResultado.Rows.Count != 0)
            {
                EntInventario.n_idemp    = Convert.ToInt32(DtResultado.Rows[0]["n_idemp"].ToString());
                EntInventario.n_id       = Convert.ToInt32(DtResultado.Rows[0]["n_id"].ToString());
                EntInventario.n_idtipexi = Convert.ToInt32(DtResultado.Rows[0]["n_idtipexi"].ToString());
                //EntInventario.n_idtippro = Convert.ToInt32(DtResultado.Rows[0]["n_idtippro"].ToString());
                EntInventario.n_idfam          = Convert.ToInt32(DtResultado.Rows[0]["n_idfam"].ToString());
                EntInventario.n_idclas         = Convert.ToInt32(DtResultado.Rows[0]["n_idclas"].ToString());
                EntInventario.n_idsubclas      = Convert.ToInt32(DtResultado.Rows[0]["n_idsubclas"].ToString());
                EntInventario.c_codpro         = DtResultado.Rows[0]["c_codpro"].ToString();
                EntInventario.c_despro         = DtResultado.Rows[0]["c_despro"].ToString();
                EntInventario.c_destec         = DtResultado.Rows[0]["c_destec"].ToString();
                EntInventario.c_descar         = DtResultado.Rows[0]["c_descar"].ToString();
                EntInventario.n_stkini         = Convert.ToDouble(DtResultado.Rows[0]["n_stkini"].ToString());
                EntInventario.n_stkact         = Convert.ToDouble(DtResultado.Rows[0]["n_stkact"].ToString());
                EntInventario.n_stkmin         = Convert.ToDouble(DtResultado.Rows[0]["n_stkmin"].ToString());
                EntInventario.n_stkmax         = Convert.ToDouble(DtResultado.Rows[0]["n_stkmax"].ToString());
                EntInventario.n_stkcon         = Convert.ToDouble(DtResultado.Rows[0]["n_stkcon"].ToString());
                EntInventario.n_preini         = Convert.ToDouble(DtResultado.Rows[0]["n_preini"].ToString());
                EntInventario.n_porgan         = Convert.ToDouble(DtResultado.Rows[0]["n_porgan"].ToString());
                EntInventario.n_preuni         = Convert.ToDouble(DtResultado.Rows[0]["n_preuni"].ToString());
                EntInventario.n_preven         = Convert.ToDouble(DtResultado.Rows[0]["n_preven"].ToString());
                EntInventario.n_idmon          = Convert.ToInt32(DtResultado.Rows[0]["n_idmon"].ToString());
                EntInventario.n_precom         = Convert.ToDouble(xFun.NulosN(DtResultado.Rows[0]["n_precom"]));
                EntInventario.n_estado         = Convert.ToInt32(DtResultado.Rows[0]["n_estado"].ToString());
                EntInventario.n_idcueconcom    = Convert.ToInt32(DtResultado.Rows[0]["n_idcueconcom"].ToString());
                EntInventario.n_idcueconven    = Convert.ToInt32(DtResultado.Rows[0]["n_idcueconven"].ToString());
                EntInventario.n_idret          = Convert.ToInt32(DtResultado.Rows[0]["n_idret"].ToString());
                EntInventario.n_iddet          = Convert.ToInt32(DtResultado.Rows[0]["n_iddet"].ToString());
                EntInventario.n_idper          = Convert.ToInt32(DtResultado.Rows[0]["n_idper"].ToString());
                EntInventario.n_idtipcom       = Convert.ToInt32(DtResultado.Rows[0]["n_idtipcom"].ToString());
                EntInventario.n_idtipven       = Convert.ToInt32(DtResultado.Rows[0]["n_idtipven"].ToString());
                EntInventario.n_idimpsel       = Convert.ToInt32(DtResultado.Rows[0]["n_idimpsel"].ToString());
                EntInventario.n_tipope         = Convert.ToInt32(xFun.NulosN(DtResultado.Rows[0]["n_tipope"].ToString()));
                EntInventario.lst_unidadmedida = LstUnidades;
                EntInventario.c_prelot         = xFun.NulosC(DtResultado.Rows[0]["c_prelot"].ToString());
                EntInventario.n_numdiavid      = Convert.ToInt32(xFun.NulosN(DtResultado.Rows[0]["n_numdiavid"]));
            }
            return(EntInventario);
        }
Ejemplo n.º 11
0
        public bool Fil_GenerarTxt(DataTable dtDatos, string c_NombreArchivo, string c_RutaDestino, int n_RestarColumnas)
        {
            bool   b_result = false;
            int    n_row    = 0;
            int    n_col    = 0;
            string c_linea  = "";
            string c_arch   = c_RutaDestino + "\\" + c_NombreArchivo;

            Helper.Comunes.Funciones funfun = new Helper.Comunes.Funciones();
            try
            {
                StreamWriter oSW = new StreamWriter(c_arch);

                for (n_row = 0; n_row <= dtDatos.Rows.Count - 1; n_row++)
                {
                    c_linea = "";
                    for (n_col = 0; n_col <= dtDatos.Columns.Count - (n_RestarColumnas + 1); n_col++)
                    {
                        if (n_col == 0)
                        {
                            if (dtDatos.Columns[n_col].DataType.Name == "DateTime")
                            {
                                if (funfun.NulosC(dtDatos.Rows[n_row][n_col]) != "")
                                {
                                    c_linea = dtDatos.Rows[n_row][n_col].ToString().Substring(0, 10);
                                }
                            }
                            else
                            {
                                c_linea = dtDatos.Rows[n_row][n_col].ToString();
                            }
                        }
                        else
                        {
                            if (dtDatos.Columns[n_col].DataType.Name == "DateTime")
                            {
                                if (funfun.NulosC(dtDatos.Rows[n_row][n_col]) != "")
                                {
                                    c_linea = c_linea + "|" + dtDatos.Rows[n_row][n_col].ToString().Substring(0, 10);
                                }
                            }
                            else
                            {
                                c_linea = c_linea + "|" + dtDatos.Rows[n_row][n_col].ToString();
                            }
                        }
                    }
                    c_linea = c_linea + "|";
                    oSW.WriteLine(c_linea);
                }
                oSW.Flush();
                oSW.Close();
                b_result = true;
                return(b_result);
            }
            catch (Exception e)
            {
                c_err_mensaje = e.Message;
                n_err_numero  = e.HResult;
                return(b_result);
            }
        }
Ejemplo n.º 12
0
        void AgregarNodo(int n_IdNivel, DataTable dtDocumento, DataTable dtAtributos, XmlElement objNodoAnterior, string c_RutaArbol)
        {
            DataTable dtResul    = new DataTable();
            DataTable dtLista    = new DataTable();
            DataTable dtNodoHijo = new DataTable();

            Helper.Comunes.Funciones Fun    = new Helper.Comunes.Funciones();
            Helper.Genericas         funGen = new Helper.Genericas();
            Helper.XML_funciones     FunXml = new Helper.XML_funciones();
            XmlElement element1;
            int        n_row          = 0;
            string     c_nomlista     = "";
            string     c_texto        = "";
            string     c_arbol        = "";
            string     c_prefi        = "";
            string     c_dirur        = "";
            string     c_valor        = "";
            int        n_tipnod       = 0;
            int        n_eslista      = 0;
            string     c_NewRutaArbol = "";

            string[,] arrAtributo = new string[1, 2] {
                { "n_iddoc", "System.INT64" }
            };

            dtResul = funGen.DataTableFiltrar(dtDocumento, "(n_numniv = " + n_IdNivel.ToString() + ") AND (c_arbol like '" + c_RutaArbol + "*')");              // FILTRAMOS NIVEL 6

            if (dtResul.Rows.Count != 0)
            {
                for (n_row = 0; n_row <= dtResul.Rows.Count - 1; n_row++)
                {
                    element1       = null;
                    c_texto        = dtResul.Rows[n_row]["c_des"].ToString();
                    c_valor        = dtResul.Rows[n_row]["c_valor"].ToString();
                    c_arbol        = dtResul.Rows[n_row]["c_arbol"].ToString();
                    c_prefi        = dtResul.Rows[n_row]["c_prefijo"].ToString();
                    c_dirur        = dtResul.Rows[n_row]["c_dirurl"].ToString();
                    n_tipnod       = Convert.ToInt32(dtResul.Rows[n_row]["n_tipo"]);
                    c_NewRutaArbol = dtResul.Rows[n_row]["c_arbol"].ToString();
                    n_eslista      = Convert.ToInt32(Fun.NulosN(dtResul.Rows[n_row]["n_lista"]));
                    arrAtributo    = LlenarArrayAtributos(Convert.ToInt32(dtResul.Rows[n_row]["n_id"]), dtAtributos);

                    FunXml.DocXml = DocXml;
                    if (n_tipnod == 1)
                    {
                        FunXml.AgregarArchivo(c_texto, c_valor, objNodoAnterior, arrAtributo, c_prefi, c_dirur);
                    }
                    else
                    {
                        FunXml.DocXml = DocXml;

                        // PREGUNTAMOS SI EL NUEVO NODO ES UNA LISTA
                        if (n_eslista == 1)
                        {
                            // SI ES UNA LISTA ESCRIBIMOS LOS DATOS DEL ALISTA
                            c_nomlista = dtResul.Rows[n_row]["c_nomlista"].ToString();
                            int n_fil    = 0;
                            int n_lisfil = 0;

                            dtLista = BucarDatosLista(c_nomlista);     // OBTENEMOS EL DATATABLE CORRECTO PARA ESCRIBIR LOS DATOS

                            string c_cond = "c_arbol like '" + c_arbol + "*' AND n_numniv > " + n_IdNivel.ToString() + " ";
                            dtNodoHijo = funGen.DataTableFiltrar(dtDocumento, c_cond);

                            for (n_lisfil = 0; n_lisfil <= dtLista.Rows.Count - 1; n_lisfil++)
                            {
                                // AGREGAMOS EL NODO PADRE
                                element1 = FunXml.AgregarCarpeta(c_texto, objNodoAnterior, arrAtributo, c_prefi, c_dirur);

                                for (n_fil = 0; n_fil <= dtNodoHijo.Rows.Count - 1; n_fil++)
                                {
                                    string c_textohijo = dtNodoHijo.Rows[n_fil]["c_des"].ToString();
                                    string c_valorhijo = dtNodoHijo.Rows[n_fil]["c_des"].ToString();    // OBTENEMOS EL NOMBRE DEL CAMPO
                                    c_valorhijo = dtLista.Rows[n_lisfil][c_valorhijo].ToString();       // TRAEMOS EL DATO DE LA LISTA
                                    FunXml.AgregarArchivo(c_textohijo, c_valorhijo, element1, arrAtributo, c_prefi, c_dirur);
                                }
                            }
                        }
                        else
                        {
                            element1 = FunXml.AgregarCarpeta(c_texto, objNodoAnterior, arrAtributo, c_prefi, c_dirur);

                            int n_NuevoNivel = n_IdNivel + 1;
                            AgregarNodo(n_NuevoNivel, dtDocumento, dtAtributos, element1, c_NewRutaArbol);
                        }
                    }
                    //int n_NuevoNivel = n_IdNivel + 1;
                    //AgregarNodo(n_NuevoNivel, dtDocumento, dtAtributos, element1, c_NewRutaArbol);
                }
            }
        }
Ejemplo n.º 13
0
        private void CmdAce_Click(object sender, EventArgs e)
        {
            if (ValidarDatos() == false)
            {
                return;
            }

            BE_COO_CARGOSCAB        entCab = new BE_COO_CARGOSCAB();
            List <BE_COO_CARGOSDET> lstDet = new List <BE_COO_CARGOSDET>();
            int n_row = 0;

            double    n_impbru   = 0;
            double    n_igv      = 0;
            double    n_impnet   = 0;
            string    c_numdoc   = "";
            int       n_idtipdoc = 0;
            DataTable dtResul    = new DataTable();

            n_idtipdoc = 82;

            CN_sun_tipdoccom objTipDoc = new CN_sun_tipdoccom();

            objTipDoc.mysConec = mysConec;
            c_numdoc           = objTipDoc.UltimoNumero(STU_SISTEMA.EMPRESAID, n_idtipdoc, "0001");

            entCab.n_idemp = STU_SISTEMA.EMPRESAID;

            if (N_TIPOOPERACION == 1)
            {
                if (N_SOCIOTIPO == 1)
                {
                    entCab.n_idcar = 44;                     // ASIGNAMOS EL CARGO DE RECIBOS
                }
                else
                {
                    entCab.n_idcar = 43;                     // ASIGNAMOS EL CARGO DE BOLETAS DE VENTA
                }
            }
            else
            {
                CN_coo_cargos xfunCar = new CN_coo_cargos();
                xfunCar.mysConec    = mysConec;
                xfunCar.STU_SISTEMA = STU_SISTEMA;

                if (N_SOCIOTIPO == 1)
                {
                    xfunCar.ObtenerMesValido(STU_SISTEMA.EMPRESAID, STU_SISTEMA.ANOTRABAJO, 81);
                }
                else
                {
                    xfunCar.ObtenerMesValido(STU_SISTEMA.EMPRESAID, STU_SISTEMA.ANOTRABAJO, 4);
                }
                dtResul        = xfunCar.dtLista;
                entCab.n_idcar = Convert.ToInt32(dtResul.Rows[0]["n_id"]);
            }

            entCab.n_idsoc    = N_SOCIOID;
            entCab.n_idsocpue = Convert.ToInt32(CboPue.SelectedValue);
            entCab.n_id       = 0;
            entCab.n_idtipdoc = n_idtipdoc;
            entCab.c_numser   = "0001";
            entCab.c_numdoc   = c_numdoc;
            entCab.d_fchemi   = DateTime.Now;
            entCab.d_fchven   = DateTime.Now;
            entCab.c_glosa    = "";
            entCab.n_anotra   = STU_SISTEMA.ANOTRABAJO;
            entCab.n_mestra   = Convert.ToInt32(CboMesTra.SelectedValue);
            entCab.n_iddocpag = 0;


            int    n_afecto  = 0;
            double n_valor   = 0;
            double n_TasaIGV = 18;

            for (n_row = 2; n_row <= FgLista.Rows.Count - 1; n_row++)
            {
                Helper.Comunes.Funciones fun = new Helper.Comunes.Funciones();

                if (fun.NulosC(FgLista.GetData(n_row, 1)) != "")
                {
                    BE_COO_CARGOSDET entDet = new BE_COO_CARGOSDET();

                    entDet.n_idemp = STU_SISTEMA.EMPRESAID;
                    entDet.n_idcar = entCab.n_idcar;
                    entDet.n_idsoc = N_SOCIOID;
                    entDet.n_idpue = Convert.ToInt32(CboPue.SelectedValue);
                    entDet.n_idcon = Convert.ToInt32(FgLista.GetData(n_row, 3).ToString());
                    entDet.n_can   = 1;

                    n_valor  = Convert.ToDouble(FgLista.GetData(n_row, 2).ToString());
                    n_afecto = Convert.ToInt32(funDatos.DataTableBuscar(dtConcepto, "n_id", "n_afeigv", entDet.n_idcon.ToString(), "N").ToString());

                    entDet.n_impbru    = n_valor;
                    entDet.n_imptotbru = (n_valor * 1);
                    if (n_afecto == 2)         // INDICA QUE EL CONCEPTO ES INAFECTO AL IGV
                    {
                        entDet.n_impnet    = n_valor;
                        entDet.n_imptotnet = (n_valor * 1);
                    }
                    else
                    {
                        entDet.n_impnet    = n_valor * ((n_TasaIGV / 100) + 1);
                        entDet.n_imptotnet = (n_valor * ((n_TasaIGV / 100) + 1) * 1);
                    }

                    //entDet.n_imptotbru = Convert.ToDouble(FgLista.GetData(n_row,2).ToString());;
                    //entDet.n_imptotnet = Convert.ToDouble(FgLista.GetData(n_row,2).ToString());;
                    entDet.n_idcor    = 0;
                    entDet.n_pagado   = 0;
                    entDet.n_iddocpag = 0;

                    n_impbru = n_impbru + entDet.n_imptotbru;
                    n_impnet = n_impnet + entDet.n_imptotnet;
                    n_igv    = n_igv + (entDet.n_imptotnet - entDet.n_imptotbru);

                    lstDet.Add(entDet);
                }
            }

            entCab.n_impbru = n_impbru;
            entCab.n_impigv = n_igv;
            entCab.n_imptot = n_impnet;
            entCab.n_impsal = n_impnet;

            CN_coo_cargoscab funCar = new CN_coo_cargoscab();

            funCar.mysConec = mysConec;
            if (funCar.InsertarCargo(entCab, lstDet) == true)
            {
                MessageBox.Show("¡ El cargo se genero con exito !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                this.Close();
            }
            else
            {
                MessageBox.Show("¡ No se pudo generar el cargo por el siguiente motivo: " + funCar.StrErrorMensaje + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 14
0
        void LeerPedidoCEN(string c_ArchivoPedido)
        {
            Helper.Comunes.Funciones funFunciones = new Helper.Comunes.Funciones();
            Cls_IO funIo = new Cls_IO();
            int    n_fil = 0;
            int    n_row = 0;

            string[] arrTmp;
            string[] arrDatos = new string[100];
            string[,] a_Detalle = new string[50, 3];
            string[] a_Cabecera = new string[8];
            arrDatos = funIo.LeerLineaArchivo(c_ArchivoPedido);
            int n_NumeroElementos = Convert.ToInt32(arrDatos.GetLongLength(0)) - 1;   // OBTENEMOS EL NUMERO DE ELEMENTOS DEL ARRAY

            string c_numped = "";
            string c_fchemi = "";
            string c_fchent = "";

            string c_punent = "";
            string c_punven = "";
            string c_codcli = "";
            string c_impigv = "";
            string c_imptot = "";
            string c_moneda = "";

            string c_codite = "";
            string c_cantid = "";
            string c_precio = "";

            // CARGAMOS LA CABECERA DEL PEDIDO
            for (n_fil = 0; n_fil <= n_NumeroElementos - 1; n_fil++)
            {
                if (n_fil == 0)
                {       // NUMERO DEL PEDIDO
                    var arrayENC = arrDatos[n_fil].Split(',');
                    if (arrayENC.Length > 0)
                    {
                        c_numped = arrayENC[5];
                    }
                    else
                    {
                        c_numped = arrDatos[n_fil].ToString().Substring(44, 21);
                    }
                }

                if (n_fil == 1)
                {
                    c_fchemi = arrDatos[n_fil].ToString().Substring(4, 8);                          // FECHA DE EMISION
                    c_fchent = arrDatos[n_fil].ToString().Substring(19, 8);                         // FECHA DE ENTREGA
                }

                //BYOC,7750892001588,,,7751324010802
                //1234567890123456789012345678901234567890
                if (n_fil == 2)
                {
                    c_punven = arrDatos[n_fil].ToString().Substring(21, 13);
                }                                                                                    // PUNTO DE VENTA
                if (n_fil == 4)
                {
                    c_punent = arrDatos[n_fil].ToString().Substring(5, 13);
                }                                                                                   // PUNTO DE ENTREGA
                if (n_fil == 6)
                {
                    c_impigv = arrDatos[n_fil].ToString().Substring(7, 6);
                }                                                                                   // IMPORTE IGV
                if (n_fil == 7)
                {
                    c_moneda = arrDatos[n_fil].ToString().Substring(4, 3);
                }                                                                                   // MONEDA
                if (n_fil == 9)                                                                     // IMPORTE TOTAL
                {
                    arrTmp   = arrDatos[n_fil].Split(',');
                    c_imptot = arrTmp[1]; // arrDatos[n_fil].ToString().Substring(4, 8);
                }

                if (n_fil == 10)
                {
                    break;
                }
            }

            a_Cabecera[0] = c_numped;
            a_Cabecera[1] = c_fchemi;
            a_Cabecera[2] = c_fchent;
            a_Cabecera[3] = c_punven;
            a_Cabecera[4] = c_impigv;
            a_Cabecera[5] = c_moneda;
            a_Cabecera[6] = c_imptot;
            a_Cabecera[7] = c_punent;

            n_row = 0;

            // CARGAMOS EL DETALLE DEL PEDIDO
            for (n_fil = 10; n_fil <= n_NumeroElementos - 1; n_fil++)
            {
                c_codite = ""; c_cantid = ""; c_precio = "";
                c_codite = arrDatos[n_fil];
                if (funFunciones.NulosC(c_codite) != "")
                {
                    if (arrDatos[n_fil].ToString().Substring(0, 3) == "LIN")
                    {
                        //BE_VTA_PEDIDOCENDET entDet = new BE_VTA_PEDIDOCENDET();

                        //c_codite = arrDatos[n_fil].ToString().Substring(6, 13);     // CODIGO DEL ITEM
                        string[] a_Dato2 = arrDatos[n_fil].Split(',');
                        c_codite = a_Dato2[2];


                        string[] a_Dato = arrDatos[n_fil + 1].Split(',');           // CANTIDAD DEL ITEM
                        c_cantid = a_Dato[1];

                        a_Dato   = arrDatos[n_fil + 3].Split(',');                  // PRECIO UNITARIO
                        c_precio = a_Dato[3];

                        a_Detalle[n_row, 0] = c_codite;
                        a_Detalle[n_row, 1] = c_cantid;
                        a_Detalle[n_row, 2] = c_precio;

                        //entDet.c_coditecen = c_codite;
                        //entDet.c_codunimedcen = "";
                        //entDet.n_canpro = Convert.ToDouble(c_cantid);
                        //entDet.n_precio = Convert.ToDouble( c_precio);
                        //a_DetalleCEN.
                        n_fil = n_fil + 4;
                        n_row = n_row + 1;
                    }
                    else
                    {
                        //n_fil = n_fil + 1;
                        //break;
                    }

                    //n_row = n_row + 1;
                }
            }

            a_CabeceraCEN = a_Cabecera;
            a_DetalleCEN  = a_Detalle;
        }
Ejemplo n.º 15
0
        private void PrintDocumentOnPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Helper.Comunes.Funciones fun = new Helper.Comunes.Funciones();
            Cls_Printer p = new Cls_Printer();

            string c_correo     = dtListar.Rows[0]["c_corctaven"].ToString();;
            string c_NomEmpresa = dtListar.Rows[0]["c_nomemp"].ToString();
            string c_NomLocal   = dtListar.Rows[0]["c_locdes"].ToString();
            string c_RUC        = dtListar.Rows[0]["c_numdoc1"].ToString();
            string c_dir1       = "D.F. : " + dtListar.Rows[0]["c_dir"].ToString();
            string c_dir2       = dtListar.Rows[0]["c_locdir"].ToString();
            string c_tipdoc     = dtListar.Rows[0]["c_desabr"].ToString();
            string c_numdoc     = "Nº " + dtListar.Rows[0]["c_numdoc"].ToString();
            string c_ruccli     = dtListar.Rows[0]["c_clinumdoc"].ToString();
            string c_nomcli     = dtListar.Rows[0]["c_clinom"].ToString();
            string c_fchemi     = Convert.ToDateTime(dtListar.Rows[0]["d_fchdoc"]).ToString("dd/MM/yyyy");
            string c_cajero     = dtListar.Rows[0]["c_cajnom"].ToString();
            string c_plasoc     = dtListar.Rows[0]["c_plasoc"].ToString();

            string c_placa    = dtListar.Rows[0]["c_numpla"].ToString();
            string c_horini   = fun.NulosC(dtListar.Rows[0]["c_horini"]).ToString();
            string c_horfin   = fun.NulosC(dtListar.Rows[0]["c_horfin"]).ToString();
            string c_tiempo   = fun.NulosC(dtListar.Rows[0]["c_tiempousu"]).ToString();
            string c_impbru   = Convert.ToDouble(dtListar.Rows[0]["n_impbru"]).ToString("0.00");
            string c_impigv   = Convert.ToDouble(dtListar.Rows[0]["n_impigv"]).ToString("0.00");
            string c_total    = Convert.ToDouble(dtListar.Rows[0]["n_imptotven"]).ToString("0.00");
            string c_totallet = dtListar.Rows[0]["c_numlet"].ToString();

            string c_dato = dtListar.Rows[0]["c_numpla"].ToString();

            c_dato = c_dato + "|" + dtListar.Rows[0]["c_desabr"].ToString();
            c_dato = c_dato + "|" + dtListar.Rows[0]["c_numdoc"].ToString();
            c_dato = c_dato + "|" + dtListar.Rows[0]["c_clinom"].ToString();
            c_dato = c_dato + "|" + Convert.ToDateTime(dtListar.Rows[0]["d_fchdoc"]).ToString("dd/MM/yyyy");
            c_dato = c_dato + "|" + Convert.ToDouble(dtListar.Rows[0]["n_imptotven"]).ToString("0.00");
            c_dato = c_dato + "|" + fun.NulosC(dtListar.Rows[0]["c_horini"]).ToString();
            c_dato = c_dato + "|" + fun.NulosC(dtListar.Rows[0]["c_horfin"]).ToString();
            c_dato = c_dato + "|" + dtListar.Rows[0]["c_locdes"].ToString();
            c_dato = c_dato + "|" + dtListar.Rows[0]["c_cajnom"].ToString();
            //c_dato = TxtNumPla2.Text + "|" + TxtCliente2.Text + "|" + DateTime.Now.ToString("dd/MM/yyyy") + "|" + TxtHorIni2.Text + "|" + TxtHorFin2.Text + "|" + CboLocal.Text + "|" + CboCajero.Text + "|" + TxtNumDoc.Text + "-" + TxtNumDoc.Text + "|" + TxtTotPag.Text + "|" + CboTipDoc.Text;

            int    n_IdRegistro = Convert.ToInt32(dtListar.Rows[0]["n_id"]);
            string c_archivo    = CodigoBarra(n_IdRegistro, c_dato).ToString();

            int   n_altocampo      = 18 - 3;
            int   n_altoseparacion = 20 - 6;
            Color o_colorlinea     = Color.Transparent;
            int   n_dat            = 66;
            int   n_tam_1          = 11 - 2;
            int   n_tam_2          = 10 - 2;
            int   n_tam_3          = 9 - 2;
            int   n_tam_4          = 8 - 2;

            p.e        = e;
            p.drawFont = new Font("Arial", n_tam_1);
            p.Print_TextoCuadro(c_NomEmpresa, 10, 30, 270, 16, 1, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_RUC, 10, 46, 270, 16, 1, Color.Black, o_colorlinea);

            p.drawFont = new Font("Arial", n_tam_3);
            p.Print_TextoCuadro(c_dir1, 10, 60, 270, 16, 1, Color.Black, o_colorlinea);
            //p.Print_TextoCuadro(c_dir1, 10, ref n_dat, 270, 16, 1, Color.Black, o_colorlinea);

            p.drawFont = new Font("Arial", n_tam_2, FontStyle.Bold);
            p.Print_TextoCuadro(c_NomLocal, 10, n_dat + 5, 270, 16, 1, Color.Black, o_colorlinea);
            p.drawFont = new Font("Arial", n_tam_3);
            p.Print_TextoCuadro(c_dir2, 10, n_dat + 20, 270, 16, 1, Color.Black, o_colorlinea);

            p.drawFont = new Font("Arial", n_tam_2, FontStyle.Bold);
            p.Print_TextoCuadro(c_tipdoc, 10, 105, 270, 16, 1, Color.Black, o_colorlinea);
            p.drawFont = new Font("Arial", n_tam_2);
            p.Print_TextoCuadro(c_numdoc, 10, 120, 270, 16, 1, Color.Black, o_colorlinea);

            p.drawFont = new Font("Arial", n_tam_3);
            int fila    = 138;
            int n_ancho = 70;

            p.Print_TextoCuadro("RUC / DNI", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_ruccli, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Nombre", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadroWrap(c_nomcli, 90, ref fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + 10;
            p.Print_TextoCuadro("Fch. Emi.", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_fchemi, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            //p.Print_TextoCuadro("Hora Emi.", 150, fila, n_ancho, n_altocampo, 2, Color.Black, Color.Black);
            //p.Print_TextoCuadro(":", 220, fila, 10, n_altocampo, 2, Color.Black, Color.Black);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Cajero", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_cajero, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Placa", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_placa, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Ingreso", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_horini, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Salida", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_horfin, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Tiempo", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_tiempo, 90, fila, 220, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_Linea(10, fila, 270, fila, 3, Color.Black, 3);

            int    n_row      = 0;
            string c_servicio = "";
            string c_imp      = "";

            fila = fila + 7;

            for (n_row = 0; n_row <= dtListar.Rows.Count - 1; n_row++)
            {
                c_imp      = Convert.ToDouble(dtListar.Rows[n_row]["n_detimptotigv"]).ToString("0.00");
                c_servicio = dtListar.Rows[n_row]["c_detdesprousu"].ToString();

                p.Print_TextoCuadro("Servicio", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
                //o_colorlinea = Color.Black;
                p.Print_TextoCuadroWrap(c_servicio, 90, ref fila, 210, n_altocampo, 2, Color.Black, o_colorlinea);

                fila = fila + 5;
                p.Print_TextoCuadro("Importe", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(":", 80, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(c_imp, 90, fila, 210, n_altocampo, 2, Color.Black, o_colorlinea);

                fila = fila + n_altoseparacion;
            }

            fila = fila + 5;
            p.Print_Linea(10, fila, 270, fila, 3, Color.Black, 3);
            fila = fila + 7;
            int n_anchotot = 100;

            if (Convert.ToInt32(dtListar.Rows[0]["n_idtipdoc"]) == 2)
            {
                //fila = fila + n_altoseparacion;
                p.Print_TextoCuadro("Imp. Bruto  S/", 10, fila, n_anchotot, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(":", 110, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(c_impbru, 120, fila, 100, n_altocampo, 3, Color.Black, o_colorlinea);

                fila = fila + n_altoseparacion;
                p.Print_TextoCuadro("IGV (18 %)  S/", 10, fila, n_anchotot, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(":", 110, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
                p.Print_TextoCuadro(c_impigv, 120, fila, 100, n_altocampo, 3, Color.Black, o_colorlinea);

                fila = fila + n_altoseparacion;
            }

            //fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("Total   S/", 10, fila, n_anchotot, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(":", 110, fila, 10, n_altocampo, 2, Color.Black, o_colorlinea);
            p.Print_TextoCuadro(c_total, 120, fila, 100, n_altocampo, 3, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadro("SON :", 10, fila, n_ancho, n_altocampo, 2, Color.Black, o_colorlinea);

            fila = fila + n_altoseparacion;
            p.Print_TextoCuadroWrap(c_totallet, 10, ref fila, 280, n_altocampo, 2, Color.Black, o_colorlinea);

            if (fun.NulosC(c_plasoc) != "")
            {
                fila     = fila + n_altoseparacion;
                c_plasoc = "Ref. a placas: " + c_plasoc;
                p.Print_TextoCuadroWrap(c_plasoc, 10, ref fila, 280, n_altocampo, 2, Color.Black, o_colorlinea);
            }

            fila = fila + n_altoseparacion;
            //p.Print_Imagen(@"C:\\SSF-NET\\tmp\\101F0010000000002.bmp", 80, fila, 170, 80, 1, Color.Transparent, 1);
            p.Print_Imagen(c_archivo, 70, fila, 150, 60, 1, Color.Transparent, 1);

            p.drawFont = new Font("Arial", n_tam_3);
            if (c_tipdoc == "VALE")
            {
                c_dato = "Este documento provicional podra ser canjeado por una Factura o Boleta dentro del mes";
                p.Print_TextoCuadro(c_dato, 1, fila + 65, 270, 16, 1, Color.Black, o_colorlinea);
            }
            else
            {
                c_dato = "El documento electronico puede ser consultado en Sunat Virtual www.sunat.gob.pe, opciones sin clave SOL, consulta validez de CPE";
                fila   = fila + 65;
                p.Print_TextoCuadro(c_dato, 1, fila, 270, 32, 1, Color.Black, o_colorlinea);

                c_dato = "Solicitar el archivo .pdf y .xml al siguiente correo: " + c_correo;
                fila   = fila + 35;
                p.Print_TextoCuadro(c_dato, 1, fila, 270, 32, 1, Color.Black, o_colorlinea);
            }
        }