From 10ec41274041766659c4a2e379916bd7c3450345 Mon Sep 17 00:00:00 2001 From: Rene Molina Date: Mon, 27 Jan 2020 09:19:20 -0700 Subject: [PATCH] -cambios BDH --- App_Code/ClsPaginas.vb | 11 ++-- App_Code/Modelos.vb | 16 +++--- Inventarios/RecepcionUsados.aspx.vb | 80 +++++++++++++++-------------- Ventas/PV.aspx | 21 +++++--- Ventas/PV.aspx.vb | 23 ++++++++- Ventas/Ventas.aspx.vb | 25 ++++----- 6 files changed, 103 insertions(+), 73 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index fbafc00cb..ef3b2d0a4 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1732,10 +1732,15 @@ Public Class ClsPaginas Application("GlobalDTSeccionAlmacen") = value End Set End Property - Property GlobalDTAlmacen(CveEmpresa As Integer) As DataTable + Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1) As DataTable Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + If CveEmpresa <> -1 Then + + Dim Str As New StringBuilder + Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + + Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTAlmacen = Dv.ToTable Dv.Dispose() Else diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 06a030092..d14b65406 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -541,7 +541,7 @@ Namespace Modelos End Class - Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Trasac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura + Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura Dim Retorno As New MMensajeFactura() If Me.Version = "3.3" AndAlso Not Me.TipoDocto.Contiene("Ped", "PeC") Then @@ -589,8 +589,8 @@ Namespace Modelos If DtDetalle.Rows.Count > 0 Then Dim ObjVentas As ClsVentas = Nothing - If Trasac IsNot Nothing Then - ObjVentas = New ClsVentas(Trasac) + If Transac IsNot Nothing Then + ObjVentas = New ClsVentas(Transac) Else ObjVentas = New ClsVentas() ObjVentas.IniciaTransacSQL() @@ -801,7 +801,7 @@ Namespace Modelos If Me.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or Me.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then - If Trasac Is Nothing Then + If Transac Is Nothing Then ObjVentas.Commit() End If If ObjContPaqTransac Is Nothing Then @@ -1004,7 +1004,7 @@ Namespace Modelos Retorno.Mensajes = ListaMensajes End Try Else - If Trasac Is Nothing Then + If Transac Is Nothing Then ObjVentas.RollBack() End If If ObjContPaqTransac Is Nothing Then @@ -1015,7 +1015,7 @@ Namespace Modelos End If Else - If Trasac Is Nothing Then + If Transac Is Nothing Then ObjVentas.RollBack() End If @@ -1030,7 +1030,7 @@ Namespace Modelos Catch ex As Exception Me.ErrorList.Add(ex.ToString()) - If Trasac Is Nothing Then + If Transac Is Nothing Then ObjVentas.RollBack() End If If ObjContPaqTransac Is Nothing Then @@ -1040,7 +1040,7 @@ Namespace Modelos Retorno.Mensajes = ErrorList Retorno.TieneError = True Finally - If Trasac Is Nothing Then + If Transac Is Nothing Then ObjVentas.Dispose() ObjConta.Dispose() ObjInventario.Dispose() diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 7f1732916..90e480137 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1026,7 +1026,7 @@ Partial Class Inventarios_RecepcionUsados If Me.ObjRemisionNC IsNot Nothing Then Dim sb As New StringBuilder() - sb.Append($"Se va a generar un documento de tipo 'Remisión de nota de crédito'.
Serie-Folio:{Me.ObjRemisionNC.SerieFolio}.
¿Esta seguro que desea guardar?:
") + sb.Append($"Se va a generar un documento de tipo 'Remisión de nota de crédito'.
¿Esta seguro que desea guardar?:
") Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:="GenerarRNC();", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") Else @@ -1090,10 +1090,12 @@ Partial Class Inventarios_RecepcionUsados CargaDTDetalleRNC() - Dim Resp = ObjRemisionNC.EmitirFactura(False) + Dim Resp = ObjRemisionNC.EmitirFactura(False, ObjInventario.IniciaTransacSQL) For Each mensaje2 As String In Resp.Mensajes Msg.AppendFormat("
{0}", mensaje2) + Next + If Resp.TieneError Then ErrorMovInv = True Alert(Msg.ToString, If(Resp.CveVenta > 0, TipoMensaje.MsgInformacion, TipoMensaje.MsgAdvertencia)) CveVenta = Resp.CveVenta End If @@ -1104,13 +1106,13 @@ Partial Class Inventarios_RecepcionUsados ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate) Else ImporteConcepto = Dr("PU").ToString.ToDouble - End If + End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Exit For - End If + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Exit For + End If If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True) Then Mensaje = "Error al actualizar el recibo de los usados" @@ -1132,34 +1134,34 @@ Partial Class Inventarios_RecepcionUsados End If Next - If Not ErrorMovInv Then + If Not ErrorMovInv Then - Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) - Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) + Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) + Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) - If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) + If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) - ObjInventario.Commit() ' aplica los movimientos insertados + ObjInventario.Commit() ' aplica los movimientos insertados - 'Limpia Valores cuando inserta de campos especiales - If UsuarioActual.CveEmpresa = 66 Then - DdlSubProyecto.SelectedValueExist("-1") - End If - - EnvioCorreo() - - CargaPendientesRecibir() - UPDatos.Update() - - Else - ObjInventario.RollBack() 'deshace lo insertado - CveMovimiento = 0 - Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError) + 'Limpia Valores cuando inserta de campos especiales + If UsuarioActual.CveEmpresa = 66 Then + DdlSubProyecto.SelectedValueExist("-1") End If + EnvioCorreo() + + CargaPendientesRecibir() + UPDatos.Update() + + Else + ObjInventario.RollBack() 'deshace lo insertado + CveMovimiento = 0 + Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError) End If + End If + End If Catch ex As Exception ObjInventario.RollBack() 'deshace lo insertado CveMovimiento = 0 @@ -2025,20 +2027,20 @@ Partial Class Inventarios_RecepcionUsados Dim Folio As String = "" Dim Serie As String = "" - Dim ObjFolios As New ClsGralFolios() - If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa) Then - Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" Estado = 'Activo' AND CveSubProyecto = {0}", CveSubProyecto)) - If DT.Rows.Count > 0 Then - Serie = DT.Rows(0)("Serie").ToString() - Folio = DT.Rows(0)("FActual").ToString() - End If - DT.Dispose() - End If - ObjFolios.Dispose() + 'Dim ObjFolios As New ClsGralFolios() + 'If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto) Then + ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" Estado = 'Activo' ")) + ' If DT.Rows.Count > 0 Then + ' Serie = DT.Rows(0)("Serie").ToString() + ' Folio = DT.Rows(0)("FActual").ToString() + ' End If + ' DT.Dispose() + 'End If + 'ObjFolios.Dispose() Me.ObjRemisionNC.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML - Me.ObjRemisionNC.Serie = Serie - Me.ObjRemisionNC.Folio = Folio.ToEntero() + Me.ObjRemisionNC.Serie = "-1" + Me.ObjRemisionNC.Folio = -1 'Folio.ToEntero() Me.ObjRemisionNC.Version = "3.3" Me.ObjRemisionNC.FolioFiscal = "" Me.ObjRemisionNC.CveUsuario = UsuarioActual.CveUsuario diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index ae2bdbd52..92e7823ae 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -2312,7 +2312,7 @@
- +
@@ -2386,6 +2386,7 @@
+
@@ -2681,8 +2682,8 @@
- - + + @@ -2898,7 +2899,7 @@
- + <%----%> <%----%> @@ -2984,8 +2985,14 @@
-
-
+
+
+
+ + +
+
+
@@ -3623,7 +3630,7 @@ } function showDivEC() { - $('#<%= TxtRFCCliente.ClientID %>').val(''); + $('#<%= TxtNombreCliente.ClientID %>').val(''); $('#<%= TxtDireccionCliente.ClientID %>').val(''); $('#<%= TxtNumExtCliente.ClientID %>').val(''); diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 4e051e985..fd3dfa963 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4654,6 +4654,7 @@ Partial Class PV DivCorreoCuentaCliente.Visible = False DivBotonesAgregarCliente.Visible = False DivFormaCliente.Visible = False + TxtRFCCliente.Text = "XAXX010101000" UpAgregarCliente.Update() RegistraScript("showDivEC();") @@ -5244,6 +5245,16 @@ Partial Class PV DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca) DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlTipoUso.DataBind() + + 'si la marca es optima, el codigo cambia a solo numerico + If CveMarca = 1086 Then + REVCodEnsamble.ValidationExpression = "^[0-9]$" + REVCodLinea.ValidationExpression = "^[0-9]$" + Else + REVCodEnsamble.ValidationExpression = "^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$" + REVCodLinea.ValidationExpression = "^[*]$" + End If + End If If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then @@ -5272,13 +5283,14 @@ Partial Class PV Dim CveMarca As Integer = -1 CveMarca = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimeroValor("CveMarca", "").ToEntero - + Dim ImportePagarCliente As Decimal = 0 Dim ObjAcum As New ClsAcumuladores If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then If ObjAcum.DtResultados.Rows.Count > 0 Then TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDecimal * TxtPUFactura.Text.ToDecimal).FormatoNumero + ImportePagarCliente = TxtImporteAjuste.Text.ToDecimal Dim CargoVendido As Decimal = 0 Dim CargoGarantia As Decimal = 0 @@ -5310,10 +5322,13 @@ Partial Class PV TxtImporteAjuste.Text = "0.00" CargoGarantia = CargoVendido + ImportePagarCliente = 0 End If + ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal + TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}." TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero - + TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero Else Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia) 'cuando no está registrada, no da ajuste @@ -5324,6 +5339,10 @@ Partial Class PV Alert("No se tiene especificado tabla de garantía") End If ObjAcum.Dispose() + Else + If DdlPSAjuste.SelectedValue.ToEntero <= 0 Then + Alert("Especificar el producto a recibir") + End If End If Catch ex As Exception OnError("Ocurrió un error al recalcular el costo", ex) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 952ba1f49..8fc1fa25b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13925,21 +13925,21 @@ Partial Class Ventas Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D - Dim TotalInicial = (Cantidad * (PU)) - Descuento + Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento Dim TotalFinal = TotalInicial 'SI APLICA EL PRIMER DESCUENTO If PorcentajeProducto > 0 Then - Dim Descuento1 = TotalInicial * PorcentajeProducto + Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) Dim Total2 = (TotalInicial - Descuento1) 'SI APLICA EL SEGUNDO DESCUENTO If PorcentajeProducto2 > 0 Then - Dim Descuento2 = Total2 * PorcentajeProducto2 + Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) Dim Total3 = (Total2 - Descuento2) 'SI APLICA EL TERCER DESCUENTO If PorcentajeProducto3 > 0 Then - Dim Descuento3 = Total3 * PorcentajeProducto3 + Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2) TotalFinal = Total3 - Descuento3 Else TotalFinal = Total3 @@ -15752,17 +15752,21 @@ Partial Class Ventas Try Dim CveMovimientoVirtual As Integer = -1 Dim CveAlmacenVirtual As Integer = -1 - Dim CveConceptoMovimientoVirtual As Integer = 36 + Dim CveConceptoMovimientoVirtual As Integer = 37 Dim DtPSVirtual As DataTable = Nothing Dim DtTamanios As DataTable = Nothing Dim CveMovimientoEntradaDev As Integer = -1 + Dim CveSubProyecto As Integer = -1 If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND ((CveTipoAlmacen = 24 AND CveConcepto = 2) OR (CveTipoAlmacen = 1 AND CveConcepto = 8)) AND CveVenta > 0") If RowMovimiento IsNot Nothing Then CveMovimientoEntradaDev = RowMovimiento("CveMovimiento").ToString().ToEntero() - CveAlmacenVirtual = RowMovimiento("CveAlmacen").ToString().ToEntero() + Dim tCveAlmacen = RowMovimiento("CveAlmacen").ToString().ToEntero() + CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {tCveAlmacen}").ToEntero() + CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen = 24 AND CveSubProyecto={CveSubProyecto}").ToEntero() + Else OcurrioError = True End If @@ -15776,16 +15780,9 @@ Partial Class Ventas OcurrioError = True End If - 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA - 'If ObjInventario.GetMovimientosDetalle(CveMovimientoEntradaDev, UsuarioActual.CveEmpresa) Then - ' DtPSVirtual = ObjInventario.DtResultados.Copy() - 'Else - ' OcurrioError = True - 'End If - If Not OcurrioError AndAlso DtPSVirtual.Rows.Count > 0 Then - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/V", CveMovimientoRelacionado:=CveMovimientoEntradaDev) + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/VV", CveMovimientoRelacionado:=CveMovimientoEntradaDev) If CveMovimientoVirtual > 0 Then For Each RowUsado As DataRow In DtPSVirtual.Rows