diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 164a4f081..5e89c8bcc 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -7566,6 +7566,17 @@ +
+ +
+ + + + + + +
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index bc3910a5a..605da78a2 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1839,6 +1839,15 @@ Partial Class Ventas ViewState("TieneDiasVencidos") = value End Set End Property + + Private Property DiasVencidosCliente As Integer + Get + Return IfNull(ViewState("DiasVencidosCliente"), "0", ViewState("DiasVencidosCliente")).ToString().ToEntero() + End Get + Set(value As Integer) + ViewState("DiasVencidosCliente") = value + End Set + End Property Private Property VentaSaldoAlmacen As Decimal Get Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal @@ -5515,6 +5524,7 @@ Partial Class Ventas ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString()) TieneDiasVencidos = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("TieneDiasVencidos").ToString()) + DiasVencidosCliente = ObjCliente.DtResultados.Rows(0)("DiasVencidosCliente").ToString().ToEntero() If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia) @@ -5923,7 +5933,7 @@ Partial Class Ventas DivVentasUsados.Visible = True Dim ObjClientes As New ClsClientes - If ObjClientes.GetHistorialVentas(CveCliente, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then + If ObjClientes.GetHistorialVentas(CveCliente, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1) Then DdlVentaUsado.DataSource = ObjClientes.DtResultados.FiltraParametros("UsadoMarcado = 0") End If ObjClientes.Dispose() @@ -7806,6 +7816,7 @@ Partial Class Ventas Dim TipoDocumentoAutorizacion As String = "" Dim ImporteAutorizacion As Decimal = 0 Dim TipoAutorizacion As Integer = 0 + Dim DiasVencidosAutorizacion As Integer = 0 Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero() Dim ObjVentas As New ClsVentas Try @@ -7823,6 +7834,7 @@ Partial Class Ventas ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal() CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero() + DiasVencidosAutorizacion = RowAutorizacion("DiasVencidos").ToString().ToEntero() End If End If @@ -7846,6 +7858,14 @@ Partial Class Ventas End If 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 @@ -16595,7 +16615,7 @@ Partial Class Ventas Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Descuentos Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal - If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then + If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso UsuarioActual.TienePermisoProceso(328) AndAlso Not TbDescuentosRNC.Visible Then TbDescuentosRNC.Visible = True End If @@ -18052,10 +18072,10 @@ Partial Class Ventas TotalSubTotalRef = TotalSubTotal - TotalDescuentos End If - If TotalAmortizacion > 0 AndAlso TotalSubTotalRef = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos + If TotalAmortizacion > 0 AndAlso TotalSubTotalRef = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos PorcentajeRetIVA If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then For Each dr As DataRow In TmpDT.Rows - dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0 + dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("PorcentajeIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("PorcentajeRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0 Next If TmpDTImpuestos IsNot Nothing Then @@ -24977,8 +24997,12 @@ Partial Class Ventas End Sub Private Sub CargaCxC() + Dim CveClienteSucursal As Integer = -1 + If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then + CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero() + End If Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero()) Then + If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, CveClienteSucursal:=CveClienteSucursal) Then Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto NOT IN ('RNC','Rem') AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento") GvCxC.DataSource = DtTemporal End If @@ -31583,8 +31607,17 @@ Partial Class Ventas UpModalSolicitud.Update() End Sub Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click + Dim DiasVencidos As Integer = 0 + Dim CveEstatus As Integer = 0 + Dim TipoDocto As String = DdlTipoDocto.SelectedValue + Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero() + + If CveTipoAutorizacion = 2 Then + DiasVencidos = TxtDiasVencidos.Text.ToEntero() + End If + Dim ObjPS As New ClsVentas - If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, DdlTipoAutorizacion.SelectedValue.ToEntero(), TipoDocumento:=DdlTipoDocto.SelectedValue) Then + If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos) Then RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) End If @@ -31593,6 +31626,7 @@ Partial Class Ventas End Sub Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 + DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2 UpModalSolicitud.Update() End Sub 'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged