diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 5c98d9754..ce6cb92d0 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1899,7 +1899,8 @@ Public Class ClsVentas End Function #Region " PROMOCIONES " - Public Function GetPromociones(CvePromocion As Integer, Fecha As String, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer, CveSubProyecto As Integer) As Boolean + Public Function GetPromociones(CvePromocion As Integer, Fecha As String, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer, + CveSubProyecto As Integer, Optional CveMarca As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesGet") @@ -1911,6 +1912,7 @@ Public Class ClsVentas .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -1922,7 +1924,9 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String) As Integer + Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, + CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String, + Optional CveMarca As Integer = -1) As Integer Dim Retorno = -1 DataAdapter("PA_Vta_PromocionesAdd") @@ -1939,6 +1943,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@TipoAplicacion", SqlDbType.VarChar).Value = TipoAplicacion + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@CvePromocion", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -1951,7 +1956,8 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdatePromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CvePromocion As Integer, CveSubProyecto As Integer) As Boolean + Public Function UpdatePromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, + CveMoneda As Integer, CveUsuario As Integer, CvePromocion As Integer, CveSubProyecto As Integer, Optional CveMarca As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesUpdate") @@ -1967,6 +1973,7 @@ Public Class ClsVentas .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CvePromocion", SqlDbType.Float).Value = CvePromocion .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -2043,7 +2050,7 @@ Public Class ClsVentas Public Function AddPromocionesDetalle(CvePromocion As Integer, CvePS As Integer, TipoPromocion As Integer, Promocion As Double, PUAnterior As Double, PUPromocion As Double, AplicaRestriccion As Boolean, AplicaLunes As Boolean, AplicaMartes As Boolean, AplicaMiercoles As Boolean, AplicaJueves As Boolean, AplicaViernes As Boolean, AplicaSabado As Boolean, AplicaDomingo As Boolean, HoraInicio As DateTime, HoraFin As DateTime, Optional CantidadMinima As Integer = 1, - Optional CveClasificacion As Integer = -1) As Boolean + Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleAdd") @@ -2067,6 +2074,7 @@ Public Class ClsVentas .Add("@HoraFin", SqlDbType.DateTime).Value = HoraFin .Add("@CantidadMinima", SqlDbType.Int).Value = CantidadMinima .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveRinTamaño", SqlDbType.Int).Value = CveRinTamaño End With Try @@ -2081,7 +2089,7 @@ Public Class ClsVentas Public Function UpdatePromocionesDetalle(CvePromocionDetalle As Integer, CvePromocion As Integer, CvePS As Integer, TipoPromocion As Integer, Promocion As Double, PUAnterior As Double, PUPromocion As Double, AplicaRestriccion As Boolean, AplicaLunes As Boolean, AplicaMartes As Boolean, AplicaMiercoles As Boolean, AplicaJueves As Boolean, AplicaViernes As Boolean, AplicaSabado As Boolean, AplicaDomingo As Boolean, HoraInicio As DateTime, HoraFin As DateTime, - Optional CantidadMinima As Integer = 1, Optional CveClasificacion As Integer = -1) As Boolean + Optional CantidadMinima As Integer = 1, Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleUpdate") @@ -2106,6 +2114,7 @@ Public Class ClsVentas .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle .Add("@CantidadMinima", SqlDbType.Int).Value = CantidadMinima .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveRinTamaño", SqlDbType.Int).Value = CveRinTamaño End With Try @@ -4290,7 +4299,7 @@ Public Class ClsVentas End Try Return retorno End Function - Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer) As Boolean + Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresAdd", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters @@ -4300,6 +4309,7 @@ Public Class ClsVentas .Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad .Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup End With Try SqlAdapter.Fill(Data) @@ -4338,7 +4348,7 @@ Public Class ClsVentas Return retorno End Function Public Function UpdateMetasVendedores(CveMeta As Integer, CveVendedor As Integer, MesAño As String, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, - CveClasificacion As Integer) As Boolean + CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresUpdate", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters @@ -4349,6 +4359,7 @@ Public Class ClsVentas .Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad .Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/MyHub.vb b/App_Code/MyHub.vb index 192de4c25..133da54e7 100644 --- a/App_Code/MyHub.vb +++ b/App_Code/MyHub.vb @@ -76,7 +76,6 @@ Public Class MyhubUserIdProvider Private Function IUserIdProvider_GetUserId(request As IRequest) As String Implements IUserIdProvider.GetUserId Dim userId = Decripta(request.User.Identity.Name) 'MyCustomUserClass.FindUserId(request.User.Identity.Name) - GuardaLog(String.Format("userId:{0}", userId)) Return userId.ToString() End Function End Class \ No newline at end of file diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index be1ff3fcd..720b39b81 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -33,8 +33,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState If Not GetEventos(CveUsuario, CveEmpresa, FI, FF) Then 'Convierte el objeto de Eventos en JSON - Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer - Dim sJSON As String = oSerializer.Serialize(events) + 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer + Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) context.Response.Write(sJSON) End If diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index 600e75669..f8a206eed 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -363,7 +363,7 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState strBody.Append("") End If strBody.Append("") - strBody.Append("") + strBody.AppendFormat("", Row("Liga")) strBody.Append("") strBody.Append("") strBody.Append("") diff --git a/Contabilidad/ContabilizacionCompras.aspx b/Contabilidad/ContabilizacionCompras.aspx index 0d1df40eb..cf38a955a 100644 --- a/Contabilidad/ContabilizacionCompras.aspx +++ b/Contabilidad/ContabilizacionCompras.aspx @@ -129,7 +129,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -249,7 +249,7 @@ - + @@ -345,7 +345,7 @@ - + @@ -354,7 +354,7 @@ - + @@ -435,7 +435,7 @@ - + @@ -444,7 +444,7 @@ - + diff --git a/Contabilidad/ContabilizacionCompras.aspx.cs b/Contabilidad/ContabilizacionCompras.aspx.cs index 77c08b249..ec8ae0aba 100644 --- a/Contabilidad/ContabilizacionCompras.aspx.cs +++ b/Contabilidad/ContabilizacionCompras.aspx.cs @@ -42,7 +42,7 @@ public partial class Contabilidad_ContabilizacionCompras : ClsPaginas TienePermisoEditar = false; DdlProveedores.setEsWebService(true); DdlProveedores.Attributes.Add("data-metodo", "getproveedores"); - if (UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.TipoContabilidad == 2 && UsuarioActual.Empresa.UsaContabilidad) { TienePermisoEditar = false; ClsContPAQi ObjCont = new ClsContPAQi(UsuarioActual.Empresa); @@ -65,23 +65,27 @@ public partial class Contabilidad_ContabilizacionCompras : ClsPaginas txtFechaF.Text = DateTime.Now.ToShortDateString(); //CargaDatos(); + + } - if (UsuarioActual.CveRol == 1 || UsuarioActual.CveUsuario == 17 || UsuarioActual.CveUsuario == 171 || UsuarioActual.TienePermisoProceso(221)) - { - TienePermisoEditar = true; - TienePermisoVerPoliza = true; - } - } - else + if (UsuarioActual.CveRol == 1 || UsuarioActual.CveUsuario == 17 || UsuarioActual.CveUsuario == 171 || UsuarioActual.TienePermisoProceso(221)) { - Alert("Este módulo requiere el uso de Contabilidad.", ModExtensiones.TipoMensaje.MsgAdvertencia); - // BtnConsultar.Enabled = false; - BtnContabilizarCompras.Enabled = false; - BtnContabilizarPagos.Enabled = false; - BtnContabilizarAnticipos.Enabled = false; - BtnContabilizarAmortizaciones.Enabled = false; + TienePermisoEditar = true; + TienePermisoVerPoliza = true; } + txtFechaI.Text = DateTime.Now.ToShortDateString(); + txtFechaF.Text = DateTime.Now.ToShortDateString(); + //else + //{ + // Alert("Este módulo requiere el uso de Contabilidad.", ModExtensiones.TipoMensaje.MsgAdvertencia); + // // BtnConsultar.Enabled = false; + // BtnContabilizarCompras.Enabled = false; + // BtnContabilizarPagos.Enabled = false; + // BtnContabilizarAnticipos.Enabled = false; + // BtnContabilizarAmortizaciones.Enabled = false; + //} + } BtnConsultar.Click += new EventHandler(this.BtnConsultar_Click); @@ -310,6 +314,7 @@ public partial class Contabilidad_ContabilizacionCompras : ClsPaginas if (e.Row.RowType == DataControlRowType.DataRow) { int cuenta = e.Row.DataKey("IdCtaContable").ToString().ToEntero(); + int cvecuenta = e.Row.DataKey("CveCuenta").ToString().ToEntero(); int CveConcepto = e.Row.DBCampo("CveConceptoContable").ToEntero(); if (CveConcepto.Contiene(5, 6, 14, 16, 17, 19, 206, 22, 23, 25, 26, 18, 60, 183, 184, 185, 186 ,205, 240, 243, 244, 248, 249,15,22,248,249,237)) @@ -337,21 +342,37 @@ public partial class Contabilidad_ContabilizacionCompras : ClsPaginas e.Row.FCHyperLink("HplC").NavigateUrl = string.Format("/OC/OC.aspx?OC={0}", e.Row.DBCampo("CveOC")); } - - if (cuenta > 0) + if (UsuarioActual.Empresa.TipoContabilidad == 1) // conta SIG { - DataRow dr = DTmpC.FiltroPrimero(String.Format("Id = {0}", cuenta)); + if (cvecuenta == 0) + { + e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; + ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").Visible = false; + } - if (dr != null) e.Row.Cells[3].Text = string.Format("{0}
{1}", dr["CuentaFormato"], dr["Nombre"]); } else { - e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; + if (UsuarioActual.Empresa.TipoContabilidad == 2) // conta Contpaq + { - ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").Enabled = false; - ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").ToolTip = "Hay conceptos sin cuenta asignada"; + if (cuenta > 0) + { + DataRow dr = DTmpC.FiltroPrimero(String.Format("Id = {0}", cuenta)); + + if (dr != null) e.Row.Cells[3].Text = string.Format("{0}
{1}", dr["CuentaFormato"], dr["Nombre"]); + } + else + { + e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; + + ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").Enabled = false; + ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").ToolTip = "Hay conceptos sin cuenta asignada"; + } + } } + if (Convert.ToDecimal(e.Row.DataKey("Cargo").ToString()) == 0) e.Row.Cells[4].Text = ""; if (Convert.ToDecimal(e.Row.DataKey("Abono").ToString()) == 0) e.Row.Cells[5].Text = ""; diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb index c611b6e05..8a36b2419 100644 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ b/Inventarios/RecepcionEntrega.aspx.vb @@ -1884,114 +1884,117 @@ Partial Class Inventarios_RecepcionEntrega 'DEVOLUCION REMISION If TipoMovimiento = 2 And TipoDocto = "Rem" Then - ConceptoMovimiento = 8 - Almacen1 = CveAlmacenTraspasoDestino - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If + ConceptoMovimiento = 8 + Almacen1 = CveAlmacenTraspasoDestino + CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero + End If - 'CANCELACION DE DEVOLUCION - If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then - ConceptoMovimiento = 3 - Almacen1 = DdlAlmacen.SelectedValue.ToEntero - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If + 'CANCELACION DE DEVOLUCION + If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then + ConceptoMovimiento = 3 + Almacen1 = DdlAlmacen.SelectedValue.ToEntero + CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero + End If - CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, - CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") - Folio = ObjInventario.Folio + CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, + CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") + Folio = ObjInventario.Folio - 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) - 'If Not (CveContrato > 0 And CveAlmacenTraspasoDestino > 0) Then - If CveMovimiento > 0 Then + 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) + 'If Not (CveContrato > 0 And CveAlmacenTraspasoDestino > 0) Then + If CveMovimiento > 0 Then - 'SACA LO DE TRASPASOS - APARTADO - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoEntrada").ToString.ToEntero - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count = 0 Then + 'SACA LO DE TRASPASOS - APARTADO + For Each Dr1 As DataRow In DtTraspasos.Rows + CveMovimientoSalida = Dr1("CveMovimientoEntrada").ToString.ToEntero + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + If ObjInventario.DtResultados.Rows.Count = 0 Then + ErrorMovInv = True + TextoError = "Ocurrió un error, no se tienen registros que ingresar" + Exit Sub + End If + + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then ErrorMovInv = True - TextoError = "Ocurrió un error, no se tienen registros que ingresar" - Exit Sub + TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." + Exit For + End If + Next + Else + ErrorMovInv = True + TextoError = "Ocurrió un error al obtener los registros" + End If + If ErrorMovInv Then Exit For + Next + + 'ES EL MOVIMIENTO PRINCIPAL + CantidadPendiente = 0 + Dim Cont As Integer = 0 + For Each Dr As DataRow In DtDatos.Rows + CantidadPendiente = Dr("CantidadGV").ToString.ToDecimal - Dr("CantidadTraspaso").ToString.ToDecimal + If CantidadPendiente > 0 Then + Dim PU As Decimal = 0 + + 'SI FUE POR SERIELOTE + DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) + DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) + If DtDetalle.Rows.Count > 0 Then + For Each Dr1 As DataRow In DtDetalle.Rows + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." + Exit For + End If + Next + ElseIf DtDetalleLote.Rows.Count > 0 Then + For Each Dr1 As DataRow In DtDetalleLote.Rows + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." + Exit For + End If + Next + Else + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal End If - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." + Exit For + End If + End If + If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then + For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont}").Rows + If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." + TextoError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." Exit For End If Next End If - If ErrorMovInv Then Exit For - Next - - 'ES EL MOVIMIENTO PRINCIPAL - CantidadPendiente = 0 - Dim Cont As Integer = 0 - For Each Dr As DataRow In DtDatos.Rows - CantidadPendiente = Dr("CantidadGV").ToString.ToDecimal - Dr("CantidadTraspaso").ToString.ToDecimal - If CantidadPendiente > 0 Then - Dim PU As Decimal = 0 - - 'SI FUE POR SERIELOTE - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - If DtDetalle.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalle.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - ElseIf DtDetalleLote.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalleLote.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - Else - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." - Exit For - End If - End If - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont}").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If - Cont += 1 - End If - Next - Else - ErrorMovInv = True - End If + Cont += 1 + End If + Next + Else + ErrorMovInv = True End If - 'End If + End If + 'End If - 'ENTRADA POR TRASPASO CUANDO ES REMISION - If Not ErrorMovInv Then + 'ENTRADA POR TRASPASO CUANDO ES REMISION + If Not ErrorMovInv Then If CveAlmacenTraspasoDestino > 0 AndAlso Not (TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1) Then ' TRASPASO CUANDO ES REMISION CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G8") @@ -2001,7 +2004,7 @@ Partial Class Inventarios_RecepcionEntrega TextoError = "No se pudo generar el movimiento de entrada correctamente" ErrorMovInv = True Else - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then ErrorMovInv = True @@ -2009,6 +2012,9 @@ Partial Class Inventarios_RecepcionEntrega Exit For End If Next + Else + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" End If End If diff --git a/LogIn.aspx b/LogIn.aspx index 48b8f0570..72432698d 100644 --- a/LogIn.aspx +++ b/LogIn.aspx @@ -129,6 +129,7 @@ <%: Scripts.Render("~/Metronic/assets/global/scripts/JS") %> - +