--BDH. FIX Autorizaciones de NC en bdh
--GDIAZ. Validacion ps para Ant --GDIAZ. Quitar amortización de anticipo por descuento
This commit is contained in:
@@ -969,7 +969,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left" id="TrMotivoDev" runat="server" visible="false">
|
||||
<td><b class="truncate">Motivo devolución:</b> </td>
|
||||
<td><b class="truncate">Motivo de devolución:</b> </td>
|
||||
<td>
|
||||
<asp:Label ID="lblMotivoDev" runat="server"></asp:Label></td>
|
||||
</tr>
|
||||
|
||||
@@ -8884,11 +8884,20 @@ 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(382) = "1" Then
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
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
|
||||
|
||||
@@ -9755,13 +9764,13 @@ Partial Class Ventas
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing"), CveEstatus:=1) Then
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Ing", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
||||
If TieneDiasVencidos Then
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='{If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing")}'", Orderby:="Importe DESC")
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='{"Ing"}'", Orderby:="Importe DESC")
|
||||
Else
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing")}'", Orderby:="Importe DESC")
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{"Ing"}'", Orderby:="Importe DESC")
|
||||
End If
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
@@ -9809,14 +9818,6 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
'If TipoAutorizacion = 2 Then
|
||||
' If DiasVencidosCliente > DiasVencidosAutorizacion Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito no esta autorizado. Los días vencidos del cliente son mayores a lo autorizado", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'SI NO SE ENCONTRO NINGUA AUTORIZACION
|
||||
If TipoAutorizacion = 0 Then
|
||||
If TieneDiasVencidos Then
|
||||
@@ -9827,21 +9828,57 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
'End If
|
||||
End If
|
||||
|
||||
'If TipoDocumentoAutorizacion = "Egs" Then
|
||||
' If TipoAutorizacion = 1 Then
|
||||
' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs") Then
|
||||
PermiteAutorizacion = False
|
||||
'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION
|
||||
If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then
|
||||
PermiteAutorizacion = True
|
||||
End If
|
||||
|
||||
If PermiteAutorizacion Then
|
||||
|
||||
Dim ImporteAutorizacion As Decimal = 0
|
||||
Dim TipoAutorizacion As Integer = 0
|
||||
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Egs", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="Importe DESC")
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
|
||||
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
|
||||
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If TipoAutorizacion = 1 Then
|
||||
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
|
||||
Dim BloquearCredito As Boolean = True
|
||||
CveAutorizacion = -1
|
||||
|
||||
If BloquearCredito Then
|
||||
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
CveAutorizacion = -1
|
||||
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
'VALIDAR LINEAS ADICIONALES
|
||||
@@ -16710,6 +16747,13 @@ Partial Class Ventas
|
||||
HdnTieneAnticipos.Value = "0"
|
||||
If CveCliente > 0 Then
|
||||
|
||||
'QUE NO SE PUEDA REALIZAR AMORTIZACIÓN DE ANTICIPO POR DESCUENTO
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") IsNot Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1"))
|
||||
End If
|
||||
End If
|
||||
|
||||
HdnIVACalculado.Value = "0"
|
||||
'SI ES REFACTURACION NO LIMPIAR EL FOLIO FISCAL
|
||||
If NuevaFactura <> 1 Then
|
||||
@@ -18810,13 +18854,24 @@ Partial Class Ventas
|
||||
Return False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DatarowPS IsNot Nothing Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
|
||||
If PSCodigoSAT <> "84111506" Then
|
||||
Alert($"El producto y/o servicio '{DatarowPS("CodigoPS").ToString}' no es valido para generar anticipos", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -38448,9 +38503,12 @@ Partial Class Ventas
|
||||
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("2"))
|
||||
End If
|
||||
Else
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1"))
|
||||
If Not (UsuarioActual.Empresa.Funcionalidad(382) = "1") Then
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1"))
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("2") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo con nota de crédito", "2"))
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user