-- funcionalidad para comparar ultimo costo vs precio lista
-- funcionalidad para validar conceptos 85111506 en anticipos
This commit is contained in:
@@ -1266,7 +1266,7 @@
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-3" id="TagPromocion" runat="server" visible='<%# If(UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso CInt(Extensiones.IfNull(Eval("CvePromocionDetalle"), 0)) > 0, "true", "false") %>'>
|
||||
<div class="col-md-3" id="TagPromocion" runat="server" visible='<%# If(CInt(Extensiones.IfNull(Eval("CvePromocionDetalle"), 0)) > 0, "true", "false") %>'>
|
||||
<i class="fa fa-tag" aria-hidden="true" style="color: #E43A45"></i>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
|
||||
@@ -3789,7 +3789,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.TienePermisoProceso(384) Then
|
||||
Dt = ObjVta.DtResultados.Copy()
|
||||
Else
|
||||
Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'")
|
||||
Dt = ObjVta.DtResultados '.FiltraParametros("Restringuida = 'False'")
|
||||
End If
|
||||
|
||||
DdlPrecioLista.DataSource = Dt
|
||||
@@ -8921,7 +8921,7 @@ Partial Class Ventas
|
||||
e.Row.FCLinkButton("imgE").Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
e.Row.FCLinkButton("LnkDescuentos").Visible = True
|
||||
If e.Row.DBCampo("TipoDocto") = "Cot" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe Then
|
||||
e.Row.FCLinkButton("imgClone").Visible = False
|
||||
@@ -9095,6 +9095,16 @@ Partial Class Ventas
|
||||
Dim DatarowPS As DataRow = Nothing
|
||||
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(601) = "1" Then 'valida anticipo que tenga conceptos válidos
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
|
||||
If PSCodigoSAT <> "84111506" Then
|
||||
Alert($"El producto y/o servicio no es válido para generar anticipos.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim PrecioLibre As Boolean = False
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
@@ -9105,14 +9115,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
|
||||
If PSCodigoSAT <> "84111506" Then
|
||||
Alert($"El producto y/o servicio no es valido para generar anticipos", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'verifica si tiene ventaminima
|
||||
@@ -9124,7 +9126,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'si es remisión, ingreso, anticipo debe de considerar el preciominimo
|
||||
|
||||
If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
|
||||
@@ -9159,12 +9160,21 @@ Partial Class Ventas
|
||||
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
|
||||
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
|
||||
End If
|
||||
Dim Costo As Decimal
|
||||
|
||||
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -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 Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
|
||||
If UsuarioActual.Empresa.Funcionalidad(602) = "UC" Then 'validación sobre el último costo
|
||||
|
||||
If ObjInventarios.GetUltimoCosto(UsuarioActual.CveEmpresa, CvePS) Then
|
||||
Dim dr As DataRow = ObjInventarios.DtResultados.FiltroPrimero("")
|
||||
If dr IsNot Nothing Then
|
||||
Costo = dr("UltimoCosto").ToString.ToDecimal
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -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 Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
Dim PrecioMinimo As Decimal = 0
|
||||
'RMF. condicion temporal, para reubicación, precio mínimo
|
||||
@@ -9183,7 +9193,7 @@ Partial Class Ventas
|
||||
|
||||
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
||||
'VALIDA EXISTENCIA
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197}) Then
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197, 189}) Then
|
||||
'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT
|
||||
If CveVenta <= 0 Then
|
||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||
@@ -9276,7 +9286,7 @@ Partial Class Ventas
|
||||
|
||||
If Not PrecioLibre Then
|
||||
If Not EsValido Then
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString())
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("CodigoPS").ToString())
|
||||
If TienePermisoImportes Then
|
||||
MensajeCosto.AppendFormat("El costo del producto es: <b>${0:#,###.00}</b> <br/>", Costo)
|
||||
MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% <b>${1}</b> <br/>", PorcentajeMinimoCostoEmpresa, CostoMenor)
|
||||
@@ -10247,8 +10257,18 @@ Partial Class Ventas
|
||||
EsValidoMayor = False
|
||||
EsValidoPU = True
|
||||
PU = dr("PU").ToString().ToDecimal * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal)
|
||||
Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString().ToEntero(), dr("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(602) = "UC" Then 'validación sobre el último costo
|
||||
|
||||
If ObjInventarios.GetUltimoCosto(UsuarioActual.CveEmpresa, dr("CvePS").ToString().ToEntero()) Then
|
||||
Dim drps As DataRow = ObjInventarios.DtResultados.FiltroPrimero("")
|
||||
If drps IsNot Nothing Then
|
||||
Costo = drps("UltimoCosto").ToString.ToDecimal
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString().ToEntero(), dr("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
|
||||
End If
|
||||
Dim PrecioMinimo As Decimal = 0
|
||||
'RMF. condicion temporal, para reubicación, precio mínimo
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
@@ -10320,7 +10340,7 @@ Partial Class Ventas
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
If Not EsValido Then
|
||||
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado<br/>", dr("PS").ToString())
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado<br/>", dr("CodigoPS").ToString())
|
||||
If TienePermisoImportes Then
|
||||
MensajeCosto.AppendFormat("El costo del producto es: <b>{0:#,###.00}$</b> <br/>", Costo)
|
||||
MensajeCosto.AppendFormat("El rango menor aceptado es: {0} <b>{1:#,###.00}$</b> <br/>", PorcentajeMinimoCostoEmpresa, CostoMenor)
|
||||
@@ -10484,22 +10504,24 @@ Partial Class Ventas
|
||||
If ValidaPagosContado(TipoDoctoViejo:=TipoDoctoViejo) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'validaciones, si es Anticipo solo permitir "servicios de facturación" y si es ingreso todos menos serv. factu
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
Dim tCont As Integer = TmpDT.FiltraParametros("SATClaveProdServ='84111506'").Rows.Count
|
||||
If tCont > 0 Then
|
||||
Alert("Existen productos con código SAT '84111506' no permitido al facturar ingresos.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(601) <> "" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(601) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Ant" Then 'valida anticipo que tenga conceptos válidos
|
||||
Dim tCont As Integer = TmpDT.FiltraParametros("SATClaveProdServ<>'84111506'").Rows.Count
|
||||
If tCont > 0 Then
|
||||
Alert("Al facturar 'Anticipos' solo son permitidos código SAT '84111506'.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(601) = "2" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
Dim tCont As Integer = TmpDT.FiltraParametros("SATClaveProdServ='84111506'").Rows.Count
|
||||
If tCont > 0 Then
|
||||
Alert("Existen productos con código SAT '84111506' no permitido al facturar ingresos.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT
|
||||
@@ -19365,8 +19387,8 @@ Partial Class Ventas
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedorSucursal.DataBind()
|
||||
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Sin Asignar"))
|
||||
DdlVendedorSucursal.Items.Insert(0, New ListItem("Sin Asignar"))
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Sin Asignar", "-1"))
|
||||
DdlVendedorSucursal.Items.Insert(0, New ListItem("Sin Asignar", "-1"))
|
||||
|
||||
DdlVendedor.SelectedValueExist("0")
|
||||
DdlVendedorSucursal.SelectedValueExist("0")
|
||||
@@ -19478,6 +19500,8 @@ Partial Class Ventas
|
||||
|
||||
Dim PrecioLibre As Boolean = False
|
||||
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DatarowPS IsNot Nothing Then
|
||||
@@ -19548,13 +19572,23 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If ValidaExistenciasCosto Then
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
|
||||
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -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 Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
Dim Costo As Decimal
|
||||
If UsuarioActual.Empresa.Funcionalidad(602) = "UC" Then 'validación sobre el último costo
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
If ObjInventarios.GetUltimoCosto(UsuarioActual.CveEmpresa, CvePS) Then
|
||||
Dim dr As DataRow = ObjInventarios.DtResultados.FiltroPrimero("")
|
||||
If dr IsNot Nothing Then
|
||||
Costo = dr("UltimoCosto").ToString.ToDecimal
|
||||
End If
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
Else
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -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 Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
|
||||
ObjInventarios.Dispose()
|
||||
End If
|
||||
|
||||
Dim PrecioMinimo As Decimal = 0
|
||||
'RMF. condicion temporal, para reubicación, precio mínimo
|
||||
@@ -19563,12 +19597,8 @@ Partial Class Ventas
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) Then
|
||||
PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal
|
||||
'If PrecioMinimo > 0 Then
|
||||
' Costo = PrecioMinimo
|
||||
'End If
|
||||
End If
|
||||
objPS.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1
|
||||
@@ -19576,10 +19606,9 @@ Partial Class Ventas
|
||||
If ValidaExistencia Then
|
||||
|
||||
'VALIDA EXISTENCIA
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197}) Then
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197, 189}) Then
|
||||
|
||||
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
|
||||
|
||||
Dim Existencia As Decimal = 0D
|
||||
|
||||
Using ObjInv2 As New ClsInventarios
|
||||
@@ -19614,7 +19643,6 @@ Partial Class Ventas
|
||||
StrAlmacen.AppendFormat("<br/>Almacén: {0}", Almacen)
|
||||
End If
|
||||
End If
|
||||
|
||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
@@ -19842,7 +19870,6 @@ Partial Class Ventas
|
||||
If CantMinima > 0 Then
|
||||
Cant = Math.Floor(Cantidad / CantMinima).ToEntero()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
TotalPromocion = Math.Round(PUPromocion * Cant / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
|
||||
@@ -19857,16 +19884,21 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ElseIf TipoPromo = 2 Then 'Promocion por %
|
||||
Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad)
|
||||
If TipoAplicacion = 2 Then
|
||||
Descuento = 0
|
||||
SeAjustoPU = True
|
||||
PUModificado = Math.Round((PU - (PU * PromocionPorcentaje / 100D)) / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
|
||||
Else
|
||||
Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad)
|
||||
End If
|
||||
ElseIf TipoPromo = 3 Then 'Promocion por Cantidad
|
||||
If Cantidad >= CantMinima Then
|
||||
If Cantidad >= CantMinima Then
|
||||
Descuento = Descuento + TotalPromocion
|
||||
Else
|
||||
CvePromocionDetalle = -1
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
||||
@@ -19919,7 +19951,6 @@ Partial Class Ventas
|
||||
|
||||
ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2)
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -19953,7 +19984,6 @@ Partial Class Ventas
|
||||
'YOKOHAMA
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso CveRinTamañoPS > 0 AndAlso CveMarcaPromocion.Contiene(800, 912, 1238, 1381, 1456, 1528, 1600, 1672, 1807) Then
|
||||
|
||||
|
||||
If CveMarcaPromocion > 0 Then
|
||||
ObjDescuento.NombrePromo = "YOKOHAMA VERANO" 'dr("NombrePromocion").ToString()
|
||||
ObjDescuento.CveMarca = CveMarcaPromocion
|
||||
|
||||
Reference in New Issue
Block a user