Autorizaciones con vencimiento, correcion en amortizacion con ret iva

This commit is contained in:
2021-07-21 12:35:30 -07:00
parent b4c9c62a34
commit c2ff0ed590
2 changed files with 51 additions and 6 deletions

View File

@@ -7566,6 +7566,17 @@
</asp:DropDownList> </asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label> <label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div> </div>
<div id="DivDiasVencidos" runat="server" visible="false" class="row">
<label class="col-md-2 truncate">Días Vencidos:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtDiasVencidos" Text="" runat="server" />
<ajax:FilteredTextBoxExtender ID="FTBDiasVencidos" runat="server" TargetControlID="TxtDiasVencidos" FilterType="Custom, Numbers" />
<asp:RequiredFieldValidator ID="RFVDiasVencidos" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Días Vencidos''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:RequiredFieldValidator ID="RFVDiasVencidos2" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" InitialValue="0" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El valor del campo <b>''Días Vencidos''</b> debe ser mayor a 0." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos2" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos2" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div id="DivImporteSolicitud" runat="server" class="form-group form-md-line-input input-iconright"> <div id="DivImporteSolicitud" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteSolicitud" inputmode="numeric" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="VgmGuardarAut" Width="200px" CssClass="form-control "></asp:TextBox> <asp:TextBox ID="TxtImporteSolicitud" inputmode="numeric" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="VgmGuardarAut" Width="200px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBImporteSolicitud" runat="server" TargetControlID="TxtImporteSolicitud" FilterType="Custom, Numbers" ValidChars="." /> <ajax:FilteredTextBoxExtender ID="FTBImporteSolicitud" runat="server" TargetControlID="TxtImporteSolicitud" FilterType="Custom, Numbers" ValidChars="." />

View File

@@ -1839,6 +1839,15 @@ Partial Class Ventas
ViewState("TieneDiasVencidos") = value ViewState("TieneDiasVencidos") = value
End Set End Set
End Property 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 Private Property VentaSaldoAlmacen As Decimal
Get Get
Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal
@@ -5515,6 +5524,7 @@ Partial Class Ventas
ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString()) ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString())
TieneDiasVencidos = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("TieneDiasVencidos").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 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) Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
@@ -5923,7 +5933,7 @@ Partial Class Ventas
DivVentasUsados.Visible = True DivVentasUsados.Visible = True
Dim ObjClientes As New ClsClientes 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") DdlVentaUsado.DataSource = ObjClientes.DtResultados.FiltraParametros("UsadoMarcado = 0")
End If End If
ObjClientes.Dispose() ObjClientes.Dispose()
@@ -7806,6 +7816,7 @@ Partial Class Ventas
Dim TipoDocumentoAutorizacion As String = "" Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0 Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0 Dim TipoAutorizacion As Integer = 0
Dim DiasVencidosAutorizacion As Integer = 0
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero() Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
Try Try
@@ -7823,6 +7834,7 @@ Partial Class Ventas
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal() ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero() TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
DiasVencidosAutorizacion = RowAutorizacion("DiasVencidos").ToString().ToEntero()
End If End If
End If End If
@@ -7846,6 +7858,14 @@ Partial Class Ventas
End If End If
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 'SI NO SE ENCONTRO NINGUA AUTORIZACION
If TipoAutorizacion = 0 Then If TipoAutorizacion = 0 Then
If TieneDiasVencidos 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 Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Descuentos
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal 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 TbDescuentosRNC.Visible = True
End If End If
@@ -18052,10 +18072,10 @@ Partial Class Ventas
TotalSubTotalRef = TotalSubTotal - TotalDescuentos TotalSubTotalRef = TotalSubTotal - TotalDescuentos
End If 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 If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
For Each dr As DataRow In TmpDT.Rows 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 Next
If TmpDTImpuestos IsNot Nothing Then If TmpDTImpuestos IsNot Nothing Then
@@ -24977,8 +24997,12 @@ Partial Class Ventas
End Sub End Sub
Private Sub CargaCxC() 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() 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") Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto NOT IN ('RNC','Rem') AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
GvCxC.DataSource = DtTemporal GvCxC.DataSource = DtTemporal
End If End If
@@ -31583,8 +31607,17 @@ Partial Class Ventas
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click 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 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')") RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If End If
@@ -31593,6 +31626,7 @@ Partial Class Ventas
End Sub End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged 'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged