Esempio n. 1
0
        public static RNOrdenRemision GenerarRemision(string cvedoc, RNOrdenRecepcion recpecion, int folio, int numEmpresa, List <RNPartidasRecepcion> pRecpcion, List <RNRecepcion.Lotes> lotes, out List <RNPartidasRemision> partidas)
        {
            partidas = new List <RNPartidasRemision>();
            RNOrdenRemision remision = new RNOrdenRemision();
            bool            bpartidas;

            if (InsertarRemision(cvedoc, recpecion, folio, numEmpresa, pRecpcion, lotes, out bpartidas) && bpartidas)
            {
                remision = ObtenerRemision(cvedoc, numEmpresa);
                partidas = RNPartidasRemision.ObtenerPartidasRemision(cvedoc, numEmpresa);
            }
            return(remision);
        }
Esempio n. 2
0
        public static void GenerarRemision(RNOrdenRecepcion recepcion, List <RNPartidasRecepcion> partidas, List <RNRecepcion.Lotes> lotes)
        {
            // generar la remision en la inportadora
            int    numEmpresa     = RNLbInventory.ObtenerImportadora().NumEmpresa;
            int    folio          = 0;
            string cveDocRecpcion = GenerarCveRemision("R", null, numEmpresa, out folio);
            List <RNPartidasRemision> partidasRemision = null;
            RNOrdenRemision           remision         = RNOrdenRemision.GenerarRemision(cveDocRecpcion, recepcion, folio, numEmpresa, partidas, lotes, out partidasRemision);

            // actualizar las existencias
            foreach (var part in partidasRemision)
            {
                RNLbInventory.ActualizarExistencias(part.CVE_ART, recepcion.NUM_ALMA, -1, part.CANT, numEmpresa);
            }
        }
        // se reciben una partida de recepcion para no cambiar de una partida de recepcion a una de remision
        public static int RegistrarMovInveRemision(RNPartidasRecepcion partida, RNOrdenRemision orden, int reg_ltpd, int signo, int numEmpresa)
        {
            RNConexion conexion = new RNConexion(numEmpresa);

            conexion.baseDatos.AbrirConexion();
            conexion.baseDatos.LimpiarParametros();
            int existencias = RNRecepcion.ObtenerExistencias(partida.CVE_ART, partida.NUM_ALM, numEmpresa);
            int indice      = RNLbInventory.ObtenerIndice(44, numEmpresa);

            conexion.baseDatos.AgregarParametro("@CVE_ART", partida.CVE_ART);
            conexion.baseDatos.AgregarParametro("@ALMACEN", partida.NUM_ALM);
            conexion.baseDatos.AgregarParametro("@NUM_MOV", indice);
            conexion.baseDatos.AgregarParametro("@CVE_CPTO", 51);
            conexion.baseDatos.AgregarParametro("@FECHA_DOCU", orden.FECHA_DOC);
            conexion.baseDatos.AgregarParametro("@TIPO_DOC", orden.TIP_DOC);
            conexion.baseDatos.AgregarParametro("@REFER", orden.CVE_DOC);
            conexion.baseDatos.AgregarParametro("@CLAVE_CLPV", orden.CVE_CLPV);
            conexion.baseDatos.AgregarParametro("@VEND", null);
            conexion.baseDatos.AgregarParametro("@CANT", partida.CANT);
            conexion.baseDatos.AgregarParametro("@CANT_COST", partida.CANT);
            conexion.baseDatos.AgregarParametro("@PRECIO", partida.PREC);
            conexion.baseDatos.AgregarParametro("@COSTO", partida.COST);
            conexion.baseDatos.AgregarParametro("@AFEC_COI", null);
            conexion.baseDatos.AgregarParametro("@CVE_OBS", null);
            conexion.baseDatos.AgregarParametro("@REG_SERIE", partida.REG_SERIE);
            conexion.baseDatos.AgregarParametro("@UNI_VENTA", partida.UNI_VENTA);
            conexion.baseDatos.AgregarParametro("@E_LTPD", reg_ltpd);
            conexion.baseDatos.AgregarParametro("@EXIST_G", partida.CANT + existencias);//revisar la suma de las existencias
            conexion.baseDatos.AgregarParametro("@EXISTENCIA", partida.CANT + existencias);
            conexion.baseDatos.AgregarParametro("@TIPO_PROD", partida.TIPO_PROD);
            conexion.baseDatos.AgregarParametro("@FACTOR_CON", 1.00);
            conexion.baseDatos.AgregarParametro("@FECHAELAB", orden.FECHAELAB);
            conexion.baseDatos.AgregarParametro("@CTLPOL", orden.CTLPOL);
            conexion.baseDatos.AgregarParametro("@CVE_FOLIO", orden.FOLIO);
            conexion.baseDatos.AgregarParametro("@SIGNO", signo);
            conexion.baseDatos.AgregarParametro("@COSTEADO", "S");
            conexion.baseDatos.AgregarParametro("@COSTO_PROM_INI", partida.COST);
            conexion.baseDatos.AgregarParametro("@COSTO_PROM_FIN", partida.COST);
            conexion.baseDatos.AgregarParametro("@COSTO_PROM_GRAL", partida.COST);
            conexion.baseDatos.AgregarParametro("@DESDE_INVE", "N");
            conexion.baseDatos.AgregarParametro("@MOV_ENLAZADO", 0);
            var result = conexion.baseDatos.EjecutarSinConsulta(" INSERT INTO MINVE{0} (CVE_ART,ALMACEN,NUM_MOV,CVE_CPTO,FECHA_DOCU,TIPO_DOC,REFER,CLAVE_CLPV,VEND,CANT,CANT_COST,PRECIO,COSTO,AFEC_COI,CVE_OBS,REG_SERIE,UNI_VENTA,E_LTPD,EXIST_G,EXISTENCIA,TIPO_PROD,FACTOR_CON,FECHAELAB,CTLPOL,CVE_FOLIO,SIGNO,COSTEADO,COSTO_PROM_INI,COSTO_PROM_FIN,COSTO_PROM_GRAL,DESDE_INVE,MOV_ENLAZADO) " +
                                                                "VALUES (@CVE_ART,@ALMACEN,@NUM_MOV,@CVE_CPTO,@FECHA_DOCU,@TIPO_DOC,@REFER,@CLAVE_CLPV,@VEND,@CANT,@CANT_COST,@PRECIO,@COSTO,@AFEC_COI,@CVE_OBS,@REG_SERIE,@UNI_VENTA,@E_LTPD,@EXIST_G,@EXISTENCIA,@TIPO_PROD,@FACTOR_CON,@FECHAELAB,@CTLPOL,@CVE_FOLIO,@SIGNO,@COSTEADO,@COSTO_PROM_INI,@COSTO_PROM_FIN,@COSTO_PROM_GRAL,@DESDE_INVE,@MOV_ENLAZADO) ", CommandType.Text) > 0;

            return(indice);
        }
Esempio n. 4
0
        public static RNOrdenRemision ObtenerRemision(String cvedoc, int numEmpresa)
        {
            RNOrdenRemision remision = new RNOrdenRemision();
            RNConexion      conexion = new RNConexion(numEmpresa);

            conexion.baseDatos.AbrirConexion();
            conexion.baseDatos.LimpiarParametros();
            conexion.baseDatos.AgregarParametro("@cveOrden", cvedoc);
            var result = conexion.baseDatos.ObtenerTabla("select * from FACTR{0} where cve_doc =@cveOrden");

            foreach (DataRow row in result.Rows)
            {
                remision.TIP_DOC        = row["TIP_DOC"].ToString();
                remision.CVE_DOC        = row["CVE_DOC"].ToString();
                remision.CVE_CLPV       = row["CVE_CLPV"].ToString();
                remision.STATUS         = row["STATUS"].ToString();
                remision.DAT_MOSTR      = Convert.ToInt32(row["DAT_MOSTR"].ToString());
                remision.CVE_VEND       = row["CVE_VEND"].ToString();
                remision.CVE_PEDI       = row["CVE_PEDI"].ToString();
                remision.FECHA_DOC      = Convert.ToDateTime(row["FECHA_DOC"].ToString());
                remision.FECHA_ENT      = Convert.ToDateTime(row["FECHA_ENT"].ToString());
                remision.FECHA_VEN      = Convert.ToDateTime(row["FECHA_VEN"].ToString());
                remision.FECHA_CANCELA  = null;
                remision.CAN_TOT        = Convert.ToDecimal(row["CAN_TOT"].ToString());
                remision.IMP_TOT1       = Convert.ToDecimal(row["IMP_TOT1"].ToString());
                remision.IMP_TOT2       = Convert.ToDecimal(row["IMP_TOT2"].ToString());
                remision.IMP_TOT3       = Convert.ToDecimal(row["IMP_TOT3"].ToString());
                remision.IMP_TOT4       = Convert.ToDecimal(row["IMP_TOT4"].ToString());
                remision.DES_TOT        = Convert.ToDecimal(row["DES_TOT"].ToString());
                remision.DES_FIN        = Convert.ToDecimal(row["DES_FIN"].ToString());
                remision.COM_TOT        = Convert.ToDecimal(row["COM_TOT"].ToString());
                remision.CONDICION      = row["CONDICION"].ToString();
                remision.CVE_OBS        = Convert.ToInt32(row["CVE_OBS"].ToString());
                remision.NUM_ALMA       = Convert.ToInt32(row["NUM_ALMA"].ToString());
                remision.ACT_CXC        = row["ACT_CXC"].ToString();
                remision.ACT_COI        = row["ACT_COI"].ToString();
                remision.ENLAZADO       = row["ENLAZADO"].ToString();
                remision.TIP_DOC_E      = row["TIP_DOC_E"].ToString();
                remision.NUM_MONED      = Convert.ToInt32(row["NUM_MONED"].ToString());
                remision.TIPCAMB        = Convert.ToDecimal(row["TIPCAMB"].ToString());
                remision.NUM_PAGOS      = Convert.ToInt32(row["NUM_PAGOS"].ToString());
                remision.FECHAELAB      = Convert.ToDateTime(row["FECHAELAB"].ToString());
                remision.PRIMERPAGO     = Convert.ToDecimal(row["PRIMERPAGO"].ToString());
                remision.RFC            = row["RFC"].ToString();
                remision.CTLPOL         = Convert.ToInt32(row["CTLPOL"].ToString());
                remision.ESCFD          = row["ESCFD"].ToString();
                remision.AUTORIZA       = Convert.ToInt32(row["AUTORIZA"].ToString());
                remision.SERIE          = row["SERIE"].ToString();
                remision.FOLIO          = Convert.ToInt32(row["FOLIO"].ToString());
                remision.AUTOANIO       = row["AUTOANIO"].ToString();
                remision.DAT_ENVIO      = Convert.ToInt32(row["DAT_ENVIO"].ToString());
                remision.CONTADO        = row["CONTADO"].ToString();
                remision.CVE_BITA       = Convert.ToInt32(row["CVE_BITA"].ToString());
                remision.BLOQ           = row["BLOQ"].ToString();
                remision.FORMAENVIO     = row["FORMAENVIO"].ToString();
                remision.DES_FIN_PORC   = Convert.ToDecimal(row["DES_FIN_PORC"].ToString());
                remision.DES_TOT_PORC   = Convert.ToDecimal(row["DES_TOT_PORC"].ToString());
                remision.IMPORTE        = Convert.ToDecimal(row["IMPORTE"].ToString());
                remision.COM_TOT_PORC   = Convert.ToDecimal(row["COM_TOT_PORC"].ToString());
                remision.METODODEPAGO   = row["METODODEPAGO"].ToString();
                remision.NUMCTAPAGO     = row["NUMCTAPAGO"].ToString();
                remision.TIP_DOC_ANT    = row["TIP_DOC_ANT"].ToString();
                remision.DOC_ANT        = row["DOC_ANT"].ToString();
                remision.TIP_DOC_SIG    = row["TIP_DOC_SIG"].ToString();
                remision.DOC_SIG        = row["DOC_SIG"].ToString();
                remision.UUID           = row["UUID"].ToString();
                remision.VERSION_SINC   = Convert.ToDateTime(row["VERSION_SINC"].ToString());
                remision.FORMADEPAGOSAT = row["FORMADEPAGOSAT"].ToString();
                remision.USO_CFDI       = row["USO_CFDI"].ToString();
            } // actualizar la orden de compra
            return(remision);
        }
Esempio n. 5
0
        public static bool GenerarPartidas(RNOrdenRemision orden, string cvedoc, int folio, int numEmpresa, List <RNPartidasRecepcion> partidas, List <RNRecepcion.Lotes> lotes, out decimal cant_total, out decimal imp1, out decimal imp2, out decimal imp3, out decimal imp4, out decimal total, out decimal desc, out decimal descind, out decimal desfin)
        {
            RNConexion conexion = new RNConexion(numEmpresa);

            conexion.baseDatos.AbrirConexion();
            bool result = false;

            cant_total = 0;
            imp1       = 0;
            imp2       = 0;
            imp3       = 0;
            imp4       = 0;
            total      = 0;
            desc       = 0;
            descind    = 0;
            desfin     = 0;
            foreach (var p in partidas)
            {
                RNProducto prod     = RNProducto.ObtenerProductoPorClave(numEmpresa, p.CVE_ART);
                decimal    precio   = RNProducto.ObtenerPrecioProducto(p.CVE_ART, 1, numEmpresa);
                decimal    IMPU1    = 0.0M;
                decimal    IMPU2    = 0.0M;
                decimal    IMPU3    = 0.0M;
                decimal    IMPU4    = 0.0M;
                int        IMP1APLA = 0;
                int        IMP2APLA = 0;
                int        IMP3APLA = 0;
                int        IMP4APLA = 0;
                RNProducto.ObtenerImpuestos(p.CVE_ART, prod.CVE_ESQIMPU.Value, numEmpresa, out IMPU1, out IMPU2, out IMPU3, out IMPU4, out IMP1APLA, out IMP2APLA, out IMP3APLA, out IMP4APLA);
                cant_total += (precio * p.CANT);
                imp1       += precio * (IMPU1 / 100) * p.CANT;
                imp2       += precio * (IMPU2 / 100) * p.CANT;
                imp3       += precio * (IMPU3 / 100) * p.CANT;
                imp4       += precio * (IMPU4 / 100) * p.CANT;
                total      += (precio + imp1 + imp2 + imp3 + imp4) * p.CANT;
                desc       += 0;
                descind    += 0;
                desfin     += 0;
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cvedoc);
                conexion.baseDatos.AgregarParametro("@NUM_PAR", p.NUM_PAR);
                conexion.baseDatos.AgregarParametro("@CVE_ART", p.CVE_ART);
                conexion.baseDatos.AgregarParametro("@CANT", p.CANT);
                conexion.baseDatos.AgregarParametro("@PXS", p.CANT);
                conexion.baseDatos.AgregarParametro("@PREC", precio);
                conexion.baseDatos.AgregarParametro("@COST", p.COST);
                conexion.baseDatos.AgregarParametro("@IMPU1", IMPU1);
                conexion.baseDatos.AgregarParametro("@IMPU2", IMPU2);
                conexion.baseDatos.AgregarParametro("@IMPU3", IMPU3);
                conexion.baseDatos.AgregarParametro("@IMPU4", IMPU4);
                conexion.baseDatos.AgregarParametro("@IMP1APLA", IMP1APLA);
                conexion.baseDatos.AgregarParametro("@IMP2APLA", IMP2APLA);
                conexion.baseDatos.AgregarParametro("@IMP3APLA", IMP3APLA);
                conexion.baseDatos.AgregarParametro("@IMP4APLA", IMP4APLA);
                conexion.baseDatos.AgregarParametro("@TOTIMP1", IMP2APLA == 1 ? (precio * (IMPU1 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP2", IMP3APLA == 1 ? (precio * (IMPU2 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP3", IMP4APLA == 1 ? (precio * (IMPU3 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP4", IMP1APLA == 1 ? (precio * (IMPU4 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@DESC1", 0);
                conexion.baseDatos.AgregarParametro("@DESC2", 0);
                conexion.baseDatos.AgregarParametro("@DESC3", 0);
                conexion.baseDatos.AgregarParametro("@COMI", 0);
                conexion.baseDatos.AgregarParametro("@APAR", 0);
                conexion.baseDatos.AgregarParametro("@ACT_INV", "S");
                conexion.baseDatos.AgregarParametro("@NUM_ALM", p.NUM_ALM);
                conexion.baseDatos.AgregarParametro("@POLIT_APLI", "");
                conexion.baseDatos.AgregarParametro("@TIP_CAM", p.TIP_CAM);
                conexion.baseDatos.AgregarParametro("@UNI_VENTA", p.UNI_VENTA);
                conexion.baseDatos.AgregarParametro("@TIPO_PROD", p.TIPO_PROD);
                conexion.baseDatos.AgregarParametro("@CVE_OBS", 0);
                conexion.baseDatos.AgregarParametro("@REG_SERIE", 0);
                conexion.baseDatos.AgregarParametro("@E_LTPD", RNLbInventory.RegistrarEnlace(lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).reg_ltpd, lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).contador, numEmpresa));
                conexion.baseDatos.AgregarParametro("@TIPO_ELEM", "N");
                conexion.baseDatos.AgregarParametro("@NUM_MOV", RNLbInventory.RegistrarMovInveRemision(p, orden, lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).reg_ltpd, -1, numEmpresa));
                conexion.baseDatos.AgregarParametro("@TOT_PARTIDA", precio * p.CANT);
                conexion.baseDatos.AgregarParametro("@IMPRIMIR", "S");
                conexion.baseDatos.AgregarParametro("@UUID", "");
                conexion.baseDatos.AgregarParametro("@VERSION_SINC", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@MAN_IEPS", p.MAN_IEPS);
                conexion.baseDatos.AgregarParametro("@APL_MAN_IMP", p.APL_MAN_IMP);
                conexion.baseDatos.AgregarParametro("@CUOTA_IEPS", p.CUOTA_IEPS);
                conexion.baseDatos.AgregarParametro("@APL_MAN_IEPS", p.APL_MAN_IEPS);
                conexion.baseDatos.AgregarParametro("@MTO_PORC", p.MTO_PORC);
                conexion.baseDatos.AgregarParametro("@MTO_CUOTA", p.MTO_CUOTA);
                conexion.baseDatos.AgregarParametro("@CVE_ESQ", p.CVE_ESQ);
                conexion.baseDatos.AgregarParametro("@DESCR_ART", p.DESCR_ART);
                result = conexion.baseDatos.EjecutarSinConsulta("insert into PAR_FACTR{0} (CVE_DOC,NUM_PAR,CVE_ART,CANT,PXS,PREC,COST,IMPU1,IMPU2,IMPU3,IMPU4,IMP1APLA,IMP2APLA,IMP3APLA,IMP4APLA,TOTIMP1,TOTIMP2,TOTIMP3,TOTIMP4,DESC1,DESC2,DESC3,COMI,APAR,ACT_INV,NUM_ALM,POLIT_APLI,TIP_CAM,UNI_VENTA,TIPO_PROD,CVE_OBS,REG_SERIE,E_LTPD,TIPO_ELEM,NUM_MOV,TOT_PARTIDA,IMPRIMIR,UUID,VERSION_SINC,MAN_IEPS,APL_MAN_IMP,CUOTA_IEPS,APL_MAN_IEPS,MTO_PORC,MTO_CUOTA,CVE_ESQ,DESCR_ART) values " +
                                                                "(@CVE_DOC,@NUM_PAR,@CVE_ART,@CANT,@PXS,@PREC,@COST,@IMPU1,@IMPU2,@IMPU3,@IMPU4,@IMP1APLA,@IMP2APLA,@IMP3APLA,@IMP4APLA,@TOTIMP1,@TOTIMP2,@TOTIMP3,@TOTIMP4,@DESC1,@DESC2,@DESC3,@COMI,@APAR,@ACT_INV,@NUM_ALM,@POLIT_APLI,@TIP_CAM,@UNI_VENTA,@TIPO_PROD,@CVE_OBS,@REG_SERIE,@E_LTPD,@TIPO_ELEM,@NUM_MOV,@TOT_PARTIDA,@IMPRIMIR,@UUID,@VERSION_SINC,@MAN_IEPS,@APL_MAN_IMP,@CUOTA_IEPS,@APL_MAN_IEPS,@MTO_PORC,@MTO_CUOTA,@CVE_ESQ,@DESCR_ART)") > 0;
                bool b = InsertarPartidasCL(cvedoc, p.NUM_PAR, numEmpresa);
            }
            return(result);
        }
        public bool InsertarPartidas(List <RNPartidasRecepcion> partidas, string cveDoc, int folio, List <Lotes> lotes, int numEmpresa, out decimal cant_total, out decimal imp1, out decimal imp2, out decimal imp3, out decimal imp4, out decimal total, out decimal desc, out decimal descind, out decimal desfin)
        {
            cant_total = 0;
            imp1       = 0;
            imp2       = 0;
            imp3       = 0;
            imp4       = 0;
            total      = 0;
            desc       = 0;
            descind    = 0;
            desfin     = 0;
            RNConexion conexion = new RNConexion(numEmpresa);

            conexion.baseDatos.AbrirConexion();
            bool result = false;

            foreach (var p in partidas)
            {
                RNProducto prod     = RNProducto.ObtenerProductoPorClave(numEmpresa, p.CVE_ART);
                decimal    precio   = RNProducto.ObtenerPrecioProducto(p.CVE_ART, 1, numEmpresa);
                decimal    IMPU1    = 0.0M;
                decimal    IMPU2    = 0.0M;
                decimal    IMPU3    = 0.0M;
                decimal    IMPU4    = 0.0M;
                int        IMP1APLA = 0;
                int        IMP2APLA = 0;
                int        IMP3APLA = 0;
                int        IMP4APLA = 0;
                if (prod.CVE_ESQIMPU.Value > 0 && prod.CVE_ESQIMPU != null)
                {
                    RNProducto.ObtenerImpuestos(p.CVE_ART, prod.CVE_ESQIMPU.Value, numEmpresa, out IMPU1, out IMPU2, out IMPU3, out IMPU4, out IMP1APLA, out IMP2APLA, out IMP3APLA, out IMP4APLA);
                }
                cant_total += (prod.ULT_COSTO.Value * p.CANT);
                imp1       += prod.ULT_COSTO.Value * (IMPU1 / 100) * p.CANT;
                imp2       += prod.ULT_COSTO.Value * (IMPU2 / 100) * p.CANT;
                imp3       += prod.ULT_COSTO.Value * (IMPU3 / 100) * p.CANT;
                imp4       += prod.ULT_COSTO.Value * (IMPU4 / 100) * p.CANT;
                total      += (prod.ULT_COSTO.Value * p.CANT) + imp1 + imp2 + imp3 + imp4;
                desc       += 0;
                descind    += 0;
                desfin     += 0;
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@CVE_DOC", p.CVE_DOC);
                conexion.baseDatos.AgregarParametro("@NUM_PAR", p.NUM_PAR);
                conexion.baseDatos.AgregarParametro("@CVE_ART", p.CVE_ART);
                conexion.baseDatos.AgregarParametro("@CANT", p.CANT);
                conexion.baseDatos.AgregarParametro("@PXR", p.PXR);
                conexion.baseDatos.AgregarParametro("@PREC", precio);
                conexion.baseDatos.AgregarParametro("@COST", prod.ULT_COSTO);
                conexion.baseDatos.AgregarParametro("@IMPU1", IMPU1);
                conexion.baseDatos.AgregarParametro("@IMPU2", IMPU2);
                conexion.baseDatos.AgregarParametro("@IMPU3", IMPU3);
                conexion.baseDatos.AgregarParametro("@IMPU4", IMPU4);
                conexion.baseDatos.AgregarParametro("@IMP1APLA", IMP1APLA);
                conexion.baseDatos.AgregarParametro("@IMP2APLA", IMP2APLA);
                conexion.baseDatos.AgregarParametro("@IMP3APLA", IMP3APLA);
                conexion.baseDatos.AgregarParametro("@IMP4APLA", IMP4APLA);
                conexion.baseDatos.AgregarParametro("@TOTIMP2", IMP2APLA == 1?(prod.ULT_COSTO * (IMPU1 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP3", IMP3APLA == 1?(prod.ULT_COSTO * (IMPU2 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP4", IMP4APLA == 1?(prod.ULT_COSTO * (IMPU3 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@TOTIMP1", IMP1APLA == 1?(prod.ULT_COSTO * (IMPU4 / 100)) * p.CANT : 0.00M);
                conexion.baseDatos.AgregarParametro("@DESCU", p.DESCU);
                conexion.baseDatos.AgregarParametro("@ACT_INV", p.ACT_INV);
                conexion.baseDatos.AgregarParametro("@TIP_CAM", p.TIP_CAM);
                conexion.baseDatos.AgregarParametro("@UNI_VENTA", p.UNI_VENTA);
                conexion.baseDatos.AgregarParametro("@TIPO_ELEM", p.TIPO_ELEM);
                conexion.baseDatos.AgregarParametro("@TIPO_PROD", p.TIPO_PROD);
                conexion.baseDatos.AgregarParametro("@CVE_OBS", p.CVE_OBS);
                conexion.baseDatos.AgregarParametro("@E_LTPD", RNLbInventory.RegistrarEnlace(lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).reg_ltpd, lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).contador, numEmpresa));
                conexion.baseDatos.AgregarParametro("@REG_SERIE", p.REG_SERIE);
                conexion.baseDatos.AgregarParametro("@FACTCONV", p.FACTCONV);
                conexion.baseDatos.AgregarParametro("@COST_DEV", prod.ULT_COSTO);
                conexion.baseDatos.AgregarParametro("@NUM_ALM", p.NUM_ALM);
                conexion.baseDatos.AgregarParametro("@MINDIRECTO", p.MINDIRECTO);
                conexion.baseDatos.AgregarParametro("@NUM_MOV", RNLbInventory.RegistrarMovInveRemision(p, RNOrdenRemision.ObtenerRemision(cveDoc, numEmpresa), lotes.FirstOrDefault(x => x.partida == p.NUM_PAR).reg_ltpd, 1, numEmpresa));
                conexion.baseDatos.AgregarParametro("@TOT_PARTIDA", prod.ULT_COSTO * p.CANT);
                conexion.baseDatos.AgregarParametro("@MAN_IEPS", p.MAN_IEPS);
                conexion.baseDatos.AgregarParametro("@APL_MAN_IMP", p.APL_MAN_IMP);
                conexion.baseDatos.AgregarParametro("@CUOTA_IEPS", p.CUOTA_IEPS);
                conexion.baseDatos.AgregarParametro("@APL_MAN_IEPS", p.APL_MAN_IEPS);
                conexion.baseDatos.AgregarParametro("@MTO_PORC", p.MTO_PORC);
                conexion.baseDatos.AgregarParametro("@MTO_CUOTA", p.MTO_CUOTA);
                conexion.baseDatos.AgregarParametro("@CVE_ESQ", p.CVE_ESQ);
                conexion.baseDatos.AgregarParametro("@DESCR_ART", p.DESCR_ART);
                result = conexion.baseDatos.EjecutarSinConsulta("insert into PAR_COMPR{0} (CVE_DOC,NUM_PAR,CVE_ART,CANT,PXR,PREC,COST,IMPU1,IMPU2,IMPU3,IMPU4,IMP1APLA,IMP2APLA,IMP3APLA,IMP4APLA,TOTIMP1,TOTIMP2,TOTIMP3,TOTIMP4,DESCU,ACT_INV,TIP_CAM,UNI_VENTA,TIPO_ELEM,TIPO_PROD,CVE_OBS,E_LTPD,REG_SERIE,FACTCONV,COST_DEV,NUM_ALM,MINDIRECTO,NUM_MOV,TOT_PARTIDA,MAN_IEPS,APL_MAN_IMP,CUOTA_IEPS,APL_MAN_IEPS,MTO_PORC,MTO_CUOTA,CVE_ESQ,DESCR_ART) values " +
                                                                "(@CVE_DOC,@NUM_PAR,@CVE_ART,@CANT,@PXR,@PREC,@COST,@IMPU1,@IMPU2,@IMPU3,@IMPU4,@IMP1APLA,@IMP2APLA,@IMP3APLA,@IMP4APLA,@TOTIMP1,@TOTIMP2,@TOTIMP3,@TOTIMP4,@DESCU,@ACT_INV,@TIP_CAM,@UNI_VENTA,@TIPO_ELEM,@TIPO_PROD,@CVE_OBS,@E_LTPD,@REG_SERIE,@FACTCONV,@COST_DEV,@NUM_ALM,@MINDIRECTO,@NUM_MOV,@TOT_PARTIDA,@MAN_IEPS,@APL_MAN_IMP,@CUOTA_IEPS,@APL_MAN_IEPS,@MTO_PORC,@MTO_CUOTA,@CVE_ESQ,@DESCR_ART)") > 0;
            }
            bool abn = InsertarPartidasCL(partidas, numEmpresa);

            return(result);
        }