public static int AgregarLote(string lote, RNPedimento pedimento, string articulo, DateTime caducidad, int contador, int cve_Almacen, string status, DateTime modificacion, int NumEmpresa)
 {
     try
     {
         RNConexion conexion = new RNConexion(NumEmpresa);
         conexion.baseDatos.AbrirConexion();
         conexion.baseDatos.LimpiarParametros();
         int indice = RNLbInventory.ObtenerIndice(48, NumEmpresa);
         conexion.baseDatos.LimpiarParametros();
         conexion.baseDatos.AgregarParametro("@articulo", articulo);
         conexion.baseDatos.AgregarParametro("@Lote", lote);
         conexion.baseDatos.AgregarParametro("@pedimento", pedimento.numPedimento);
         conexion.baseDatos.AgregarParametro("@NOM_ADUAN", pedimento.Aduana);
         conexion.baseDatos.AgregarParametro("@CIUDAD", pedimento.Ciudad);
         conexion.baseDatos.AgregarParametro("@FRONTERA", pedimento.Frontera);
         conexion.baseDatos.AgregarParametro("@GLN", pedimento.GLN);
         conexion.baseDatos.AgregarParametro("@FCHADUANA", pedimento.Fecha);
         conexion.baseDatos.AgregarParametro("@reg_ltpd", indice);
         conexion.baseDatos.AgregarParametro("@cve_Almacen", cve_Almacen);
         conexion.baseDatos.AgregarParametro("@caducidad", caducidad);
         conexion.baseDatos.AgregarParametro("@modificacion", modificacion);
         conexion.baseDatos.AgregarParametro("@contador", contador);
         conexion.baseDatos.AgregarParametro("@status", status);
         var response = conexion.baseDatos.EjecutarSinConsulta("insert into ltpd{0} (    CVE_ART ,LOTE,PEDIMENTO,CVE_ALM ,CANTIDAD,FCHCADUC ,FCHULTMOV,REG_LTPD, CVE_OBS, STATUS,PEDIMENTOSAT,NOM_ADUAN,CIUDAD,FRONTERA,GLN,FCHADUANA) " +
                                                               "VALUES(@articulo, @lote, @pedimento, @cve_Almacen,@contador,@caducidad, @modificacion,@reg_ltpd ,0, @status, @pedimento,@NOM_ADUAN,@CIUDAD,@FRONTERA,@GLN,@FCHADUANA)") > 0;
         return(indice);
     }
     catch (Exception e)
     {
         MessageBox.Show("Error al validar Lotes:  " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(0);
     }
 }
 public static void GenerarRecepcionComercializadora(RNOrdenRecepcion recepcion, List <RNPartidasRecepcion> partidas, List <Lotes> lotes, RNPedimento pedimento)
 {
     int              numEmpresa                = RNLbInventory.ObtenerComercializadora().NumEmpresa;
     int              folio                     = 0;
     string           cveDocRecpcion            = GenerarRecepcion("r", null, numEmpresa, out folio);
     RNOrdenRecepcion recepcioncomercializadora = new RNOrdenRecepcion().GenerarRecepcion(recepcion, partidas, cveDocRecpcion, folio, numEmpresa, lotes);
 }
        public static string GenerarRecepcion(string tipoDoc, string serie, int numEmpresa, out int folio)
        {
            serie = string.IsNullOrEmpty(serie) ? "STAND." : serie;
            string cveDoc = RNLbInventory.ObtenerCveDoc(tipoDoc, serie, numEmpresa, "C", out folio);

            return(cveDoc);
        }
Ejemplo n.º 4
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);
            }
        }
        public static int RegistrarEnlace(int Reg_ltpd, int cantidad, int numEmpresa)
        {
            RNConexion conexion = new RNConexion(numEmpresa);

            conexion.baseDatos.AbrirConexion();
            conexion.baseDatos.LimpiarParametros();
            int indice = RNLbInventory.ObtenerIndice(67, numEmpresa);

            conexion.baseDatos.AgregarParametro("@E_LTPD", indice);
            conexion.baseDatos.AgregarParametro("@REG_LTPD", Reg_ltpd);
            conexion.baseDatos.AgregarParametro("@CANTIDAD", cantidad);
            conexion.baseDatos.AgregarParametro("@PXRS", cantidad);
            var result = conexion.baseDatos.EjecutarSinConsulta(" INSERT INTO ENLACE_LTPD{0} (E_LTPD,REG_LTPD,CANTIDAD,PXRS) " +
                                                                "VALUES (@E_LTPD,@REG_LTPD,@CANTIDAD,@PXRS) ", CommandType.Text) > 0;

            return(indice);
        }
        // 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);
        }
Ejemplo n.º 7
0
        public static bool InsertarRemision(string cvedoc, RNOrdenRecepcion recpecion, int folio, int numEmpresa, List <RNPartidasRecepcion> pRecpcion, List <RNRecepcion.Lotes> lotes, out bool bpartidas)
        {
            bpartidas = false;
            try
            {
                RNConexion conexion = new RNConexion(numEmpresa);
                //obtenerelclienterecepecion
                RNCliente cliente  = RNLbInventory.ObtenerClienteRemicion(numEmpresa);
                int       cve_bita = RNLbInventory.ObtenerBita(cliente.CLAVE, cvedoc, "    3", recpecion.IMPORTE, numEmpresa);
                conexion.baseDatos.AbrirConexion();
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@TIP_DOC", "R");
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cvedoc);
                conexion.baseDatos.AgregarParametro("@CVE_CLPV", cliente.CLAVE);
                conexion.baseDatos.AgregarParametro("@STATUS", "E");
                conexion.baseDatos.AgregarParametro("@DAT_MOSTR", 0);
                conexion.baseDatos.AgregarParametro("@CVE_VEND", "");
                conexion.baseDatos.AgregarParametro("@CVE_PEDI", "");
                conexion.baseDatos.AgregarParametro("@FECHA_DOC", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@FECHA_ENT", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@FECHA_VEN", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@CAN_TOT", recpecion.CAN_TOT);
                conexion.baseDatos.AgregarParametro("@IMP_TOT1", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT2", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT3", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT4", 0.00M);
                conexion.baseDatos.AgregarParametro("@DES_TOT", 0.00M);
                conexion.baseDatos.AgregarParametro("@DES_FIN", 0.00M);
                conexion.baseDatos.AgregarParametro("@COM_TOT", 0);
                conexion.baseDatos.AgregarParametro("@CONDICION", "");
                conexion.baseDatos.AgregarParametro("@CVE_OBS", 0);
                conexion.baseDatos.AgregarParametro("@NUM_ALMA", recpecion.NUM_ALMA);
                conexion.baseDatos.AgregarParametro("@ACT_CXC", "S");
                conexion.baseDatos.AgregarParametro("@ACT_COI", "N");
                conexion.baseDatos.AgregarParametro("@ENLAZADO", "O");
                conexion.baseDatos.AgregarParametro("@TIP_DOC_E", "O");
                conexion.baseDatos.AgregarParametro("@NUM_MONED", recpecion.NUM_MONED);
                conexion.baseDatos.AgregarParametro("@TIPCAMB", recpecion.TIPCAMB);
                conexion.baseDatos.AgregarParametro("@NUM_PAGOS", recpecion.NUM_PAGOS);
                conexion.baseDatos.AgregarParametro("@FECHAELAB", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@PRIMERPAGO", 0.00);
                conexion.baseDatos.AgregarParametro("@RFC", cliente.RFC);
                conexion.baseDatos.AgregarParametro("@CTLPOL", 0);
                conexion.baseDatos.AgregarParametro("@ESCFD", "N");
                conexion.baseDatos.AgregarParametro("@AUTORIZA", 0);
                conexion.baseDatos.AgregarParametro("@SERIE", "");
                conexion.baseDatos.AgregarParametro("@FOLIO", folio);
                conexion.baseDatos.AgregarParametro("@AUTOANIO", "");
                conexion.baseDatos.AgregarParametro("@DAT_ENVIO", 0);
                conexion.baseDatos.AgregarParametro("@CONTADO", "N");
                conexion.baseDatos.AgregarParametro("@CVE_BITA", cve_bita);
                conexion.baseDatos.AgregarParametro("@BLOQ", "N");
                conexion.baseDatos.AgregarParametro("@FORMAENVIO", "");
                conexion.baseDatos.AgregarParametro("@DES_FIN_PORC", 0.000);
                conexion.baseDatos.AgregarParametro("@DES_TOT_PORC", 0.000);
                conexion.baseDatos.AgregarParametro("@IMPORTE", 0.00M);
                conexion.baseDatos.AgregarParametro("@COM_TOT_PORC", 0.00);
                conexion.baseDatos.AgregarParametro("@METODODEPAGO", null);
                conexion.baseDatos.AgregarParametro("@NUMCTAPAGO", null);
                conexion.baseDatos.AgregarParametro("@TIP_DOC_ANT", "");
                conexion.baseDatos.AgregarParametro("@DOC_ANT", "");
                conexion.baseDatos.AgregarParametro("@TIP_DOC_SIG", null);
                conexion.baseDatos.AgregarParametro("@DOC_SIG", null);
                conexion.baseDatos.AgregarParametro("@UUID", null);//obtener el uuid
                conexion.baseDatos.AgregarParametro("@VERSION_SINC", DateTime.Today);
                conexion.baseDatos.AgregarParametro("@FORMADEPAGOSAT", null);
                conexion.baseDatos.AgregarParametro("@USO_CFDI", null);
                var result = conexion.baseDatos.EjecutarSinConsulta(" INSERT INTO FACTR{0} (TIP_DOC,CVE_DOC,CVE_CLPV,STATUS,DAT_MOSTR,CVE_VEND,CVE_PEDI,FECHA_DOC,FECHA_ENT,FECHA_VEN,CAN_TOT,IMP_TOT1,IMP_TOT2,IMP_TOT3,IMP_TOT4,DES_TOT,DES_FIN,COM_TOT,CONDICION,CVE_OBS,NUM_ALMA,ACT_CXC,ACT_COI,ENLAZADO,TIP_DOC_E,NUM_MONED,TIPCAMB,NUM_PAGOS,FECHAELAB,PRIMERPAGO,RFC,CTLPOL,ESCFD,AUTORIZA,SERIE,FOLIO,AUTOANIO,DAT_ENVIO,CONTADO,CVE_BITA,BLOQ,FORMAENVIO,DES_FIN_PORC,DES_TOT_PORC,IMPORTE,COM_TOT_PORC,METODODEPAGO,NUMCTAPAGO,TIP_DOC_ANT,DOC_ANT,TIP_DOC_SIG,DOC_SIG,UUID,VERSION_SINC,FORMADEPAGOSAT,USO_CFDI) " +
                                                                    "VALUES (@TIP_DOC,@CVE_DOC,@CVE_CLPV,@STATUS,@DAT_MOSTR,@CVE_VEND,@CVE_PEDI,@FECHA_DOC,@FECHA_ENT,@FECHA_VEN,@CAN_TOT,@IMP_TOT1,@IMP_TOT2,@IMP_TOT3,@IMP_TOT4,@DES_TOT,@DES_FIN,@COM_TOT,@CONDICION,@CVE_OBS,@NUM_ALMA,@ACT_CXC,@ACT_COI,@ENLAZADO,@TIP_DOC_E,@NUM_MONED,@TIPCAMB,@NUM_PAGOS,@FECHAELAB,@PRIMERPAGO,@RFC,@CTLPOL,@ESCFD,@AUTORIZA,@SERIE,@FOLIO,@AUTOANIO,@DAT_ENVIO,@CONTADO,@CVE_BITA,@BLOQ,@FORMAENVIO,@DES_FIN_PORC,@DES_TOT_PORC,@IMPORTE,@COM_TOT_PORC,@METODODEPAGO,@NUMCTAPAGO,@TIP_DOC_ANT,@DOC_ANT,@TIP_DOC_SIG,@DOC_SIG,@UUID,@VERSION_SINC,@FORMADEPAGOSAT,@USO_CFDI)", CommandType.Text) > 0;
                // agregar los campos libres
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cvedoc);
                var resultcl = conexion.baseDatos.EjecutarSinConsulta(" insert into FACTR_CLIB{0}(CLAVE_DOC) values(@CVE_DOC); ", CommandType.Text) > 0;
                //agregar las partidas
                decimal cant_total, imp1, imp2, imp3, imp4, total, desc, descind, desfin;
                bpartidas = RNPartidasRemision.GenerarPartidas(ObtenerRemision(cvedoc, numEmpresa), cvedoc, folio, numEmpresa, pRecpcion, lotes, out cant_total, out imp1, out imp2, out imp3, out imp4, out total, out desc, out descind, out desfin);
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@IMP_TOT1", imp1);
                conexion.baseDatos.AgregarParametro("@IMP_TOT2", imp2);
                conexion.baseDatos.AgregarParametro("@IMP_TOT3", imp3);
                conexion.baseDatos.AgregarParametro("@IMP_TOT4", imp4);
                conexion.baseDatos.AgregarParametro("@IMPORTE", total);
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cvedoc);
                conexion.baseDatos.AgregarParametro("@CAN_TOT", cant_total);
                result = conexion.baseDatos.EjecutarSinConsulta("update FACTR{0} set  IMP_TOT1=@IMP_TOT1 ,IMP_TOT2=@IMP_TOT2,IMP_TOT3=@IMP_TOT3,IMP_TOT4=@IMP_TOT4,IMPORTE=@IMPORTE, CAN_TOT=@CAN_TOT " +
                                                                "where CVE_DOC = @CVE_DOC", CommandType.Text) > 0;


                return(result);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 8
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 static void GenerarRecepcion(DataGridView dataGridCompras, string cveDoc, int numEmpresa, RNPedimento pedimento)
        {
            try
            {
                List <Lotes> lotes = new List <Lotes>();
                // se obtiene el folio y la clave de la Recepción
                int    folio          = 0;
                string cveDocRecpcion = GenerarRecepcion("r", null, numEmpresa, out folio);
                List <RNPartidasRecepcion> partidas = new List <RNPartidasRecepcion>();
                // se crea el documento de recepción y sus partidas
                //registrar cabecera y patidas
                RNOrdenRecepcion recepcion = new RNOrdenRecepcion().GenerarRecepcion(cveDoc, cveDocRecpcion, folio, numEmpresa, out partidas);


                for (int fila = 0; fila < dataGridCompras.Rows.Count; fila++)
                {
                    for (int col = 8; col < dataGridCompras.Rows[fila].Cells.Count; col = col + 2)
                    {
                        if (lotes.Any(x => x.lote == dataGridCompras.Rows[fila].Cells[col].Value.ToString()))
                        {
                            foreach (var l in lotes)
                            {
                                if (l.lote == dataGridCompras.Rows[fila].Cells[col].Value.ToString())
                                {
                                    l.contador++;
                                }
                            }
                        }
                        else
                        {
                            Lotes lotes1 = new Lotes();
                            lotes1.articulo  = dataGridCompras.Rows[fila].Cells[6].Value.ToString();
                            lotes1.contador  = 1;
                            lotes1.lote      = dataGridCompras.Rows[fila].Cells[col].Value.ToString();
                            lotes1.caducidad = Convert.ToDateTime(dataGridCompras.Rows[fila].Cells[col + 1].Value.ToString());
                            lotes1.partida   = Convert.ToInt32(dataGridCompras.Rows[fila].Cells[0].Value.ToString());
                            lotes.Add(lotes1);
                        }
                    }
                }
                foreach (var l in lotes)
                {
                    if (ValidarLote(l.lote, pedimento.numPedimento, numEmpresa))
                    {
                        l.reg_ltpd        = AgregarLote(l.lote, pedimento, l.articulo, l.caducidad, l.contador, 1, "A", DateTime.Now, numEmpresa);
                        l.reg_ltpd_Enlace = RNLbInventory.RegistrarEnlace(l.reg_ltpd, l.contador, numEmpresa);
                        l.minve_id        = RNLbInventory.RegistrarMovInveRecepcion(partidas.Where(x => x.NUM_PAR == l.partida).FirstOrDefault(), recepcion, l.reg_ltpd_Enlace, 1, numEmpresa);
                    }
                    else
                    {
                        l.reg_ltpd        = ActualizarLote(l.lote, pedimento.numPedimento, l.articulo, l.caducidad, l.contador, 1, "A", DateTime.Now, numEmpresa);
                        l.reg_ltpd_Enlace = RNLbInventory.RegistrarEnlace(l.reg_ltpd, l.contador, numEmpresa);
                        l.minve_id        = RNLbInventory.RegistrarMovInveRecepcion(partidas.Where(x => x.NUM_PAR == l.partida).FirstOrDefault(), recepcion, l.reg_ltpd_Enlace, 1, numEmpresa);
                    }

                    RNPartidasRecepcion.ActualizarPartida(recepcion.CVE_DOC, l.partida, l.reg_ltpd_Enlace, l.minve_id, numEmpresa);
                    RNLbInventory.ActualizarExistencias(partidas.Where(x => x.NUM_PAR == l.partida).FirstOrDefault().CVE_ART, recepcion.NUM_ALMA, 1, partidas.Where(x => x.NUM_PAR == l.partida).FirstOrDefault().CANT, numEmpresa);
                }
                if (RNLbInventory.ObtenerImportadora().NumEmpresa == numEmpresa)
                {
                    RNRemision.GenerarRemision(recepcion, partidas, lotes);
                    GenerarRecepcionComercializadora(recepcion, partidas, lotes, pedimento);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error al generar la recepción:  " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        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);
        }
Ejemplo n.º 11
0
        public RNOrdenRecepcion GenerarRecepcion(RNOrdenRecepcion recepcion, List <RNPartidasRecepcion> partidas, string cveDoc, int folio, int numEmpresa, List <RNRecepcion.Lotes> lotes)
        {
            //obtener la info del PROVEEDOR para recepcion
            RNProveedor prov = RNLbInventory.ObtenerProveedorRecepcion(numEmpresa);

            // INSETAR PARTIDAS Y REGRESAR  EL TORTAL
            //agregar las partidas

            try
            {
                RNConexion conexion = new RNConexion(numEmpresa);
                conexion.baseDatos.AbrirConexion();
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@TIP_DOC", recepcion.TIP_DOC);
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cveDoc);
                conexion.baseDatos.AgregarParametro("@CVE_CLPV", prov.CLAVE);
                conexion.baseDatos.AgregarParametro("@STATUS", recepcion.STATUS);
                conexion.baseDatos.AgregarParametro("@SU_REFER", recepcion.SU_REFER);
                conexion.baseDatos.AgregarParametro("@FECHA_DOC", recepcion.FECHA_DOC);
                conexion.baseDatos.AgregarParametro("@FECHA_REC", recepcion.FECHA_REC);
                conexion.baseDatos.AgregarParametro("@FECHA_PAG", recepcion.FECHA_PAG);
                conexion.baseDatos.AgregarParametro("@FECHA_CANCELA", recepcion.FECHA_CANCELA);
                conexion.baseDatos.AgregarParametro("@CAN_TOT", recepcion.CAN_TOT);
                conexion.baseDatos.AgregarParametro("@IMP_TOT1", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT2", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT3", 0.00M);
                conexion.baseDatos.AgregarParametro("@IMP_TOT4", 0.00M);
                conexion.baseDatos.AgregarParametro("@TOT_IND", recepcion.TOT_IND);
                conexion.baseDatos.AgregarParametro("@DES_TOT", recepcion.DES_TOT);
                conexion.baseDatos.AgregarParametro("@DES_FIN", recepcion.DES_FIN);
                conexion.baseDatos.AgregarParametro("@OBS_COND", recepcion.OBS_COND);
                conexion.baseDatos.AgregarParametro("@CVE_OBS", recepcion.CVE_OBS);
                conexion.baseDatos.AgregarParametro("@NUM_ALMA", recepcion.NUM_ALMA);
                conexion.baseDatos.AgregarParametro("@ACT_CXP", recepcion.ACT_CXP);
                conexion.baseDatos.AgregarParametro("@ACT_COI", recepcion.ACT_COI);
                conexion.baseDatos.AgregarParametro("@NUM_MONED", recepcion.NUM_MONED);
                conexion.baseDatos.AgregarParametro("@TIPCAMB", recepcion.TIPCAMB);
                conexion.baseDatos.AgregarParametro("@NUM_PAGOS", recepcion.NUM_PAGOS);
                conexion.baseDatos.AgregarParametro("@ENLAZADO", recepcion.ENLAZADO);
                conexion.baseDatos.AgregarParametro("@TIP_DOC_E", recepcion.TIP_DOC_E);
                conexion.baseDatos.AgregarParametro("@FECHAELAB", recepcion.FECHAELAB);
                conexion.baseDatos.AgregarParametro("@SERIE", recepcion.SERIE);
                conexion.baseDatos.AgregarParametro("@FOLIO", folio);
                conexion.baseDatos.AgregarParametro("@CTLPOL", recepcion.CTLPOL);
                conexion.baseDatos.AgregarParametro("@ESCFD", recepcion.ESCFD);
                conexion.baseDatos.AgregarParametro("@CONTADO", recepcion.CONTADO);
                conexion.baseDatos.AgregarParametro("@BLOQ", recepcion.BLOQ);
                conexion.baseDatos.AgregarParametro("@DES_FIN_PORC", recepcion.DES_FIN_PORC);
                conexion.baseDatos.AgregarParametro("@DES_TOT_PORC", recepcion.DES_TOT_PORC);
                conexion.baseDatos.AgregarParametro("@IMPORTE", 0.00M);
                conexion.baseDatos.AgregarParametro("@TIP_DOC_ANT", "");
                conexion.baseDatos.AgregarParametro("@DOC_ANT", "");
                conexion.baseDatos.AgregarParametro("@TIP_DOC_SIG", null);
                conexion.baseDatos.AgregarParametro("@DOC_SIG", null);
                conexion.baseDatos.AgregarParametro("@FORMAENVIO", recepcion.FORMAENVIO);
                var result = conexion.baseDatos.EjecutarSinConsulta(" INSERT INTO COMPR{0} (TIP_DOC,CVE_DOC,CVE_CLPV,STATUS,SU_REFER,FECHA_DOC,FECHA_REC,FECHA_PAG,FECHA_CANCELA,CAN_TOT,IMP_TOT1,IMP_TOT2,IMP_TOT3,IMP_TOT4,DES_TOT,DES_FIN,TOT_IND,OBS_COND,CVE_OBS,NUM_ALMA,ACT_CXP,ACT_COI,ENLAZADO,TIP_DOC_E,NUM_MONED,TIPCAMB,NUM_PAGOS,FECHAELAB,SERIE,FOLIO,CTLPOL,ESCFD,CONTADO,BLOQ,DES_FIN_PORC,DES_TOT_PORC,IMPORTE,TIP_DOC_ANT,DOC_ANT,TIP_DOC_SIG,DOC_SIG,FORMAENVIO) " +
                                                                    "VALUES (@TIP_DOC,@CVE_DOC,@CVE_CLPV,@STATUS,@SU_REFER,@FECHA_DOC,@FECHA_REC,@FECHA_PAG,@FECHA_CANCELA,@CAN_TOT,@IMP_TOT1,@IMP_TOT2,@IMP_TOT3,@IMP_TOT4,@DES_TOT,@DES_FIN,@TOT_IND,@OBS_COND,@CVE_OBS,@NUM_ALMA,@ACT_CXP,@ACT_COI,@ENLAZADO,@TIP_DOC_E,@NUM_MONED,@TIPCAMB,@NUM_PAGOS,@FECHAELAB,@SERIE,@FOLIO,@CTLPOL,@ESCFD,@CONTADO,@BLOQ,@DES_FIN_PORC,@DES_TOT_PORC,@IMPORTE,@TIP_DOC_ANT,@DOC_ANT,@TIP_DOC_SIG,@DOC_SIG,@FORMAENVIO) ", CommandType.Text) > 0;
                // agregar los campos libres
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@CVE_DOC", recepcion.CVE_DOC);
                var     resultcl = conexion.baseDatos.EjecutarSinConsulta(" insert into COMPR_CLIB{0}(CLAVE_DOC) values(@CVE_DOC); ", CommandType.Text) > 0;
                decimal cant_total, imp1, imp2, imp3, imp4, total, desc, descind, desfin;
                var     bpartidas = new RNPartidasRecepcion().InsertarPartidas(partidas, cveDoc, folio, lotes, numEmpresa, out cant_total, out imp1, out imp2, out imp3, out imp4, out total, out desc, out descind, out desfin);
                conexion.baseDatos.LimpiarParametros();
                conexion.baseDatos.AgregarParametro("@IMP_TOT1", imp1);
                conexion.baseDatos.AgregarParametro("@IMP_TOT2", imp2);
                conexion.baseDatos.AgregarParametro("@IMP_TOT3", imp3);
                conexion.baseDatos.AgregarParametro("@IMP_TOT4", imp4);
                conexion.baseDatos.AgregarParametro("@IMPORTE", total);
                conexion.baseDatos.AgregarParametro("@CVE_DOC", cveDoc);
                result = conexion.baseDatos.EjecutarSinConsulta("update COMPR{0} set  IMP_TOT1=@IMP_TOT1 ,IMP_TOT2=@IMP_TOT2,IMP_TOT3=@IMP_TOT3,IMP_TOT4=@IMP_TOT4,IMPORTE=@IMPORTE " +
                                                                "where CVE_DOC = @CVE_DOC", CommandType.Text) > 0;



                return(recepcion);
            } catch (Exception e)
            {
                MessageBox.Show("Error al generar la recepción:  " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                partidas = new List <RNPartidasRecepcion>();
                return(recepcion);
            }
        }