This commit is contained in:
@@ -6614,7 +6614,7 @@ Partial Class Ventas
|
||||
'RMF. validacion temporal
|
||||
'verifica si tiene autorizaciones de Nota de crédito autorizadas
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Ing", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
|
||||
@@ -7957,7 +7957,7 @@ Partial Class Ventas
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Try
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, DdlTipoDocto.SelectedValue, CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
||||
If TieneDiasVencidos Then
|
||||
@@ -8312,11 +8312,11 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ValidaPagosContado() Then
|
||||
If ValidaPagosContado(TipoDoctoViejo:=TipoDoctoViejo) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
CreaObjetosVenta()
|
||||
CreaObjetosVenta(TipoDoctoViejo:=TipoDoctoViejo)
|
||||
|
||||
'Verifica versión 3.3.()
|
||||
If ObjFactura.Version = "3.3" AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then
|
||||
@@ -9733,6 +9733,8 @@ Partial Class Ventas
|
||||
|
||||
If NCDescuento Then
|
||||
|
||||
factura.Num3 = 1000 ' MARCADA PARA AUMENTAR EL FOLIO
|
||||
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
DtVentasNC.Rows(IndexNC)("Importe") = factura.Total
|
||||
DtVentasNC.Rows(IndexNC)("TC") = factura.TipoCambio
|
||||
@@ -9893,7 +9895,7 @@ Partial Class Ventas
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False, Optional EsCancelacion As Boolean = False)
|
||||
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False, Optional EsCancelacion As Boolean = False, Optional TipoDoctoViejo As String = "")
|
||||
|
||||
If Me.CveVenta > 0 AndAlso NuevaFactura <> 1 Then
|
||||
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=EsCancelacion)
|
||||
@@ -9923,6 +9925,11 @@ Partial Class Ventas
|
||||
'si es cancelacion, debe de conservar el folio actual
|
||||
If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero(), -1)
|
||||
|
||||
'SI ES FACTURACION DE REMISION O COTIZACION NO TOMAR EL FOLIO QUE SE MUESTRA
|
||||
If Not EsCancelacion AndAlso ObjFactura.Folio > 0 AndAlso TipoDoctoViejo.Contiene("Rem", "Cot") Then
|
||||
ObjFactura.Folio = -1
|
||||
End If
|
||||
|
||||
'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1)
|
||||
ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text)
|
||||
|
||||
@@ -10712,6 +10719,7 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.Num1 = TxtNum1.Text.Trim.ToDouble
|
||||
ObjFacturaDevolucion.Num2 = TxtNum2.Text.Trim.ToDouble
|
||||
ObjFacturaDevolucion.Num3 = If(ObjFacturaDevolucion.TipoDocto = "OP", DdlOrdenPago.SelectedValue.ToDouble, TxtNum3.Text.Trim.ToDouble)
|
||||
|
||||
ObjFacturaDevolucion.FechaPago = TxtFechaPago.Text.ToDate
|
||||
|
||||
ObjFacturaDevolucion.CveCorte = CveCorte
|
||||
@@ -11764,15 +11772,15 @@ Partial Class Ventas
|
||||
Exit For
|
||||
Else
|
||||
'VERIFICAR QUE EL DESCUENTO NO PASE EL 40%
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Row("CveClasificacion").ToString().ToEntero() <> 20519 AndAlso (Not Row("Obs").ToString().Contains("Descuento por garantía")) Then
|
||||
Dim TotalDetalle = Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6)
|
||||
Dim DescuentoDetalle = Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))
|
||||
Dim PorcentajeDescuento As Double = (DescuentoDetalle / TotalDetalle) * 100D
|
||||
If PorcentajeDescuento > 40 Then
|
||||
ErrorList.Add(String.Format("El descuento del producto/servicio {0} no puede ser mayor al 40%. Porcentaje Actual: {1}%", Row("CodigoPS"), PorcentajeDescuento.RoundSQL(2)))
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Row("CveClasificacion").ToString().ToEntero() <> 20519 AndAlso (Not Row("Obs").ToString().Contains("Descuento por garantía")) Then
|
||||
' Dim TotalDetalle = Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6)
|
||||
' Dim DescuentoDetalle = Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))
|
||||
' Dim PorcentajeDescuento As Double = (DescuentoDetalle / TotalDetalle) * 100D
|
||||
' If PorcentajeDescuento > 40 Then
|
||||
' ErrorList.Add(String.Format("El descuento del producto/servicio {0} no puede ser mayor al 40%. Porcentaje Actual: {1}%", Row("CodigoPS"), PorcentajeDescuento.RoundSQL(2)))
|
||||
' Exit For
|
||||
' End If
|
||||
'End If
|
||||
'Agregamos el gasto de contrato
|
||||
If CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then
|
||||
|
||||
@@ -21614,7 +21622,7 @@ Partial Class Ventas
|
||||
Private Sub RBLPago_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLPago.SelectedIndexChanged
|
||||
LimpiaEscondeContado()
|
||||
End Sub
|
||||
Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True) As Boolean
|
||||
Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True, Optional TipoDoctoViejo As String = "") As Boolean
|
||||
Dim Retorno = False
|
||||
|
||||
Dim AmortizacionNC As Decimal = 0
|
||||
@@ -21657,7 +21665,8 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso RBLPago.SelectedValue = "2" AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
|
||||
'VALIDA PAGOS EN FACTURAS DE ING,ANT NUEVAS O FACTURACION DE REM O COTIZACIONES
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso RBLPago.SelectedValue = "2" AndAlso ((CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant")) OrElse TipoDoctoViejo.Contiene("Rem", "Cot")) Then
|
||||
|
||||
If Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
|
||||
If MostrarAlertas Then
|
||||
@@ -26930,15 +26939,47 @@ Partial Class Ventas
|
||||
Protected Sub BtnAplicarNC_Click(sender As Object, e As EventArgs)
|
||||
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
|
||||
If ClienteEsDistribuidor AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then
|
||||
Alert("No se puede generar una nota de crédito para devolución de efectivo si el cliente es distribuidor.", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
Dim Verificacion As Boolean = False
|
||||
|
||||
If ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0 Then ' si hay opciones seleccionadas, se activa el generar las NCs
|
||||
Verificacion = True
|
||||
Else
|
||||
If UsuarioActual.TienePermisoProceso(175) Then ' si es una nc, que se va a generar directa, el permiso de generar NC directas
|
||||
Verificacion = True
|
||||
Else
|
||||
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||
'verificar autorizaciones
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Egs", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL ", Orderby:="TipoAutorizacion")
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
Verificacion = True
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
' si es una nc, que se va a generar directa, debe de revisar que tenga una autorización, o el permiso de generar NC directas
|
||||
End If
|
||||
End If
|
||||
|
||||
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
|
||||
If Verificacion Then
|
||||
If ClienteEsDistribuidor AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then
|
||||
Alert("No se puede generar una nota de crédito para devolución de efectivo si el cliente es distribuidor.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||
End If
|
||||
Else
|
||||
Alert("No se puede Generar notas de crédito directas", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
Else
|
||||
AplicarNotaCreditoDesdeVenta()
|
||||
' si viene de remisiones, puede seguir adelante
|
||||
If Verificacion Then
|
||||
AplicarNotaCreditoDesdeVenta()
|
||||
Else
|
||||
Alert("No se puede Generar notas de crédito directas", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
AplicarNotaCreditoDesdeVenta()
|
||||
@@ -31534,6 +31575,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ListaRemisionesNC.Add(RemNC)
|
||||
BtnAplicarNC.Enabled = True
|
||||
|
||||
If TerminarCiclo Then
|
||||
Exit For
|
||||
@@ -31577,6 +31619,10 @@ Partial Class Ventas
|
||||
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
|
||||
'TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
|
||||
|
||||
If ListaRemisionesNC.Count > 0 Then ' si hay opciones seleccionadas, se activa el generar las NCs
|
||||
BtnAplicarNC.Enabled = True
|
||||
End If
|
||||
|
||||
UpModalRemisionesNC.Update()
|
||||
UpAplicarNC.Update()
|
||||
|
||||
@@ -32043,7 +32089,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
|
||||
Try
|
||||
If UsuarioActual.CveUsuario.Contiene(3033, 3491) Then
|
||||
If UsuarioActual.CveUsuario.Contiene(3491) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user