-- option explciit

-- bdh - se quita descuento de filtros/lub LTH
This commit is contained in:
2023-09-18 09:04:50 -07:00
parent 894a72b026
commit d8d818b4ce

View File

@@ -650,14 +650,14 @@ Partial Class PV
End Set
End Property
Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal)
Get
Return New Dictionary(Of Integer, Decimal) From {
{20516, 0.21D}, 'Descuento para lubricantes LTH
{20515, 0.25D} 'Descuento para filtros LTH
}
End Get
End Property
'Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal)
' Get
' Return New Dictionary(Of Integer, Decimal) From {
' {20516, 0.21D}, 'Descuento para lubricantes LTH
' {20515, 0.25D} 'Descuento para filtros LTH
' }
' End Get
'End Property
Private Property CveAutorizacion As Integer
Get
Return (IfNull(ViewState("CveAutorizacion"), "-1", ViewState("CveAutorizacion"))).ToString().ToEntero()
@@ -1484,7 +1484,7 @@ Partial Class PV
TrRetIVA.Style.Add("display", "")
UsuarioActual.Empresa.MostrarRetIVA = True
If TmpDT IsNot Nothing Then
Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
Dim PorcentajeRetIVA As Decimal = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2)
End If
@@ -1814,11 +1814,11 @@ Partial Class PV
ViewState("CveClienteAnterior") = CveCliente
'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE
Dim CantidadFacturadaRemision = 0.0
Dim CantidadFacturadaRemision As Decimal = 0
For Each Gvr As GridViewRow In GvPS.Rows
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDecimal
Next
'ACTIVA CAMBIO DE CLIENTE - SI NO TIENE NADA FACTURADO
@@ -2156,7 +2156,7 @@ Partial Class PV
If ObjPVenta.DtResultados.Rows.Count > 0 Then
CveCorte = ObjPVenta.CveCorte
Dim FechaICorte = ObjPVenta.FechaInicial.Date '.AddDays(-1)
Dim FechaICorte As Date = ObjPVenta.FechaInicial.Date '.AddDays(-1)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < Now.Date Then
DebeCerrarCorte = True
LblMotivoBloqueo.Text = $"Existe un corte del día <b>{FechaICorte.ToString("dd/MM/yyyy")}</b>. Favor de cerrarlo para iniciar un nuevo corte."
@@ -2223,32 +2223,32 @@ Partial Class PV
Dt.Columns.Add("Descripcion", GetType(String))
Dt.Columns.Add("Importe", GetType(Decimal))
Dim Dr1 = Dt.NewRow
Dim Dr1 As DataRow = Dt.NewRow
Dr1("Descripcion") = "Fondo de Caja"
Dr1("Importe") = ObjPVenta.DtResultados(0)("ImporteInicial").ToString.ToDouble
Dt.Rows.Add(Dr1)
Dim Dr2 = Dt.NewRow
Dim Dr2 As DataRow = Dt.NewRow
Dr2("Descripcion") = "Ventas en Efectivo"
Dr2("Importe") = ObjPVenta.DtResultados(0)("VentasEfectivo").ToString.ToDouble
Dt.Rows.Add(Dr2)
Dim Dr3 = Dt.NewRow
Dim Dr3 As DataRow = Dt.NewRow
Dr3("Descripcion") = "Propinas"
Dr3("Importe") = ObjPVenta.DtResultados(0)("Propina").ToString.ToDouble
Dt.Rows.Add(Dr3)
Dim Dr4 = Dt.NewRow
Dim Dr4 As DataRow = Dt.NewRow
Dr4("Descripcion") = "Entradas"
Dr4("Importe") = ObjPVenta.DtResultados(0)("Ingresado").ToString.ToDouble
Dt.Rows.Add(Dr4)
Dim Dr5 = Dt.NewRow
Dim Dr5 As DataRow = Dt.NewRow
Dr5("Descripcion") = "Salidas"
Dr5("Importe") = ObjPVenta.DtResultados(0)("Retirado").ToString.ToDouble
Dt.Rows.Add(Dr5)
Dim Dr6 = Dt.NewRow
Dim Dr6 As DataRow = Dt.NewRow
Dr6("Descripcion") = "Total"
Dr6("Importe") = Total
Dt.Rows.Add(Dr6)
@@ -2318,7 +2318,7 @@ Partial Class PV
If TxtEfectivoEnCaja.Text.Trim <> "" Then
If ObjPVenta.UpdateFinalizadoVtaCortes(CveCorte, TxtEfectivoEnCaja.Text.ToDouble, LblDiferenciaCaja.Text.ToDouble, Now, UsuarioActual.CveEmpresa) Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}", CveCorte, "PDF"))}'", "Imprimir")
Dim Liga = "document.location.href=""/Ventas/PV.aspx"";"
Dim Liga As String = "document.location.href=""/Ventas/PV.aspx"";"
Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga)
End If
End If
@@ -2329,7 +2329,7 @@ Partial Class PV
If TxtEfectivoCajaBloqueo.Text.Trim <> "" Then
If ObjPVenta.UpdateFinalizadoVtaCortes(CveCorte, TxtEfectivoCajaBloqueo.Text.ToDouble, LblDiferenciaCajaBloqueo.Text.ToDouble, Now, UsuarioActual.CveEmpresa) Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}", CveCorte, "PDF"))}'", "Imprimir")
Dim Liga = "document.location.href=""/Ventas/PV.aspx"";"
Dim Liga As String = "document.location.href=""/Ventas/PV.aspx"";"
Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga)
End If
Else
@@ -2773,7 +2773,7 @@ Partial Class PV
UpPS.Update()
End Sub
Private Sub CargaFormatoSucursal()
Dim dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue)))
Dim dr As DataRow = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue)))
If dr IsNot Nothing Then
ViewState("SucCalle") = dr("Calle")
ViewState("SucNoExt") = dr("NoExt")
@@ -2820,7 +2820,7 @@ Partial Class PV
If CveClienteSuc > 0 Then
If ObjCliente.GetSucursales(CveCliente, CveClienteSuc) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
Dim Correo = ObjCliente.DtResultados.Rows(0)("Correo").ToString
Dim Correo As String = ObjCliente.DtResultados.Rows(0)("Correo").ToString
If Correo.Trim.Length > 0 Then
ViewState("Mail") = Correo
End If
@@ -2992,7 +2992,7 @@ Partial Class PV
End Sub
Private Sub CargaVendedores()
Dim CveVendedorActual = DdlVendedor.SelectedValue
Dim CveVendedorActual As Integer = DdlVendedor.SelectedValue.ToEntero
DdlVendedor.Items.Clear()
@@ -3127,10 +3127,11 @@ Partial Class PV
TmpDT.Rows(row.RowIndex)("Orden") = row.FCTextBox("TxtOrden").Text.ToEntero
Next
Dim resultados = From OrdenDT In TmpDT
Order By OrdenDT("Orden").ToString.ToEntero
Select OrdenDT
TmpDT = resultados.CopyToDataTable
'Dim resultados = From OrdenDT In TmpDT
' Order By OrdenDT("Orden").ToString.ToEntero
' Select OrdenDT
'TmpDT = resultados.CopyToDataTable
TmpDT = TmpDT.FiltraParametros("", "Orden")
CalculaTotalesVenta()
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
@@ -3305,11 +3306,11 @@ Partial Class PV
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") Then
Dim MensajeCosto As New StringBuilder
Dim CostoMenor = 0.0D
Dim CostoMayor = 0.0D
Dim Costo = 0.0D
Dim EsValido = False 'BANDERA
Dim EsValidoMayor = False
Dim CostoMenor As Decimal = 0
Dim CostoMayor As Decimal = 0
Dim Costo As Decimal = 0
Dim EsValido As Boolean = False 'BANDERA
Dim EsValidoMayor As Boolean = False
'VALIDA PROMOCIONES Y EXISTENCIAS
@@ -3321,7 +3322,7 @@ Partial Class PV
Dim ObjInventarios As New ClsInventarios
Dim PU = 0.0D
Dim PU As Decimal = 0
For Each dr As DataRow In TmpDT.Rows
'SI ES SERVICIO NO VALIDA
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveTipoPS").ToString.ToEntero = 1 Then
@@ -3450,7 +3451,7 @@ Partial Class PV
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim urlFactura As String = ""
Dim urlAjuste = ""
Dim urlAjuste As String = ""
Dim SbAlert As New StringBuilder
Try
@@ -3536,7 +3537,7 @@ Partial Class PV
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
End If
For Each Mensaje In Retorno.Mensajes
For Each Mensaje As String In Retorno.Mensajes
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV), ShowCloseButton:=False)
Next
@@ -3553,14 +3554,14 @@ Partial Class PV
End Sub
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim Url As New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim File As Byte() = Nothing
Try
Using httpClient = New HttpClient()
Using httpClient As New HttpClient()
httpClient.Timeout = New TimeSpan(0, 15, 0)
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
Using request As New HttpRequestMessage(HttpMethod.Get, Url)
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario=100", CveEmpresa, DateTime.UtcNow.Ticks)))
Dim response = httpClient.SendAsync(request).Result
Dim response As HttpResponseMessage = httpClient.SendAsync(request).Result
If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
File = response.Content.ReadAsByteArrayAsync().Result
End If
@@ -3810,12 +3811,12 @@ Partial Class PV
ObjFactura.CveAlmacenServicioDomicilio = ddlAlmacen.SelectedValue.ToEntero() 'GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 29 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString.ToEntero
'PREPARA DT INVENTARIO
Dim DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
Dim DtInv As DataTable = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
For Each GvRow As GridViewRow In GvInv.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
Dim filtro = DtInv.Select(String.Format("CvePS = {0} AND Consec = {1}", GvRow.DataKey("CvePS"), GvRow.DataKey("Consec")))
Dim filtro As DataRow() = DtInv.Select(String.Format("CvePS = {0} AND Consec = {1}", GvRow.DataKey("CvePS"), GvRow.DataKey("Consec")))
If filtro IsNot Nothing AndAlso filtro.Length > 0 Then
Dim Row = filtro(0)
Dim Row As DataRow = filtro(0)
Row("Serie") = GvRow.FCTextBox("TxtSerie").Text.Trim
End If
End If
@@ -4083,7 +4084,7 @@ Partial Class PV
Dim PrecioSugerido As Decimal = 0
PrecioSugerido = drPS("Precio").ToString.ToDecimal
If UsuarioActual.CveEmpresa.Contiene(80, 119) Then
Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero
Dim CvePrecioListaPS As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
@@ -4091,9 +4092,9 @@ Partial Class PV
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero)
Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero)
ObjInventarios.Dispose()
Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
Dim PorcentajePrecio As Decimal = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
@@ -4343,26 +4344,26 @@ Partial Class PV
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
Dim RowPorcentaje As DataRow = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
If RowPorcentaje IsNot Nothing Then
'(AHORA LOS DESCUENTOS SON ACUMULABLES)
'Descuento = 0
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
Dim PorcentajeProducto As Decimal = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
Dim PorcentajeProducto2 As Decimal = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
Dim PorcentajeProducto3 As Decimal = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
Dim TotalInicial As Decimal = (Cantidad * (PU)) '- Descuento
Dim TotalFinal = TotalInicial
Dim TotalFinal As Decimal = TotalInicial
'SI APLICA EL PRIMER DESCUENTO
If PorcentajeProducto > 0 Then
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
Dim Total2 = (TotalInicial - Descuento1)
Dim Total2 As Decimal = (TotalInicial - Descuento1)
'SI APLICA EL SEGUNDO DESCUENTO
If PorcentajeProducto2 > 0 Then
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
Dim Total3 = (Total2 - Descuento2)
Dim Total3 As Decimal = (Total2 - Descuento2)
'SI APLICA EL TERCER DESCUENTO
If PorcentajeProducto3 > 0 Then
@@ -4385,20 +4386,20 @@ Partial Class PV
'SI TIENE PRONTO PAGO CALCULA EL IMPORTE
If DdlTipoComprobante.SelectedValue = "Ing" AndAlso RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento
Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D
Dim PorcentajeProntoPago As Decimal = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D
ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2)
End If
End If
End If
Else
'If CveMarcaPS = 1092 Then ' E140 - alcalinas LTH
' Descuento = ((Cantidad * PU) * 0.183D).RoundSQL(2)
'End If
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)).RoundSQL(2)
End If
'Else
' 'If CveMarcaPS = 1092 Then ' E140 - alcalinas LTH
' ' Descuento = ((Cantidad * PU) * 0.183D).RoundSQL(2)
' 'End If
' If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
' Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)).RoundSQL(2)
' End If
End If
''condicion final, si es cambio de Vigencia, no aplica descuento
@@ -4699,14 +4700,14 @@ Partial Class PV
Exit Sub
End If
Dim CveTipoInv = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("Inv_CveMetodoInventario").ToEntero
Dim CveTipoInv As Integer = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("Inv_CveMetodoInventario").ToEntero
If Cantidad <> 1 And CveTipoInv = 5 AndAlso UsuarioActual.CveEmpresa <> 72 Then
Alert("El producto se tiene que dar salida por serie y producto por producto (Cantidad = 1).", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim AplicaSerie = CBool(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("AplicaSerie"))
Dim AplicaSerie As Boolean = CBool(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("AplicaSerie"))
If TmpDT.FiltraParametros("AsientoContableVentas <> '" & AsientoContableVentas.ToString & "'").Rows.Count = 0 Then
Dim Row As DataRow = Nothing
@@ -5211,10 +5212,10 @@ Partial Class PV
If Not CveContrato > 0 Then
'BANDERAS PARA VALIDACIONES
Dim EsValido = False
Dim EsValidoMayor = False
Dim CostoMenor = 0.0D
Dim CostoMayor = 0.0D
Dim EsValido As Boolean = False
Dim EsValidoMayor As Boolean = False
Dim CostoMenor As Decimal = 0.0D
Dim CostoMayor As Decimal = 0.0D
'PRECIO MINIMO
If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then
@@ -5331,7 +5332,7 @@ Partial Class PV
GvPSRowIndexEdit = GvRow.RowIndex
ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero
CveVentaDetalle = GvRow.DataKey("CveVentaDetalle").ToEntero
Dim EsCargo = CBool(GvRow.DataKey("EsCargo"))
Dim EsCargo As Boolean = CBool(GvRow.DataKey("EsCargo"))
LnkAgregarPS.Text = "Actualizar"
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
@@ -5476,7 +5477,7 @@ Partial Class PV
End If
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
Dim CvePS = DdlPS.SelectedValue.ToEntero
Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then
@@ -5494,9 +5495,9 @@ Partial Class PV
End If
Dim ObjDescuento As New Modelos.VentaDescuentos
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
ObjDescuento.ImporteDescuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero))
End If
'If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
' ObjDescuento.ImporteDescuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero))
'End If
ObjDescuento = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
@@ -5512,7 +5513,7 @@ Partial Class PV
Proyecto = RowSP("Proyecto").ToString
End If
Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
Dim Consec As Integer = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
@@ -5548,7 +5549,7 @@ Partial Class PV
Exit Sub
End If
Dim Total = 0.0D
Dim Total As Decimal = 0.0D
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal
Dim Porcentaje As Decimal = Descuento / TmpDT.SUMD("Total")
Dim LastDr As DataRow = Nothing
@@ -5661,7 +5662,7 @@ Partial Class PV
#Region "CALCULA TOTALES"
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
Dim TmpDT = Me.TmpDT.FiltraParametros("EliminarDB = False", Orderby:="Consec")
Dim TmpDT As DataTable = Me.TmpDT.FiltraParametros("EliminarDB = False", Orderby:="Consec")
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
@@ -5744,7 +5745,7 @@ Partial Class PV
Dim Cuerpo As String = String.Empty
Dim ResultadoMail As Integer = 0
Dim TipoComprobante = ""
Dim TipoComprobante As String = ""
If DdlTipoComprobante.SelectedValue.ToString = "Ing" Then TipoComprobante = "Factura"
If DdlTipoComprobante.SelectedValue.ToString = "Egs" Then TipoComprobante = "Nota de Crédito"
@@ -6144,8 +6145,8 @@ Partial Class PV
DtPagos.Rows.RemoveAt(e.RowIndex)
'JJMQ 20160506: Validacion para no pagar de mas a peticion de I.P.
Dim abonado = DtPagos.SUM("Importe")
Dim saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado
Dim abonado As Decimal = DtPagos.SUMD("Importe")
Dim saldo As Decimal = TxtTotal.Text.Replace(",", "").ToDecimal - abonado
'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString
CargaGridContado()
@@ -6173,7 +6174,7 @@ Partial Class PV
'Pago en Efectivo
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
If DdlCuentaEfectivo.Items.Count > 0 Then
Dim DrEfectivo = DtPagos.NewRow
Dim DrEfectivo As DataRow = DtPagos.NewRow
DrEfectivo("CveTipoMovimiento") = 13
DrEfectivo("TipoMovimiento") = "Pago en Efectivo"
DrEfectivo("CveCuenta") = DdlCuentaEfectivo.SelectedValue
@@ -6192,7 +6193,7 @@ Partial Class PV
'Pago Tarjeta Credito
If TxtImporteCredito.Text.ToDecimal > 0 Then
If DdlCuentaTarjetaCredito.Items.Count > 0 Then
Dim DrCredito = DtPagos.NewRow
Dim DrCredito As DataRow = DtPagos.NewRow
DrCredito("CveTipoMovimiento") = 12
DrCredito("TipoMovimiento") = "Tarjeta de Crédito"
DrCredito("CveCuenta") = DdlCuentaTarjetaCredito.SelectedValue
@@ -6211,7 +6212,7 @@ Partial Class PV
'Pago Tarjeta Debito
If TxtImporteDebito.Text.ToDecimal > 0 Then
If DdlCuentaTarjetaDebito.Items.Count > 0 Then
Dim DrDebito = DtPagos.NewRow
Dim DrDebito As DataRow = DtPagos.NewRow
DrDebito("CveTipoMovimiento") = 11
DrDebito("TipoMovimiento") = "Tarjeta de Debito"
DrDebito("CveCuenta") = DdlCuentaTarjetaDebito.SelectedValue
@@ -6231,7 +6232,7 @@ Partial Class PV
'Pago Tarjeta Debito
If TxtImporteCheque.Text.ToDecimal > 0 Then
If DdlCuentaCheque.Items.Count > 0 Then
Dim DrCheque = DtPagos.NewRow
Dim DrCheque As DataRow = DtPagos.NewRow
DrCheque("CveTipoMovimiento") = 3
DrCheque("TipoMovimiento") = "Cheque"
DrCheque("CveCuenta") = DdlCuentaCheque.SelectedValue
@@ -6251,7 +6252,7 @@ Partial Class PV
'Pago Transferencia
If TxtImporteTransferencia.Text.ToDecimal > 0 Then
If DdlCuentaTransferencia.Items.Count > 0 Then
Dim DrCheque = DtPagos.NewRow
Dim DrCheque As DataRow = DtPagos.NewRow
DrCheque("CveTipoMovimiento") = 8
DrCheque("TipoMovimiento") = "Transferencia"
DrCheque("CveCuenta") = DdlCuentaTransferencia.SelectedValue
@@ -6281,7 +6282,7 @@ Partial Class PV
LimpiaEscondeContado()
End Sub
Private Function ValidaPagosContado() As Boolean
Dim Retorno = False
Dim Retorno As Boolean = False
If DtPagos.SUM("Importe").ToString.ToDecimal > TxtTotal.Text.ToDecimal Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
@@ -6308,13 +6309,13 @@ Partial Class PV
#Region " SERIE ALMACEN "
Protected Sub BtnSerie_Click(sender As Object, e As EventArgs)
Dim Row = CType(CType(sender, Button).NamingContainer, GridViewRow)
Dim Row As GridViewRow = CType(CType(sender, Button).NamingContainer, GridViewRow)
If Row.FCTextBox("TxtSerie").Text.Trim = "" Then Exit Sub
Dim Index = Row.RowIndex
Dim Index As Integer = Row.RowIndex
Dim ObjInventarios As New ClsInventarios
Dim Existencia = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString.Trim, ddlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
Dim Existencia As Decimal = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString.Trim, ddlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
ObjInventarios.Dispose()
'Valida Existencia
@@ -6334,9 +6335,9 @@ Partial Class PV
End Sub
Private Function ValidaSerieINV() As Boolean
Dim Retorno = False
Dim Existencia = 0.0
Dim ExistenciaActual = 0.0
Dim Retorno As Boolean = False
Dim Existencia As Decimal = 0
Dim ExistenciaActual As Decimal = 0
Dim ObjInventarios As New ClsInventarios
For Each Gvr As GridViewRow In GvInv.Rows
@@ -6351,7 +6352,7 @@ Partial Class PV
If Gvr.FCTextBox("TxtSerie").Visible = True And Gvr.FCTextBox("TxtSerie").Text.Trim <> "" Then
Existencia = ObjInventarios.GetExistenciasPSSerie(Gvr.FCTextBox("TxtSerie").Text.ToString, ddlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
ExistenciaActual = DtInv.SUMD("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
'Valida Existencia
If Existencia - ExistenciaActual < 0 Or Existencia = 0 Then
@@ -6562,7 +6563,7 @@ Partial Class PV
End If
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
Dim DtUsosCFDI As DataTable = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
If DtUsosCFDI.Rows.Count = 0 Then
Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
@@ -6582,7 +6583,7 @@ Partial Class PV
Dim ObjCliente As New ClsClientes
Dim TipoPersona As Boolean = If(RdTipoPersona.SelectedValue.ToEntero = 1, True, False)
Dim GeneroCliente = If(DdlGeneroCliente.SelectedValue.ToEntero = 1 Or DdlGeneroCliente.SelectedValue.ToEntero = -1, True, False)
Dim GeneroCliente As Boolean = If(DdlGeneroCliente.SelectedValue.ToEntero = 1 Or DdlGeneroCliente.SelectedValue.ToEntero = -1, True, False)
If ObjCliente.AgregarClienteNoFrecuente(TxtNombreCliente.Text.Trim, TxtDireccionCliente.Text.Trim, TxtNumExtCliente.Text.Trim, TxtNumIntCliente.Text.Trim,
TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, DdlEstadoSAT.SelectedValue.ToEntero,
@@ -6980,7 +6981,7 @@ Partial Class PV
DdlTipoDefecto.DataSource = GlobalDTAcumTiposDefecto(UsuarioActual.CveEmpresa)
DdlTipoDefecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
Dim DtTamanios = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltraParametros($" CvePSCargo > 0")
Dim DtTamanios As DataTable = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltraParametros($" CvePSCargo > 0")
CargaModelos()
CargaBCIAjuste()
@@ -7018,6 +7019,7 @@ Partial Class PV
DtModelosAuto = ObjGral.DtResultados
DdlModeloAuto.DataSource = DtModelosAuto
End If
ObjGral.Dispose()
DdlModeloAuto.DataBind()
DdlModeloAuto.Items.Insert(0, New ListItem("-", "-1"))
End Sub
@@ -7266,7 +7268,7 @@ Partial Class PV
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
@@ -7969,10 +7971,8 @@ Partial Class PV
End If
Dim ListaPScargo As New List(Of Modelos.MConceptoUsado)
Dim DTTamanios As DataTable = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa)
Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
Dim CveUnidadMedidaPSA As Integer = -1
Dim UnidadMedidaPSA As String = "Unidad"
@@ -8060,7 +8060,7 @@ Partial Class PV
Next
ObjProductosServicios.Dispose()
Dim ModalidadBack = Modalidad
Dim ModalidadBack As String = Modalidad
'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
If Modalidad = "U" Then
Modalidad = "A"