diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index edb2a98cf..c5853d946 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8293,11 +8293,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 @@ -9714,6 +9714,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 @@ -9874,7 +9876,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) @@ -9904,6 +9906,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) @@ -10693,6 +10700,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 @@ -11745,15 +11753,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 @@ -21595,7 +21603,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 @@ -21638,7 +21646,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 @@ -32019,7 +32028,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