예제 #1
0
        public bool GenerarBoletaResumen(int n_IdRegistro, string c_FechaVenta, int n_NumeroDocumentos, string c_RutaDestino)
        {
            CD_vta_boletaresumen o_bol = new CD_vta_boletaresumen();
            bool      b_result         = false;
            DataTable dtresult         = new DataTable();
            DataTable dtRow            = new DataTable();
            int       n_numarch        = 1;
            int       n_numfil         = 0;
            string    c_nomarch        = "";
            string    c_rutenv         = c_RutaDestino;
            int       n_numpag         = 1;
            int       n_topepag        = 99;

            Helper.Cls_IO funIO = new Helper.Cls_IO();

            o_bol.mysConec = mysConec;
            o_bol.Consulta1(n_IdRegistro);
            dtresult = o_bol.dtLista;
            for (n_numfil = 0; n_numfil <= dtresult.Rows.Count - 1; n_numfil++)
            {
                dtresult.Rows[n_numfil]["n_idpag"] = n_numpag;

                if (n_numfil == n_topepag)
                {
                    n_numpag  = n_numpag + 1;
                    n_topepag = n_topepag + 100;
                }
            }

            for (n_numarch = 1; n_numarch <= n_NumeroDocumentos; n_numarch++)
            {
                c_nomarch = STU_SISTEMA.EMPRESARUC + "-RC-" + Convert.ToDateTime(c_FechaVenta).ToString("yyyyMMdd") + "-" + n_numarch.ToString("000") + ".RDI";
                dtRow     = funDatos.DataTableFiltrar(dtresult, "n_idpag = " + n_numarch.ToString() + "");

                if (funIO.Fil_GenerarTxt(dtRow, c_nomarch, c_rutenv, 2) == false)
                {
                    booOcurrioError = true;
                    StrErrorMensaje = funIO.c_err_mensaje;
                    IntErrorNumber  = funIO.n_err_numero;
                    booOcurrioError = true;
                    b_result        = false;
                    break;
                }
            }
            b_result = true;
            return(b_result);
        }
예제 #2
0
        public bool ProcesarCEN()
        {
            bool b_result = false;

            //bool b_result = false;
            Helper.Cls_IO funIO = new Helper.Cls_IO();
            string[]      c_ListaArchivos;
            int           n_numnarc = 0;
            int           n_row     = 0;
            string        c_nomarc  = "";
            int           n_numarch = 0;
            DataTable     dtOC      = new DataTable();

            // CARGAMOS TODOS LOS ARCHIVOS ZIP
            c_ListaArchivos = funIO.Dir_LeerDirectorio("C:\\SSF-NET\\PEDIDOS", "*.txt");
            n_numnarc       = Convert.ToInt32(c_ListaArchivos.GetLongLength(0));

            for (n_row = 0; n_row <= n_numnarc - 1; n_row++)
            {
                c_nomarc = c_ListaArchivos[n_row];
                LeerPedidoCEN(c_nomarc);

                PrepararEntidad(a_CabeceraCEN, a_DetalleCEN);

                CD_vta_pedidocen miFun = new CD_vta_pedidocen();
                bool             booOk = false;

                miFun.mysConec       = mysConec;
                entRegistro.n_anotra = STU_SISTEMA.ANOTRABAJO;
                entRegistro.n_mestra = STU_SISTEMA.MESTRABAJO;
                entRegistro.n_idemp  = STU_SISTEMA.EMPRESAID;

                miFun.Consulta1(STU_SISTEMA.EMPRESAID, a_CabeceraCEN[0]);
                dtOC = miFun.dtLista;

                if (dtOC.Rows.Count == 0)
                {
                    if (miFun.Insertar(entRegistro, LstDetalle) == false)
                    {
                        MessageBox.Show("¡ No se pudo cargar el siguiente archivo : " + c_nomarc + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        return(b_result);
                    }
                    else
                    {
                        n_numarch = n_numarch + 1;
                        funIO.Fil_EliminarArchivo(c_nomarc);
                    }
                }
                else
                {
                    MessageBox.Show("¡ El pedido Nº " + a_CabeceraCEN[0] + " ya existe !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    funIO.Fil_EliminarArchivo(c_nomarc);
                }
            }

            if (n_numarch > 0)
            {
                MessageBox.Show("¡ Se importaron " + n_numarch.ToString() + " pedidos del cliente CENCOSUD !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                MessageBox.Show("¡ No se encontraron pedidos para importar del cliente CENCOSUD !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            b_result = true;
            return(b_result);
        }