From 5b84211e8f3d27547610ef9cd1862be12ce11167 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:34:56 -0700 Subject: [PATCH 01/22] - GlobalDTAlmacen --- App_Code/Modelos.vb | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 1a6d06c81..6171e138d 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -7505,17 +7505,28 @@ Namespace Modelos End Property Property GlobalDTAlmacen(CveEmpresa As Integer) As DataTable Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAlmacen"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAlmacen = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAlmacen = DirectCast(HttpContext.Current.Application("GlobalDTAlmacen"), DataTable) + Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjUsr As New ClsInventarios + If ObjUsr.GetAlmacenes(-1, -1, CveEmpresa, -1) Then HttpContext.Current.Application(AppNombre) = ObjUsr.DtResultados + ObjUsr.Dispose() End If + Dim Str As New StringBuilder + Str.Append("1=1 AND ") + If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + ' If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) + If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTAlmacen = Dv.ToTable + Dv.Dispose() End Get Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAlmacen") = value + Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value End Set End Property Property GlobalDTAlmacenUsuarios(CveUsuario As Integer, CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = 1) As DataTable From b917943eb63e77593868131c4b51030e7d2ebee7 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:35:16 -0700 Subject: [PATCH 02/22] -- sin cambios --- App_Code/ClsVentas.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index ff7e79fa5..474a9d366 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1285,6 +1285,8 @@ Public Class ClsVentas With SqlAdapter.SelectCommand.Parameters .Add("@EstatusDevolucion", SqlDbType.TinyInt).Value = EstatusDevolucion .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + '.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + '.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try From 16bc957806bf31249b2a28b23f85c816288874a8 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:36:19 -0700 Subject: [PATCH 03/22] - parametro de kardex horizontal --- App_Code/ClsInventarios.vb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index de4c0e719..f7709355b 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1308,7 +1308,11 @@ Public Class ClsInventarios If Ex1.Message.Contains("50019") Then Me.OnError(" El producto no tiene existencia.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Else - Me.OnError("Ocurrió un error al guardar los detalles del movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + If Ex1.Message.Contains("50021") Then + Me.OnError(" El producto ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + Me.OnError("Ocurrió un error al guardar los detalles del movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If End If Catch ex As Exception @@ -1480,7 +1484,9 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetKardexAlmacenHorizontal(CvePS As Integer, FechaFin As Date, CveAlmacen As Integer, CveUnidadMedida As Integer, CveProveedor As Integer, CveTipoAlmacen As Integer, IncluyeTransitorios As Integer, CveClasificacion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CondicionExistencias As Integer = 0, Optional Orden As Integer = -1, Optional Marcas As String = "-1") As Boolean + Public Function GetKardexAlmacenHorizontal(CvePS As Integer, FechaFin As Date, CveAlmacen As Integer, CveUnidadMedida As Integer, CveProveedor As Integer, CveTipoAlmacen As Integer, + IncluyeTransitorios As Integer, CveClasificacion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CondicionExistencias As Integer = 0, + Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional @IncluyeProyectado As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_KardexAlmacenHorizontalGet") @@ -1500,6 +1506,7 @@ Public Class ClsInventarios .Add("@ExistenciasCondicion", SqlDbType.Int).Value = CondicionExistencias .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@Marcas", SqlDbType.VarChar).Value = Marcas + .Add("@IncluyeProyectado", SqlDbType.TinyInt).Value = @IncluyeProyectado End With Try From efa7d996b54bcfb00db489539eeb85756e509386 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:37:01 -0700 Subject: [PATCH 04/22] - mejorar el filtro --- Ashx/SIGWeb.ashx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 7b397f53f..eb6cd7d95 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -509,7 +509,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'End If 'ObjClientes.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable) '.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros(String.Format("NombreComercial like '%{0}%' OR Nombre like '%{0}%' ", Name)) End If @@ -557,7 +557,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ' DtRetorno = ObjProveedores.DtResultados 'End If 'ObjProveedores.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable) '.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name)) End If From 0c5972c94e95c02d6b24a1a97990779f4fb4dba8 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:38:18 -0700 Subject: [PATCH 05/22] - cambios en concepto de registro. --- Compras/Compras.aspx.vb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6109d4080..625483f7f 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -5384,6 +5384,7 @@ Partial Class Compras_Compras 'P R E P O L I Z A S Dim CveConceptoAfectacion As Integer = 5 'Proveedores + Dim CveConceptoOriginal As Integer If CveTipoConcepto = 2 Then CveConceptoAfectacion = 305 'cuando es acreedor If CveMoneda <> 1 Then Select Case CveConceptoAfectacion @@ -5781,7 +5782,7 @@ Partial Class Compras_Compras Dim CveSubProyectoInsertar As Integer = -1 - Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero + Dim ConceptoContable As Integer = Row("CveConcepto").ToString.ToEntero Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False) Dim importeMovimiento As Decimal = 0 Dim IdCtaContable As Integer = 0 @@ -5791,7 +5792,7 @@ Partial Class Compras_Compras Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, 1, -1) Dim Referencia As String = $"{TxtSerie.Text}-{TxtFolio.Text}" ' concatenation interpolation Dim PorcentajeImpuesto As Decimal = 0 - + CveConceptoOriginal = ConceptoContable Select Case ConceptoContable @@ -7185,7 +7186,7 @@ Partial Class Compras_Compras importeMovimiento = importeMovimiento.Abs.RoundSQL() importeMN = importeMovimiento If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=0, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=0, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto) Then ErrorPrepoliza = True Exit For End If @@ -7631,8 +7632,8 @@ Partial Class Compras_Compras If ErrorPrepoliza Then Exit For End If - ', 305, 306, 311 - If importeMovimiento <> 0 Or (ConceptoContable.Contiene(5) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Fac", "Ant")) Or (ConceptoContable.Contiene(18) AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not GuardoConcepto18) Then + '5, 305, 306, 311 + If importeMovimiento <> 0 Or (CveConceptoOriginal = 5 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Fac", "Ant")) Or (ConceptoContable.Contiene(18) AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not GuardoConcepto18) Then 'Conta ContPAQ If IdCtaContable = 0 Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) @@ -15489,11 +15490,11 @@ Partial Class Compras_Compras 'If DdlOCVinculaInv.SelectedValue.ToEntero = 237 And Not CveFlete > 0 Then Alert("Necesita vincular un flete si selecciona Factura de Flete", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub - If UsuarioActual.CveEmpresa = 119 And DdlTipoComprobante.SelectedValue = "Fac" Then - If Not VerificarProductosCompraConOC() Then - Exit Sub - End If - End If + 'If UsuarioActual.CveEmpresa = 119 And DdlTipoComprobante.SelectedValue = "Fac" Then + ' If Not VerificarProductosCompraConOC() Then + ' Exit Sub + ' End If + 'End If Dim SubTotalGV = 0.0D Dim Amortizacion As Decimal = TmpDT.SUMD("Total") From c3a57fa374dc09ee3142d25e3ee25a0cd08e78d4 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Oct 2020 21:39:06 -0700 Subject: [PATCH 06/22] -- cambio en globaldT --- Inventarios/CatAlmacenes.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Inventarios/CatAlmacenes.aspx.vb b/Inventarios/CatAlmacenes.aspx.vb index a0b990035..21c4e8154 100644 --- a/Inventarios/CatAlmacenes.aspx.vb +++ b/Inventarios/CatAlmacenes.aspx.vb @@ -217,7 +217,7 @@ Partial Class Inventarios_CatAlmacenes GlobalDTAlmacen(UsuarioActual.CveEmpresa) = Nothing 'Dim ObjAlmacen As New ClsInventarios 'If ObjAlmacen.GetAlmacenes(-1, -1, -1, -1) Then - ' GlobalDTAlmacen(-1) = ObjAlmacen.DtResultados + ' Application("GlobalDTAlmacen") = ObjAlmacen.DtResultados 'End If 'ObjAlmacen.Dispose() End Sub From 897b04e407edd7d3825a1df2c848b13785b86230 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Oct 2020 13:07:29 -0700 Subject: [PATCH 07/22] Validacion de autorizaciones, limitar remisiones de nota de credito --- App_Code/ClsClientes.vb | 45 +++++++++++++++++++++-------------------- Ventas/Ventas.aspx | 8 ++++---- Ventas/Ventas.aspx.vb | 21 ++++++++++++------- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 1a081cf99..a4eb2d97a 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -2021,7 +2021,7 @@ Public Class ClsClientes Return Retorno End Function - Public Function UpdateEstatusPedido(CveVenta As Integer, CveEstatusFactura As Integer, Dias As Integer, CveUsuario As Integer) As Boolean + Public Function UpdateEstatusPedido(CveVenta As Integer, CveEstatusFactura As Integer, Dias As Integer, CveUsuario As Integer, Optional CveRemision As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ClienteVentasPedidoEstatusUpdate") With SqlAdapter.SelectCommand.Parameters @@ -2029,6 +2029,7 @@ Public Class ClsClientes .Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura .Add("@Dias", SqlDbType.Int).Value = Dias .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveRemision", SqlDbType.Int).Value = CveRemision End With Try SqlAdapter.Fill(Data) @@ -2037,28 +2038,28 @@ Public Class ClsClientes OnError("Ocurrió un error al actualizar el pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - 'Public Function UpdateFechaPedido(CveVenta As Integer, DiasCredito As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_Vta_ClienteVentasPedidoFechaUpdate") - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - ' .Add("@DiasCredito", SqlDbType.Int).Value = DiasCredito - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al actualizar la fecha del pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - ' Return Retorno - 'End Function - - - + End Function + + 'Public Function UpdateFechaPedido(CveVenta As Integer, DiasCredito As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Vta_ClienteVentasPedidoFechaUpdate") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + ' .Add("@DiasCredito", SqlDbType.Int).Value = DiasCredito + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar la fecha del pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + ' Return Retorno + 'End Function + + + #End Region - + #Region "A P L I C A C I O N" Public Function AddClienteApp(Cliente As MCliente) As Boolean Dim Retorno As Boolean = False diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 5ac9815d2..32824988f 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6235,8 +6235,8 @@
- - +<%-- + --%>
@@ -6293,14 +6293,14 @@ - + -
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8df466012..e0d31aa62 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2160,6 +2160,7 @@ Partial Class Ventas 'Carga Venta If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero() > 0 Then ViewState("CveVenta") = Request("CveVenta") + If CargaVenta() Then 'DdlSucursal.Enabled = False @@ -2694,7 +2695,7 @@ Partial Class Ventas TrPedido.Visible = False ' TrKilometrajeTxt.Visible = True End If - LtlTareaNueva.Text = String.Format(" Tarea", CveVenta) + LtlTareaNueva.Text = String.Format(" Tarea", CveVenta) End If @@ -5415,7 +5416,7 @@ Partial Class Ventas DdlVentaUsado.DataBind() - DdlVentaUsado.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlVentaUsado.Items.Insert(0, New ListItem("No Aplica", "-1")) UpModalRemisionesNC.Update() End If @@ -10190,7 +10191,7 @@ Partial Class Ventas 'PedidoA' If ObjVentas.CveVenta > 0 And CvePedidoA > 0 And DdlTipoComprobante.SelectedValue.Contiene("Rem") Then - If Not ObjCliente.UpdateEstatusPedido(CvePedidoA, 18, -1, UsuarioActual.CveUsuario) Then + If Not ObjCliente.UpdateEstatusPedido(CvePedidoA, 18, -1, UsuarioActual.CveUsuario, CveRemision:=factura.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA") End If End If @@ -23116,13 +23117,19 @@ Partial Class Ventas GvRemisionesNCBon.DataBind() If CveVentaUsado > 0 Then + DivSMU.Visible = True Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa) - LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()) + Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() + LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados) Else - LtlSMU.Text = String.Format("{0:N2}", 0) + DivSMU.Visible = False + HdnSaldoMaximoUsados.Value = "0" + LtlSMU.Text = "0" End If UpModalRemisionesNC.Update() + UpDescNC.Update() End Sub Private Sub CargaDescRNC() Dim DtNC As DataTable = Nothing @@ -23318,8 +23325,8 @@ Partial Class Ventas End Sub Protected Sub GvRemisionesNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNC.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaTotalRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") - e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadRNCMasivo({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") + e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") + e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") End If End Sub From 398ad6b07f6a7fde22bafb36358533700b6233e1 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Oct 2020 13:07:52 -0700 Subject: [PATCH 08/22] validacion de folios de garantia --- Inventarios/RecepcionUsados.aspx.vb | 80 ++++++++++++++++++++++++++++- Ventas/PV.aspx.vb | 79 ++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 1 deletion(-) diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index f6d0d68aa..95c54e78b 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2616,11 +2616,71 @@ Partial Class Inventarios_RecepcionUsados If ObjAcumuladores.GetNuevoConsecutivoFolio(DdlFolioGarantia.SelectedValue.ToEntero) Then Dim resultado As String = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo") TxtConsecutivoAjuste.Text = (resultado.ToEntero + 1).ToString - UpAjuste.Update() End If ObjAcumuladores.Dispose() + + Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero()) + + If Not FolioGarantia.Valido Then + Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia) + End If + End Sub + Private Function ValidaFolioGarantia(CvePS As Integer, CveFolioGarantia As Integer) As MFolioGarantiaMensaje + Dim Retorno As New MFolioGarantiaMensaje + + Dim Valido As Boolean = False + Dim TipoFolio As String = "" + Dim ListaClasificacionesPermitidas As New List(Of Integer) + + Dim ObjAcumuladores As New ClsAcumuladores + If ObjAcumuladores.FoliosGarantiaGet(CveFolioGarantia, UsuarioActual.CveEmpresa, Area:=-1) AndAlso ObjAcumuladores.DtResultados.Rows.Count > 0 Then + Dim Row As DataRow = ObjAcumuladores.DtResultados.Rows(0) + TipoFolio = Row("tipoFolio").ToString().ToUpper() + End If + ObjAcumuladores.Dispose() + + Dim CveClasificacionPS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion").ToEntero() + Dim ClasificacionPS As String = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionPS).FiltroPrimeroValor("Clasificacion").ToString() + Select Case TipoFolio + Case "GENERAL" + '20520 ACUM. AUTOMOTRIZ + '20522 ACUM. ESPECIALES + '20513 ACUM. ESTANDAR + '20521 ACUM. PESADO + '20512 ACUM. PREMIUM + '20514 ACUM. VALUE + '20229 Acumulador + ListaClasificacionesPermitidas.Add(20520) 'ACUM. AUTOMOTRIZ + ListaClasificacionesPermitidas.Add(20522) 'ACUM. ESPECIALES + ListaClasificacionesPermitidas.Add(20513) 'ACUM. ESTANDAR + ListaClasificacionesPermitidas.Add(20521) 'ACUM. PESADO + ListaClasificacionesPermitidas.Add(20512) 'ACUM. PREMIUM + ListaClasificacionesPermitidas.Add(20514) 'ACUM. VALUE + ListaClasificacionesPermitidas.Add(20229) 'Acumulador + Case "OPTIMA" + '20511 ACUM. OPTIMA + ListaClasificacionesPermitidas.Add(20511) 'ACUM. OPTIMA + Case "MOTOBATERIA" + '20517 MOTOBATERIAS + ListaClasificacionesPermitidas.Add(20517) 'MOTOBATERIAS + End Select + + If ListaClasificacionesPermitidas.Contains(CveClasificacionPS) Then + Valido = True + End If + + Retorno.CvePS = CvePS + Retorno.CveFolioGarantia = CveFolioGarantia + Retorno.CveClasificacionPS = CveClasificacionPS + Retorno.ClasificacionPS = ClasificacionPS + Retorno.TipoFolio = TipoFolio + Retorno.Valido = Valido + + Return Retorno + End Function + Protected Sub CargaTipoDeUso() DdlTipoUso.Items.Clear() DdlTipoUso.DataSource = GlobalDTAcumTiposUso.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") @@ -2767,6 +2827,14 @@ Partial Class Inventarios_RecepcionUsados Protected Sub BtnAgregarProductoAjuste_Click(sender As Object, e As EventArgs) Dim CvePS As Integer = DdlPSAjuste.SelectedValue.ToEntero + + Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(CvePS, DdlFolioGarantia.SelectedValue.ToEntero()) + + If Not FolioGarantia.Valido Then + Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim ObjPS As New ClsProductosServicios Dim CveTamaño As Integer = -1 If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then @@ -2809,4 +2877,14 @@ Partial Class Inventarios_RecepcionUsados InicializaClientes(ChkClientesTodos.Checked) End Sub + Partial Class MFolioGarantiaMensaje + Public Property CvePS As Integer + Public Property CveClasificacionPS As Integer + Public Property ClasificacionPS As String + Public Property CveFolioGarantia As Integer + Public Property TipoFolio As String + + Public Property Valido As Boolean + End Class + End Class diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index ec3ef198f..d16917935 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4671,6 +4671,15 @@ Partial Class PV RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta") End Sub Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs) + If ChkAjuste.Checked Then + Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero()) + + If Not FolioGarantia.Valido Then + Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + If AgregarPS() Then If ChkAjuste.Checked Then GuardaAjuste() AddPolizaVirtual(DdlPS.SelectedValue.ToEntero()) @@ -6511,6 +6520,12 @@ Partial Class PV UpAjuste.Update() End If ObjAcumuladores.Dispose() + + Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero()) + + If Not FolioGarantia.Valido Then + Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia) + End If End Sub #End Region @@ -6991,4 +7006,68 @@ Partial Class PV ImprimirPDF("Empresas/Grales/Formatos/Ajuste.rdlc", DtDatos, params, "Reporte de Ajuste", "PDF") End Sub + + Private Function ValidaFolioGarantia(CvePS As Integer, CveFolioGarantia As Integer) As MFolioGarantiaMensaje + Dim Retorno As New MFolioGarantiaMensaje + + Dim Valido As Boolean = False + Dim TipoFolio As String = "" + Dim ListaClasificacionesPermitidas As New List(Of Integer) + + Dim ObjAcumuladores As New ClsAcumuladores + If ObjAcumuladores.FoliosGarantiaGet(CveFolioGarantia, UsuarioActual.CveEmpresa, Area:=-1) AndAlso ObjAcumuladores.DtResultados.Rows.Count > 0 Then + Dim Row As DataRow = ObjAcumuladores.DtResultados.Rows(0) + TipoFolio = Row("tipoFolio").ToString().ToUpper() + End If + ObjAcumuladores.Dispose() + + Dim CveClasificacionPS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion").ToEntero() + Dim ClasificacionPS As String = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionPS).FiltroPrimeroValor("Clasificacion").ToString() + Select Case TipoFolio + Case "GENERAL" + '20520 ACUM. AUTOMOTRIZ + '20522 ACUM. ESPECIALES + '20513 ACUM. ESTANDAR + '20521 ACUM. PESADO + '20512 ACUM. PREMIUM + '20514 ACUM. VALUE + '20229 Acumulador + ListaClasificacionesPermitidas.Add(20520) 'ACUM. AUTOMOTRIZ + ListaClasificacionesPermitidas.Add(20522) 'ACUM. ESPECIALES + ListaClasificacionesPermitidas.Add(20513) 'ACUM. ESTANDAR + ListaClasificacionesPermitidas.Add(20521) 'ACUM. PESADO + ListaClasificacionesPermitidas.Add(20512) 'ACUM. PREMIUM + ListaClasificacionesPermitidas.Add(20514) 'ACUM. VALUE + ListaClasificacionesPermitidas.Add(20229) 'Acumulador + Case "OPTIMA" + '20511 ACUM. OPTIMA + ListaClasificacionesPermitidas.Add(20511) 'ACUM. OPTIMA + Case "MOTOBATERIA" + '20517 MOTOBATERIAS + ListaClasificacionesPermitidas.Add(20517) 'MOTOBATERIAS + End Select + + If ListaClasificacionesPermitidas.Contains(CveClasificacionPS) Then + Valido = True + End If + + Retorno.CvePS = CvePS + Retorno.CveFolioGarantia = CveFolioGarantia + Retorno.CveClasificacionPS = CveClasificacionPS + Retorno.ClasificacionPS = ClasificacionPS + Retorno.TipoFolio = TipoFolio + Retorno.Valido = Valido + + Return Retorno + End Function + + Partial Class MFolioGarantiaMensaje + Public Property CvePS As Integer + Public Property CveClasificacionPS As Integer + Public Property ClasificacionPS As String + Public Property CveFolioGarantia As Integer + Public Property TipoFolio As String + + Public Property Valido As Boolean + End Class End Class From 4ea51ad6fe77f7564108bb3b4e1b9d1c65e93864 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Oct 2020 13:08:32 -0700 Subject: [PATCH 09/22] Cancelacion de refacturaciones --- App_Code/Modelos.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 5a6c518e0..2f8750b96 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3332,7 +3332,7 @@ Namespace Modelos 'SI ES FACTURACION DE UNA REMISION CANCELAMOS, TRASPASAMOS SALDOS Y AGREGAMOS EVENTO A LA BITACORA 'NO DEBE ENTRAR SI SE ESTA CANCELANDO UNA FACTURA - If ValorMultiplicador <> -1 AndAlso (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0 Then + If ValorMultiplicador <> -1 AndAlso ((DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0) Then If Not ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then ErrorPrepoliza = True From 6781ec1feaf679c5676321be67e073d7dd4b6833 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Oct 2020 13:08:58 -0700 Subject: [PATCH 10/22] CveUsuarioModifico al cambiar permisos --- Sistemas/PopUpAddUsuario.aspx.vb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sistemas/PopUpAddUsuario.aspx.vb b/Sistemas/PopUpAddUsuario.aspx.vb index 9380667be..01376ea94 100644 --- a/Sistemas/PopUpAddUsuario.aspx.vb +++ b/Sistemas/PopUpAddUsuario.aspx.vb @@ -321,7 +321,7 @@ Partial Class Sistemas_PopUpAddUsuario If Row.DataKey("CveProcesoAcceso") <> "" Then 'checo si el permiso que tiene es del rol, de ser así, nada más actualizo los denegados If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkD").Checked OrElse Row.DataKey("Permitir") = "0" AndAlso Row.FCCheckBox("ChkD").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkD").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkD").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If @@ -329,7 +329,7 @@ Partial Class Sistemas_PopUpAddUsuario Else 'permisos que el rol, no le está otorgando, y serán únicos para el usuario If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkP").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkP").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkP").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkP").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If @@ -340,7 +340,7 @@ Partial Class Sistemas_PopUpAddUsuario If Row.DataKey("CveProcesoAcceso") <> "" Then 'checo si el permiso que tiene es del rol, de ser así, nada más actualizo los denegados If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkDenegar").Checked OrElse Row.DataKey("Permitir") = "0" AndAlso Row.FCCheckBox("ChkDenegar").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkDenegar").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkDenegar").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If @@ -348,7 +348,7 @@ Partial Class Sistemas_PopUpAddUsuario Else 'permisos que el rol, no le está otorgando, y serán únicos para el usuario If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkPermitir").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkPermitir").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkPermitir").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkPermitir").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If @@ -490,7 +490,7 @@ Partial Class Sistemas_PopUpAddUsuario If Row.DataKey("CveProcesoAcceso") <> "" Then 'checo si el permiso que tiene es del rol, de ser así, nada más actualizo los denegados If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkD").Checked OrElse Row.DataKey("Permitir") = "0" AndAlso Row.FCCheckBox("ChkD").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkD").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkD").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If @@ -498,7 +498,7 @@ Partial Class Sistemas_PopUpAddUsuario Else 'permisos que el rol, no le está otorgando, y serán únicos para el usuario If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkP").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkP").Checked = False Then - If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkP").Checked) Then + If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkP").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then HuboError = True Exit For End If From 25aad7b9735b080e6e6f82408609658068541b77 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:42:06 -0700 Subject: [PATCH 11/22] -- proyectados --- App_Code/ClsInventarios.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index f7709355b..56e51aaa3 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1486,7 +1486,7 @@ Public Class ClsInventarios End Function Public Function GetKardexAlmacenHorizontal(CvePS As Integer, FechaFin As Date, CveAlmacen As Integer, CveUnidadMedida As Integer, CveProveedor As Integer, CveTipoAlmacen As Integer, IncluyeTransitorios As Integer, CveClasificacion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CondicionExistencias As Integer = 0, - Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional @IncluyeProyectado As Integer = -1) As Boolean + Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional IncluyeProyectado As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_KardexAlmacenHorizontalGet") @@ -1506,7 +1506,7 @@ Public Class ClsInventarios .Add("@ExistenciasCondicion", SqlDbType.Int).Value = CondicionExistencias .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@Marcas", SqlDbType.VarChar).Value = Marcas - .Add("@IncluyeProyectado", SqlDbType.TinyInt).Value = @IncluyeProyectado + .Add("@IncluyeProyectado", SqlDbType.TinyInt).Value = IncluyeProyectado End With Try From 1e6833af8df8ce4b90a1bc23ba2681646e2f2358 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:42:21 -0700 Subject: [PATCH 12/22] - cveusuario, en eliminar alias --- App_Code/ClsProductosServicios.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index d64de3153..9d400ef08 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -1355,13 +1355,15 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function RemovePSAlias(CvePS As Integer, PSAlias As String) As Boolean + Public Function RemovePSAlias(CvePS As Integer, PSAlias As String, CveUsuarioModifico As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_ProductosServiciosAliasRemove") SqlAdapter.SelectCommand.Parameters.Add("@CvePS", SqlDbType.Int).Value = CvePS SqlAdapter.SelectCommand.Parameters.Add("@PSAlias", SqlDbType.VarChar).Value = PSAlias + SqlAdapter.SelectCommand.Parameters.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + Try SqlAdapter.Fill(Data) Retorno = True From 1db0a46c108463a47e7b836204c0b8f6f71004e4 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:42:42 -0700 Subject: [PATCH 13/22] - cambio en carga de ps --- Inventarios/Kardex.aspx.vb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb index 188a071e0..f2f961c3b 100644 --- a/Inventarios/Kardex.aspx.vb +++ b/Inventarios/Kardex.aspx.vb @@ -41,12 +41,13 @@ Partial Class Inventarios_Kardex If Request("FechaI") IsNot Nothing AndAlso Request("FechaI") <> "-1" Then TxtFechaI.Text = Request("FechaI").ToString If Request("FechaF") IsNot Nothing AndAlso Request("FechaF") <> "-1" Then TxtFechaF.Text = Request("FechaF").ToString - If IfNull(Request("CvePS"), "-1").ToString.ToEntero > 0 Then CargarKardex(Request("CvePS").ToString.ToEntero) - ddlProducto2.SelectedValue = If(Request("CvePS") IsNot Nothing, Request("CvePS").ToString, "-1") + 'If IfNull(Request("CvePS"), "-1").ToString.ToEntero > 0 Then CargarKardex(Request("CvePS").ToString.ToEntero) + 'ddlProducto2.SelectedValue = If(Request("CvePS") IsNot Nothing, Request("CvePS").ToString, "-1") If Request("CvePS") IsNot Nothing And Request("CvePS") <> "-1" Then ddlProducto2.SelectedValue = If(Request("CvePS") IsNot Nothing, Request("CvePS").ToString, "-1") ddlProducto_SelectedIndexChanged(ddlProducto2, EventArgs.Empty) + CargaDatos() End If CargaPermisos() @@ -257,7 +258,14 @@ Partial Class Inventarios_Kardex Dim FechaF As String = If(TxtFechaF.Text <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text, "-1") Dim CveAlmacen As Integer = -1 Dim CveAlmacenes As String = ddlAlmacen.GetSelectedValues() - If CvePS > 0 Then ddlProducto2.SelectedText = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("PSCodigo", "") + If CvePS > 0 Then + Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + If dr IsNot Nothing Then + ddlProducto2.SelectedText = dr("PSCodigo").ToString + ddlProducto2.SelectedValue = CvePS.ToString + End If + + End If Dim CveTiposAlmacen = "" For Each item As ListItem In CBLTiposAlmacen.Items From ef8954ad8d51b96a3b15ab88448c84b2d0cf8080 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:43:09 -0700 Subject: [PATCH 14/22] que tome el precio del PL --- Inventarios/RecepcionUsados.aspx.vb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index fb0d561d4..59c54dc90 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2561,7 +2561,16 @@ Partial Class Inventarios_RecepcionUsados Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") If drPS IsNot Nothing Then - PrecioSugerido = drPS("Precio").ToString.ToDecimal + Dim CvePrecioListaPS As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=DdlClientes.SelectedValue.ToEntero).FiltroPrimeroValor("CvePrecioLista").ToEntero() + If CvePrecioListaPS > 0 Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then + PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal + End If + ObjPS.Dispose() + End If + + ' PrecioSugerido = drPS("Precio").ToString.ToDecimal Dim PS As String = drPS("PS").ToString CveMarca = drPS("CveMarca").ToString.ToEntero CveClasificacion = drPS("CveClasificacion").ToString.ToEntero From 8f364b425dd15d8f2a43ed3233a67c8b12a39687 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:43:26 -0700 Subject: [PATCH 15/22] parametro proyectado --- Inventarios/KardexAlmacenHorizontal.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 7acdada23..19bdc35cd 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -134,7 +134,7 @@ Partial Class Inventarios_KardexAlmacen Dim CveProveedorCompra As Integer = If(DdlProveedor.SelectedValue.ToEntero > 0, DdlProveedor.SelectedValue.ToEntero, -1) Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM) - If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, CveAlmacen, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue, Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas) Then + If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, CveAlmacen, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue, Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas, IncluyeProyectado:=0) Then If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then dt = ObjMovimientos.DtResultados Dim ListaBorrar As New List(Of DataColumn) From cb83e159dfd80f1e6cc08c029f3f340bc99e86fc Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:44:02 -0700 Subject: [PATCH 16/22] -- espedificar modulos y cambios en carga excel --- Inventarios/EntradasSalidas.aspx.vb | 35 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 5da863d9d..e3edbd586 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1519,7 +1519,7 @@ Partial Class Inventarios_EntradasSalidas Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, obs, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) - CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, DdlConcepto.SelectedValue.ToEntero, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor) + CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, DdlConcepto.SelectedValue.ToEntero, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="ES/1") If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then @@ -1961,7 +1961,7 @@ Partial Class Inventarios_EntradasSalidas Dim ObjInv As New ClsInventarios If CveMovimiento <= 0 Then - CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) + CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="ES/CS1") End If ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=SerieLote) @@ -3837,7 +3837,7 @@ Partial Class Inventarios_EntradasSalidas 'MOVIMIENTO DE ENTRADA If DtMovimientosEntradaInvFisico.Rows.Count > 0 Then Dim FolioEntrada As Integer = ObjInventario.GetFolioSiguiente(32, UsuarioActual.CveEmpresa) - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 32, 1, Fecha, FolioEntrada, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtIFDescripcion.Text.Trim) + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 32, 1, Fecha, FolioEntrada, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtIFDescripcion.Text.Trim, Modulo:="ES/AJ1") Else CveMovimientoEntrada = -1 End If @@ -3845,7 +3845,7 @@ Partial Class Inventarios_EntradasSalidas 'MOVIMIENTO DE SALIDA If DtMovimientosSalidaInvFisico.Rows.Count > 0 Then Dim FolioSalida As Integer = ObjInventario.GetFolioSiguiente(34, UsuarioActual.CveEmpresa) - CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacen, 34, 1, Fecha, FolioSalida, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoEntrada, Observaciones:=TxtIFDescripcion.Text.Trim) + CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacen, 34, 1, Fecha, FolioSalida, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoEntrada, Observaciones:=TxtIFDescripcion.Text.Trim, Modulo:="ES/AJ2") End If @@ -4132,19 +4132,21 @@ Partial Class Inventarios_EntradasSalidas End Sub Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) Dim dt As New DataTable - Dim Conexion As Odbc.OdbcConnection = Nothing + 'Dim Conexion As Odbc.OdbcConnection = Nothing Dim ErrorArchivo = False Dim n As Integer = 0 Try Select Case Tipo Case "EXCEL" - Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = "Select * FROM [Hoja1$]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dt) + dt = ReadExcelFile(Ruta + FileName, True) + dt = dt.FiltraParametros("Cantidad <> '' ") + 'Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") + 'Conexion.Open() + 'Dim cmd = Conexion.CreateCommand() + 'cmd.CommandType = CommandType.Text + 'cmd.CommandText = "Select * FROM [Hoja1$]" + 'Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) + 'DataAdapter.Fill(dt) Case Else Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError) Exit Sub @@ -4153,7 +4155,7 @@ Partial Class Inventarios_EntradasSalidas ErrorArchivo = True OnError("Ocurrio un Error al leer el archivo
" & ex.Message, ex) End Try - Conexion.Close() + ' Conexion.Close() If Not ErrorArchivo Then If Not dt.Columns(0).ColumnName = "Cantidad" Then Alert("El nombre de la primera columna debe ser 'Cantidad'.Favor de corregirlo", TipoMensaje.MsgError) @@ -4299,7 +4301,12 @@ Partial Class Inventarios_EntradasSalidas Dim StrReturn As String = String.Empty Dim CvePS As Integer = 0 Dim Condicion As String = String.Format("{0} = '{1}'", Opt, Valor) - CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", Condicion).ToString.ToEntero + If Opt = "Codigo" Then + CvePS = GlobalDTPS(UsuarioActual.CveEmpresa, Codigo:=Valor).FiltroPrimeroValor("CvePS", "").ToString.ToEntero + Else + CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", Condicion).ToString.ToEntero + End If + If CvePS > 0 Then StrReturn = "True|" & CvePS.ToString Else From ead1d08776e6f20758c40f4cc47ea298e08218ae Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:44:37 -0700 Subject: [PATCH 17/22] carga cuentas. generales no padres --- Ventas/Clientes.aspx.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 9741e5338..9e80b2a01 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1120,9 +1120,9 @@ Partial Class Clientes Select Case HdnCuenta.Value Case "1" - CargaDdlCuentasContables(DdlCtaContableClientes, UsuarioActual.Empresa.Funcionalidad(246).ToEntero) + CargaDdlCuentasContables(DdlCtaContableClientes, 1)'UsuarioActual.Empresa.Funcionalidad(246).ToEntero Case "2" - CargaDdlCuentasContables(DdlCtaContableAnticipos, UsuarioActual.Empresa.Funcionalidad(237).ToEntero) + CargaDdlCuentasContables(DdlCtaContableAnticipos, 1)' UsuarioActual.Empresa.Funcionalidad(237).ToEntero Case "3" CargaDdlCuentasContables(DdlCtaContableRetIVA, -1) Case "4" @@ -1130,13 +1130,13 @@ Partial Class Clientes Case "5" CargaDdlCuentasContables(DdlCtaContableFondoGarantia, -1) Case "6" - CargaDdlCuentasContables(DdlCtaContableCompClientes, UsuarioActual.Empresa.Funcionalidad(248).ToEntero) + CargaDdlCuentasContables(DdlCtaContableCompClientes, 1)'UsuarioActual.Empresa.Funcionalidad(248).ToEntero Case "7" CargaDdlCuentasContables(DdlCtaContableCompAnticipos, -1) Case "8" - CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, UsuarioActual.Empresa.Funcionalidad(247).ToEntero) + CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, 1)'UsuarioActual.Empresa.Funcionalidad(247).ToEntero Case "9" - CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, UsuarioActual.Empresa.Funcionalidad(542).ToEntero) + CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, 1) 'UsuarioActual.Empresa.Funcionalidad(542).ToEntero End Select UpFiscalContable.Update() From d6796dd97e13d24496337ca0202f9a90daf23efc Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:45:24 -0700 Subject: [PATCH 18/22] cambios en rfc publico, salida de almacen de consignacion, tome las secciones correctas --- Ventas/Ventas.aspx.vb | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8df466012..ef403312f 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -21693,18 +21693,18 @@ Partial Class Ventas End If 'SALIDA GENERAL - CveMovimientoEntradaGeneral = ObjInventario.AddMovimiento(CveAlmacenOrigenContrato, 3, 1, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E7") - If CveMovimientoEntradaGeneral > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then + CveMovimientoSalidaGeneral = ObjInventario.AddMovimiento(CveAlmacenOrigenContrato, 3, 1, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E7") + If CveMovimientoSalidaGeneral > 0 Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoEntradaGeneral, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then Return False End If Next End If 'GENERAR PREPOLIZA - If Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoEntradaGeneral, CveAlmacenOrigenContrato) Then + If Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoSalidaGeneral, CveAlmacenOrigenContrato) Then Return False End If Else @@ -23016,7 +23016,9 @@ Partial Class Ventas Exit Sub End If - DeshabilitarAplicarNotaDeCredito(LblRFC.Text) + If DeshabilitarAplicarNotaDeCredito(LblRFC.Text) Then + Exit Sub + End If AplicaNCMasiva = False AplicaNC = False @@ -27284,14 +27286,15 @@ Partial Class Ventas ObjVentas.Dispose() End Sub - Private Sub DeshabilitarAplicarNotaDeCredito(RFC As String) - + Private Function DeshabilitarAplicarNotaDeCredito(RFC As String) As Boolean + Dim Retorno As Boolean = False If UsuarioActual.CveEmpresa = 119 AndAlso RFC.Contiene("XAXX010101000", "XEXX010101000") Then LBNotaCredito.Visible = False UpnTools.Update() + Retorno = True End If - - End Sub + Return Retorno + End Function #Region "Auxiliar" Private Sub CargarSaldoAuxiliar(CveCliente As Integer) From c98464a92b6e6747be430121b036ce34f1ee43a2 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 21 Oct 2020 14:46:43 -0700 Subject: [PATCH 19/22] --cambios en transitorio --- Inventarios/TraspasoAlmacen.aspx.vb | 73 +++++++++++++++++------------ 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 58ddb7411..3cdea518e 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -883,35 +883,38 @@ Partial Class Inventarios_TraspasoAlmacen End If End If + AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) + + Dim TipoMovimientoEntrada As Integer = 27 + If Not ChkTransitorio.Checked Then TipoMovimientoEntrada = 27 Else TipoMovimientoEntrada = 9 + + CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, + Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), + CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3") + FolioEntrada = ObjInventario.Folio + If CveMovimientoEntrada <= 0 Then + TextoError = "Ocurrió un error al generar el movimiento de entrada" + ErrorMovInv = True + Else + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + Dim Cont As Integer = 0 + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal()) + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" + Exit For + End If + Cont += 1 + Next + End If + End If + 'AGREGAMOS LA ENTRADA If Not ChkTransitorio.Checked Then 'SI NO ES TRANSITORIO SE HACE LA RECEPCION DE INMEDIATO If Not ErrorMovInv Then - Dim TipoMovimientoEntrada = 27 - AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) - 'Dim TipoAlmacenEntrada As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {AlmacenEntrada}").ToEntero() - CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), - CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3") - FolioEntrada = ObjInventario.Folio - If CveMovimientoEntrada <= 0 Then - TextoError = "Ocurrió un error al generar el movimiento de entrada" - ErrorMovInv = True - Else - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - Dim Cont As Integer = 0 - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal()) - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - Cont += 1 - Next - End If - End If 'VIRTUAL ENTRADA If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then 'Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {DdlAlmacenDestino.SelectedValue}").ToEntero() @@ -984,7 +987,7 @@ Partial Class Inventarios_TraspasoAlmacen If Not ErrorMovInv Then Dim Concepto As String = TxtObservaciones.Text If Concepto = "" Then Concepto = "Traspaso" - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen2", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Dim resultado As DataTable = ObjInventario.DtResultados @@ -995,7 +998,7 @@ Partial Class Inventarios_TraspasoAlmacen ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If End If @@ -1794,11 +1797,16 @@ Partial Class Inventarios_TraspasoAlmacen Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate Dim CveAlmacenEntrada As Integer = GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero + Dim CveAlmacenSalida As Integer = GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero Dim TipoAlmacenDestino As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenEntrada}").ToEntero() + 'AGREGAMOS LA SALIDA + CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, Modulo:="TA/G11") + 'AGREGAMOS LA ENTRADA - CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenEntrada, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenEntrada, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1") Folio = ObjInventario.Folio @@ -1831,11 +1839,18 @@ Partial Class Inventarios_TraspasoAlmacen Exit For End If Dim PrecioEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, gvr.DataKey("PU").ToString.ToDecimal) + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de salida" + Exit For + End If + 'MOV, Alm, Transito If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" Exit For End If + ElseIf cantidadDisponibleValidacion < 0 Then TextoError = String.Format("Se exceden la cantidad disponibles para {0}", gvr.DataKey("PS").ToString) ErrorMovInv = True @@ -1846,7 +1861,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim Concepto As String = TxtObservacionesRecepcion.Text If Concepto = "" Then Concepto = "Recepción Traspaso" Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then Dim resultado As DataTable = ObjInventario.DtResultados Dim importe As Decimal = resultado.SUMD("Total").RoundSQL @@ -1878,7 +1893,7 @@ Partial Class Inventarios_TraspasoAlmacen FolioVirtualEntrada = ObjInventario.Folio Dim dtvirtual As DataTable = Nothing - If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then dtvirtual = ObjInventario.DtResultados For Each RowVirtual As DataRow In dtvirtual.Rows Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() From b16aae6422fc18fd385d3f63f89d327d3202993e Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 21 Oct 2020 17:51:58 -0700 Subject: [PATCH 20/22] nuevo filtro y mecanica para nueva tabla en kardex horizontal --- App_Code/ClsInventarios.vb | 42 +++++++ App_Code/DtDatos.xsd | 31 ++--- App_Code/DtDatos.xss | 4 +- Compras/Compras.aspx.vb | 9 +- Inventarios/KardexAlmacenHorizontal.aspx | 39 +++++- Inventarios/KardexAlmacenHorizontal.aspx.vb | 131 ++++++++++++++++++++ 6 files changed, 236 insertions(+), 20 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index de4c0e719..28ddfee29 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5178,6 +5178,48 @@ Public Class ClsInventarios Return Retorno End Function +#Region "Proyeccion" + Public Function AddMovimientosProyectados(CvePS As Integer, Cantidad As Decimal, TipoMovto As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("Inv_MovimientosProyectadosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@TipoMovto", SqlDbType.TinyInt).Value = TipoMovto + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la proyección.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteMovimientosProyectados(TipoMovto As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("Inv_MovimientosProyectadosDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoMovto", SqlDbType.TinyInt).Value = TipoMovto + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la proyección.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + #Region "SUGERENCIAS SALIDA DE ALMACEN" Public Function GetSugerenciasSalidaAlmacen(CveVenta As Integer, CveAlmacen As Integer, CveEmpresa As Integer) As Boolean diff --git a/App_Code/DtDatos.xsd b/App_Code/DtDatos.xsd index 1a5c1befa..59b50901b 100644 --- a/App_Code/DtDatos.xsd +++ b/App_Code/DtDatos.xsd @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -256,7 +256,7 @@ - + @@ -291,10 +291,11 @@ + - + @@ -304,7 +305,7 @@ - + diff --git a/App_Code/DtDatos.xss b/App_Code/DtDatos.xss index 7c380feb0..e18bb1b5a 100644 --- a/App_Code/DtDatos.xss +++ b/App_Code/DtDatos.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + @@ -18,7 +18,7 @@ - + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6109d4080..7da8d0e62 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -11,6 +11,7 @@ Imports System.IO Imports ADServerControl Imports System.Threading.Tasks Imports System.Diagnostics +Imports System.Text.RegularExpressions Partial Class Compras_Compras Inherits ClsPaginas @@ -20312,7 +20313,6 @@ Partial Class Compras_Compras Private Function VerificarProductosCompraConOC() As Boolean - Dim ProductosNoValidados As New StringBuilder() Dim DtCompras As New DataTable() @@ -20338,7 +20338,12 @@ Partial Class Compras_Compras Dim TipoPS As String = GvOCRow.DataKey("CveTipoPS") If TipoPS = "2" Then - Dim ProductoAisloadoString As String = GvOCRow.DataKey("PS").Split("-"c)(1).Trim() + Dim ProductoAisloadoString As String = "" + If CveFactura > 0 Then + ProductoAisloadoString = Regex.Replace(GvOCRow.DataKey("PS"), "^\d*\s-\s", "") + Else + ProductoAisloadoString = GvOCRow.DataKey("PS") + End If Dim PSOC As String = ProductoAisloadoString Dim CantidadOC As String = GvOCRow.DataKey("CantidadF") Dim PrecioUnitarioOC As String = GvOCRow.DataKey("Importe") diff --git a/Inventarios/KardexAlmacenHorizontal.aspx b/Inventarios/KardexAlmacenHorizontal.aspx index 1dc493670..d0a684ef8 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx +++ b/Inventarios/KardexAlmacenHorizontal.aspx @@ -92,6 +92,9 @@
  • Generar Excel
  • +
  • + +
  • @@ -188,7 +191,7 @@
    - +
    @@ -250,6 +253,40 @@
    + diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 7acdada23..21866757e 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -337,6 +337,137 @@ Partial Class Inventarios_KardexAlmacen excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") End Sub + + Protected Sub LnkProyectos_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivProyeccion")) + End Sub + + Protected Sub BtnDescargarFormato_Click(sender As Object, e As EventArgs) + Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\KardexProyeccion.xlsx" + + Dim Archivo As New IO.FileInfo(Directorio) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If + End Sub + + Protected Sub BtnAgregarProyeccion_Click(sender As Object, e As EventArgs) + If TxtProyeccionExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtProyeccionExcel.getfiles().Archivos(0) + Dim Directorio As String = Server.MapPath("~") & file.patch + Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") + CargarArchivo(Directorio, file.filename, Tipo) + Else + Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) + End If + End Sub + + Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) + Dim dt As New DataTable + dt = ReadExcelFile(Ruta + FileName, True) + If Not dt.Columns(0).ColumnName = "Código" Then + Alert("La primera columna del archivo debe ser 'Código'", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + If Not dt.Columns(1).ColumnName = "Cantidad" Then + Alert("La primera columna del archivo debe ser 'Cantidad'", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + AgregarProyeccion(dt) + End Sub + + Private Sub AgregarProyeccion(dt As DataTable) + Dim TieneError As Boolean = False + Dim ObjInventarios As New ClsInventarios + ObjInventarios.IniciaTransacSQL() + + Dim TipoMovot As Integer = If(RblProyeccionOpcion.SelectedValue = "1", 0, 1) + + If ObjInventarios.DeleteMovimientosProyectados(TipoMovot) Then + Dim DtProductosEmpresas As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + For Each dtRow As DataRow In dt.Rows + Dim Codigo As String = dtRow("Código").ToString + Dim CvePS As Integer = DtProductosEmpresas.FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", Codigo)) + Dim Cantidad As Decimal = dtRow("Cantidad").ToString.ToDecimal + If Not ObjInventarios.AddMovimientosProyectados(CvePS, Cantidad, RblProyeccionOpcion.SelectedValue.ToEntero()) Then + TieneError = True + Exit For + End If + Next + Else + TieneError = True + End If + + If TieneError Then + ObjInventarios.RollBack() + Else + ObjInventarios.Commit() + End If + ObjInventarios.Dispose() + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivProyeccion")) + Alert("Se ha agregado la proyección de productos correctamente") + End Sub + + Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) + + Dim unnamed As Integer = 0 + Dim cols As Integer + Dim columns As String() + Dim curRow As Integer = 0 + Dim curCol As Integer = 0 + Dim dataTable As DataTable = New DataTable() + Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0) + + For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1 + + If firstRowHasHeaders Then + + If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then + dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString().Trim) + Else + dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed))) + End If + + curRow = 1 + Else + dataTable.Columns.Add("Column " & (cols + 1)) + End If + + Next + + While curRow < worksheet.Rows.Count + + columns = New String(cols - 1) {} + + For curCol = 0 To cols - 1 + + If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then + columns(curCol) = "" + Else + columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() + End If + + Next + + dataTable.Rows.Add(columns) + curRow += 1 + + End While + + Return dataTable + + End Function Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub End Class From f2343020986f07d36f48f5c7007073250aa5a535 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 21 Oct 2020 18:35:46 -0700 Subject: [PATCH 21/22] se incluyo en proyeccion al filtro --- Inventarios/KardexAlmacenHorizontal.aspx | 20 ++++++++++++++------ Inventarios/KardexAlmacenHorizontal.aspx.vb | 14 ++++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Inventarios/KardexAlmacenHorizontal.aspx b/Inventarios/KardexAlmacenHorizontal.aspx index d0a684ef8..daf1c0abe 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx +++ b/Inventarios/KardexAlmacenHorizontal.aspx @@ -178,7 +178,7 @@
    - + Orden:
    @@ -189,7 +189,7 @@
    - + Marca:
    @@ -197,6 +197,14 @@
    + +
    + + + + + +
    @@ -264,12 +272,12 @@ - +
    - - - + +