From d7d0dd0dcd1a468c948b62297a3e67191dcc7f43 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 16 Oct 2020 12:12:33 -0700 Subject: [PATCH] Correcion BDH --- Acumuladores/CatFoliosGarantia.aspx | 596 ++++++++++++++----------- Acumuladores/CatFoliosGarantia.aspx.vb | 26 +- App_Code/ClsAcumuladores.vb | 19 + App_Code/Modelos.vb | 4 +- Ventas/Ventas.aspx | 34 +- Ventas/Ventas.aspx.vb | 33 +- 6 files changed, 436 insertions(+), 276 deletions(-) diff --git a/Acumuladores/CatFoliosGarantia.aspx b/Acumuladores/CatFoliosGarantia.aspx index fde6379a1..6d82dd232 100644 --- a/Acumuladores/CatFoliosGarantia.aspx +++ b/Acumuladores/CatFoliosGarantia.aspx @@ -1,190 +1,197 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatFoliosGarantia.aspx.vb" Inherits="Acumuladores_CatFoliosGarantia" %> - - - - - - - - Catálogo de Folios de Garantía - - - - - - -
  • - -
  • - -
    -
    -
    - - - - - - -
    -
    -
    - -
    -
    -
    - -
    - <%-- --%> - - - general - optima - motobateria - -
    - -
    - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    - -
    - - - - - - - -   - - - - -   - - - - -   - - - - -   - - - - - -   - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatFoliosGarantia.aspx.vb" Inherits="Acumuladores_CatFoliosGarantia" %> + + + + + + + + Catálogo de Folios de Garantía + + + + + + +
  • + +
  • + +
    +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    + <%-- --%> + + + general + optima + motobateria + +
    + +
    + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    + +
    + + + + + + + +   + + + + +   + + + + +   + + + + +   + + + + + +   + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +
    <%-- @@ -227,69 +234,74 @@ - --%> - - + +
    +
    + + + + + + +
    + + + + diff --git a/Acumuladores/CatFoliosGarantia.aspx.vb b/Acumuladores/CatFoliosGarantia.aspx.vb index 8647f5a96..f891e5530 100644 --- a/Acumuladores/CatFoliosGarantia.aspx.vb +++ b/Acumuladores/CatFoliosGarantia.aspx.vb @@ -216,12 +216,34 @@ Partial Class Acumuladores_CatFoliosGarantia RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolioGarantia")) - End Sub + End Sub + + Public Sub ImgVer_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveFolioGarantia = GvRow.DataKey("CveFolioGarantia") + LblFolio.Text = GvRow.DataKey("FolioGarantia") + + Using ObjAcum As New ClsAcumuladores + If ObjAcum.GetFoliosGarantiasDetalle(CveFolioGarantia) Then + GvGarantiasDetalle.DataSource = ObjAcum.DtResultados + End If + End Using + GvGarantiasDetalle.DataBind() + + UpGarantiasDetalle.Update() + + RegistraScript("$('#DivGarantiasDetalle').modal('show');") + + End Sub + + + + #End Region - + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, DdlTipoFolio.SelectedValue) End Sub diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index d2b74dfa7..7f2c2e6ca 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -1126,6 +1126,25 @@ Public Class ClsAcumuladores Return Retorno End Function + Public Function GetFoliosGarantiasDetalle(CveFolioGarantia As Integer) As Boolean + Dim Retorno As Boolean = False + + SqlDataAdapter("PA_Acum_GarantiasDetalleFolioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los movimientos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region " IDisposable Support " diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 220d9dcb6..1a6d06c81 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -1922,7 +1922,7 @@ Namespace Modelos For Each drow As DataRow In factura.DtDetalle.Rows If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then Resultado = False Exit For @@ -1935,7 +1935,7 @@ Namespace Modelos If factura.TipoDocto.Contiene("Rem") Then If factura.DtRecepcionUsados IsNot Nothing Then For Each drow As DataRow In factura.DtRecepcionUsados.Rows - If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then + If Not ObjVentas.AddVentaUsado(factura.CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then Resultado = False Exit For End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 83d578c62..5ac9815d2 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -7182,6 +7182,38 @@ } } + function CalculaSaldoRNCBonChk(TxtImporte, Saldo, Chk) { + if (Chk.checked) { + TxtImporte.value = FormatoNumero(Saldo, 2); + } else { + TxtImporte.value = ""; + } + } + function LimitaSaldoRNCBonChk(TxtImporte, Saldo) { + var Importe = 0; + + if (TxtImporte.value.includes('.')) { + return; + } + if (TxtImporte.value.includes(',')) { + return; + } + + var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$"); + + if (regex.test(TxtImporte.value)) { + if (TxtImporte.value != '') { + Importe = parseFloat(TxtImporte.value); + } + + if (Importe > Saldo) { + TxtImporte.value = FormatoNumero(Saldo, 2); + } else { + TxtImporte.value = FormatoNumero(Importe, 2);; + } + } + } + function CalculaTotalChk(Total, SubTotal, TxtTotalGv, TxtImporte, Saldo, Porcentaje, Chk) { var Importe = 0, ImporteSinPorcentaje = 0; Importe = ($('#C_DdlNCNivelImporte').val() == "1" ? Total : SubTotal); @@ -7629,7 +7661,7 @@ $get("TxtCambio").value = "0.00"; } - $get("TxtImporteContado").value = total; + $get("TxtImporteContado").value = total - totalRNC; } // **************************************************************************************************************************************************************************** diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 39ef4aaff..58f1d0fa1 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1791,6 +1791,15 @@ Partial Class Ventas End Set End Property + Private Property SerieVenta As String + Get + Return IfNull(ViewState("SerieVenta"), "", ViewState("SerieVenta")).ToString() + End Get + Set(value As String) + ViewState("SerieVenta") = value + End Set + End Property + #End Region '#Region "AuxiliarConta" @@ -4070,7 +4079,9 @@ Partial Class Ventas ViewState("FolioFiscal") = DbRowVenta("FolioFiscal").ToString() - LblSerie.Text = DbRowVenta("Serie").ToString() + + SerieVenta = DbRowVenta("Serie").ToString() + LblSerie.Text = SerieVenta ViewState("Serie") = DbRowVenta("Serie").ToString() ViewState("Folio") = DbRowVenta("Folio").ToString().ToEntero() TxtFolio.Text = DbRowVenta("Folio").ToString() @@ -15071,7 +15082,11 @@ Partial Class Ventas 'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString()) 'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString().ToDate ViewState("FolioActual") = DT.Rows(0)("FActual").ToString() - LblSerie.Text = DT.Rows(0)("Serie").ToString() + If UsuarioActual.CveEmpresa = 140 AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then + LblSerie.Text = SerieVenta + Else + LblSerie.Text = DT.Rows(0)("Serie").ToString() + End If TxtFolio.Text = DT.Rows(0)("FActual").ToString() BtnCrearApartirDe.Enabled = True BtnEmitirImprimir.Visible = True @@ -15126,7 +15141,13 @@ Partial Class Ventas 'ViewState("SubProyectoPorcentajeIVA") = dr("IVA") ViewState("TipoFormato") = dr("TipoFormato") ViewState("Serie") = dr("Serie") - LblSerie.Text = dr("Serie").ToString() + + If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then + LblSerie.Text = SerieVenta + Else + LblSerie.Text = dr("Serie").ToString() + End If + If SerieXML <> "" Then LblSerie.Text = SerieXML Dim CveSubProyecto As Integer = GetSubProyectoSucursal() If CveSubProyecto > 0 Then CargaSubProyecto(CveSubProyecto) @@ -23283,8 +23304,8 @@ Partial Class Ventas End Sub Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") - e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") + e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") + e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") End If End Sub @@ -26577,7 +26598,7 @@ Partial Class Ventas For Each drow As DataRow In factura.DtDetalle.Rows If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then Resultado = False Exit For