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);
 }
Beispiel #2
0
        public RNOrdenRecepcion ObtenerOrdenCompra(string cveOrden, string cveDoc, int folio, int numEmpresa)
        {
            RNOrdenRecepcion recepcion = new RNOrdenRecepcion();
            RNConexion       conexion  = new RNConexion(numEmpresa);

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

            foreach (DataRow row in result.Rows)
            {
                recepcion.CVE_DOC       = cveDoc;
                recepcion.CVE_CLPV      = row["CVE_CLPV"].ToString();
                recepcion.STATUS        = row["STATUS"].ToString();
                recepcion.SU_REFER      = row["SU_REFER"].ToString();
                recepcion.FECHA_DOC     = DateTime.Today;
                recepcion.FECHA_REC     = DateTime.Today;
                recepcion.FECHA_PAG     = DateTime.Today;
                recepcion.FECHA_CANCELA = null;
                recepcion.CAN_TOT       = Convert.ToDecimal(row["CAN_TOT"].ToString());
                recepcion.IMP_TOT1      = Convert.ToDecimal(row["IMP_TOT1"].ToString());
                recepcion.IMP_TOT2      = Convert.ToDecimal(row["IMP_TOT2"].ToString());
                recepcion.IMP_TOT3      = Convert.ToDecimal(row["IMP_TOT3"].ToString());
                recepcion.IMP_TOT4      = Convert.ToDecimal(row["IMP_TOT4"].ToString());
                recepcion.TOT_IND       = Convert.ToDecimal(row["TOT_IND"].ToString());
                recepcion.DES_TOT       = Convert.ToDecimal(row["DES_TOT"].ToString());
                recepcion.DES_FIN       = Convert.ToDecimal(row["DES_FIN"].ToString());
                recepcion.NUM_ALMA      = Convert.ToInt32(row["NUM_ALMA"].ToString());
                recepcion.ACT_CXP       = "S";
                recepcion.ACT_COI       = "N";
                recepcion.NUM_MONED     = Convert.ToInt32(row["NUM_MONED"].ToString());
                recepcion.TIPCAMB       = Convert.ToDecimal(row["TIPCAMB"].ToString());
                recepcion.NUM_PAGOS     = 1;
                recepcion.ENLAZADO      = row["ENLAZADO"].ToString();
                recepcion.TIP_DOC_E     = row["TIP_DOC_E"].ToString();
                recepcion.FECHAELAB     = DateTime.Today;
                recepcion.SERIE         = "";
                recepcion.FOLIO         = folio;
                recepcion.CTLPOL        = 0;
                recepcion.ESCFD         = "N";
                recepcion.CONTADO       = "N";
                recepcion.BLOQ          = "N";
                recepcion.DES_FIN_PORC  = 0.0M;
                recepcion.DES_TOT_PORC  = 0.0M;
                recepcion.IMPORTE       = Convert.ToDecimal(row["IMPORTE"].ToString());
                recepcion.TIP_DOC_ANT   = "o";
                recepcion.DOC_ANT       = cveOrden;
                recepcion.TIP_DOC_SIG   = null;
                recepcion.DOC_SIG       = null;
                recepcion.FORMAENVIO    = "I";
            } // actualizar la orden de compra
            conexion.baseDatos.LimpiarParametros();
            conexion.baseDatos.AgregarParametro("@cveRecepcion", cveDoc);
            conexion.baseDatos.AgregarParametro("@cveOrden", cveOrden);
            var resultcl = conexion.baseDatos.EjecutarSinConsulta("UPDATE compo{0} c set c.doc_sig = @cveRecepcion, c.tip_doc_sig = 'r', c.ENLAZADO = 'T',c.TIP_DOC_E='r' where c.cve_doc = @cveOrden", CommandType.Text) > 0;

            return(recepcion);
        }
Beispiel #3
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);
        }
Beispiel #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 RegistrarMovInveRecepcion(RNPartidasRecepcion partida, RNOrdenRecepcion 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", 1);
            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", partida.FACTCONV);
            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);
        }
Beispiel #6
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);
            }
        }
        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);
            }
        }
Beispiel #8
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);
            }
        }
Beispiel #9
0
        // enviar en out list<RNPartidasRecepcion>
        public RNOrdenRecepcion GenerarRecepcion(string cveOrden, string cveDoc, int folio, int numEmpresa, out List <RNPartidasRecepcion> partidas)
        {
            RNOrdenRecepcion recepcion = new RNOrdenRecepcion().ObtenerOrdenCompra(cveOrden, cveDoc, folio, numEmpresa);

            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", recepcion.CVE_DOC);
                conexion.baseDatos.AgregarParametro("@CVE_CLPV", recepcion.CVE_CLPV);
                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", recepcion.IMP_TOT1);
                conexion.baseDatos.AgregarParametro("@IMP_TOT2", recepcion.IMP_TOT2);
                conexion.baseDatos.AgregarParametro("@IMP_TOT3", recepcion.IMP_TOT3);
                conexion.baseDatos.AgregarParametro("@IMP_TOT4", recepcion.IMP_TOT4);
                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", recepcion.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", recepcion.IMPORTE);
                conexion.baseDatos.AgregarParametro("@TIP_DOC_ANT", recepcion.TIP_DOC_ANT);
                conexion.baseDatos.AgregarParametro("@DOC_ANT", recepcion.DOC_ANT);
                conexion.baseDatos.AgregarParametro("@TIP_DOC_SIG", recepcion.TIP_DOC_SIG);
                conexion.baseDatos.AgregarParametro("@DOC_SIG", recepcion.DOC_SIG);
                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;
                //agregar las partidas
                partidas = new RNPartidasRecepcion().GenerarPartidas(cveOrden, cveDoc, folio, numEmpresa);
                return(recepcion);
                //agregar observaciones
            } catch (Exception e)
            {
                MessageBox.Show("Error al generar la recepción:  " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                partidas = new List <RNPartidasRecepcion>();
                return(recepcion);
            }
        }