This commit is contained in:
2025-01-14 20:54:32 -07:00
9 changed files with 2490 additions and 37 deletions

View File

@@ -2258,6 +2258,25 @@ Public Class ClsInventarios
Return Retorno
End Function
Public Function GetExistenciasPSVenta(CveVenta As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_ExistenciasVentaGET")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener las existencias de los almacenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False, Optional CveAlmacen As Integer = -1) As Boolean
Dim Retorno As Boolean = False

View File

@@ -5247,7 +5247,6 @@ Public Class ClsVentas
.Add("@Importe", SqlDbType.Money).Value = Importe
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
Try
@@ -5999,7 +5998,7 @@ Public Class ClsVentas
#End Region
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0, Optional Motivo As String = "", Optional PorcentajeDescuento As Decimal = 0, Optional CveVenta As Integer = -1) As Boolean
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0, Optional Motivo As String = "", Optional PorcentajeDescuento As Decimal = 0, Optional CveVenta As Integer = -1, Optional CveIE As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -6015,6 +6014,7 @@ Public Class ClsVentas
.Add("@PorcentajeDescuento", SqlDbType.Decimal).Value = PorcentajeDescuento
.Add("@Motivo", SqlDbType.VarChar).Value = Motivo
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveIE", SqlDbType.Int).Value = CveIE
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -1345,6 +1345,8 @@ Namespace Modelos
ObjFactura.CveSubProyectoCobranza = CveSubProyecto.ToEntero
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto.ToEntero
ObjFactura.CveMoneda = CveMoneda
'DETALLES
ObjFactura.DtDetalle = CreaDTFactura()

View File

@@ -1617,18 +1617,19 @@ Partial Class PopUpVerFactura
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveVenta={CveVenta}"),
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveIE={CveIE}"))
Folio = If(CveVenta > 0,
DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveVenta={CveVenta}"),
DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveIE={CveIE}"))
If CveIE > 0 Then
CveVenta = DatosSaldoAntNCDev.FiltroPrimeroValor("CveVenta", $"CveIE={CveIE}").ToEntero
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveIE={CveIE}")
Else
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveVenta={CveVenta}")
End If
End If
If TipoDocto.Contiene("Egs", "Dev", "Ant") Then
If TipoDocto.Contiene("Egs", "Dev", "Ant", "NC") Then
Dim AplicaAmortizacion As Boolean = False
If TipoDocto.Contiene("Ant") Then AplicaAmortizacion = True
@@ -1648,31 +1649,9 @@ Partial Class PopUpVerFactura
Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
If DbRowVenta IsNot Nothing Then
'Dim VentaActual As New Venta(UsuarioActual)
'VentaActual.CveVenta = CveVentaAmortizada
'VentaActual.TipoDocto = DbRowVenta("TipoDocto").ToString
'VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate
'VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
'VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
'VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString
'VentaActual.ClienteNombre = DbRowVenta("ClienteNombre").ToString
'VentaActual.TC = DbRowVenta("TipoCambio").ToString.ToDecimal
'VentaActual.Total = DbRowVenta("Total").ToString.ToDecimal
'VentaActual.IVA = DbRowVenta("IVA").ToString.ToDecimal
'VentaActual.IEPS = DbRowVenta("IEPS").ToString.ToDecimal
'VentaActual.RetIVA = DbRowVenta("RetIVA").ToString.ToDecimal
'VentaActual.RetISR = DbRowVenta("RetISR").ToString.ToDecimal
'VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
'VentaActual.UsuarioActual = UsuarioActual
'VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
'VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
'VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString
params.Add(New ReportParameter("SerieFolio", DbRowVenta("SerieFolio").ToString))
params.Add(New ReportParameter("Moneda", DbRowVenta("Moneda").ToString))
params.Add(New ReportParameter("Cliente", DbRowVenta("Cliente").ToString))
params.Add(New ReportParameter("Cliente", DbRowVenta("ClienteNombre").ToString))
End If
@@ -1685,26 +1664,23 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
'params.Add(New ReportParameter("FechaInicio", FechaI))
'params.Add(New ReportParameter("FechaFin", FechaF))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString))
'params.Add(New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Grupo}{FechaIn}{FechaFn}"))
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("SaldoAntNCDev", SaldoAntNCDev.ToString))
params.Add(New ReportParameter("Monto", Monto.ToString))
params.Add(New ReportParameter("Saldo", Saldo.ToString))
params.Add(New ReportParameter("Folio", Folio))
Dim NombreArchivo As String = "SaldoAntNCDev.rdlc"
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo))
If Archivo.Exists Then
ImprimirPDF(Archivo.FullName, DTNCVinculadas, params, "OrdenesdeCompraporvincular ", Opcion)
ImprimirPDF(Archivo.FullName, DTNCVinculadas, params, "Aplicaciones", "PDF")
Else
ImprimirPDF($"Empresas/Grales/Formatos/{NombreArchivo}", DTNCVinculadas, params, "OrdenesdeCompraporvincular", Opcion)
ImprimirPDF($"Empresas/Grales/Formatos/{NombreArchivo}", DTNCVinculadas, params, "Aplicaciones", "PDF")
End If
End If

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -876,6 +876,34 @@ Partial Class Ventas_PVCobranza
If Not String.IsNullOrEmpty(MsgTimbrado) Then
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End If
If respNC IsNot Nothing Then
For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
respNC.Factura.CveCliente,
respNC.CveVenta,
respNC.Factura.Total,
(respNC.Factura.Total - respNC.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>")
Next
Else
For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
respFactura.Factura.CveCliente,
respFactura.CveVenta,
respFactura.Factura.Total,
(respFactura.Factura.Total - respFactura.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>")
Next
End If
Else
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1&REGENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
End If
@@ -992,6 +1020,13 @@ Partial Class Ventas_PVCobranza
End If
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, VentaRemision.CveSubProyecto, VentaRemision.CveCliente, VentaRemision.CveMoneda, "Ing")
ObjFactura.CveMoneda = VentaRemision.CveMoneda
If ObjFactura.CveMoneda = 2 Then
ObjFactura.TipoCambio = GlobalTipoCambio(Now).ToString().ToDecimal()
Else
ObjFactura.TipoCambio = 1
End If
ObjFactura.RemisionesLista = RemisionesLista
ObjFactura.DtRemisionesPS = DtRemisionesPS
@@ -1132,7 +1167,7 @@ Partial Class Ventas_PVCobranza
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
For Each dr As DataRow In DtAnticipos.Rows
SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA{1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
Retorno.Factura.CveCliente,
@@ -1199,6 +1234,7 @@ Partial Class Ventas_PVCobranza
End If
Return Retorno
End Function
Private Function ValidateString(texto As String, contenidoValidar As String) As Boolean
@@ -1213,6 +1249,12 @@ Partial Class Ventas_PVCobranza
Try
Dim ObjNC = Modelos.Factura.CrearVentaNueva(UsuarioActual, Venta.CveSubProyecto, Venta.CveCliente, Venta.CveMoneda, "Egs")
ObjNC.CveMoneda = Venta.CveMoneda
If ObjNC.CveMoneda = 2 Then
ObjNC.TipoCambio = GlobalTipoCambio(Now).ToString().ToDecimal()
Else
ObjNC.TipoCambio = 1
End If
Dim Total As Decimal = TxtNCDev.Text.ToDecimal()
Dim subTotal As Decimal = (Total / (1D + Venta.PorcentajeIVA))
@@ -1391,6 +1433,10 @@ Partial Class Ventas_PVCobranza
OnError("Ocurrió un error al generar el timbrado", ex)
End Try
If Not String.IsNullOrEmpty(MsgErrorTimbrado) Then
GuardaLogAD(MsgErrorTimbrado, Archivo:="LogTimbrado")
End If
Return MsgErrorTimbrado
End Function

View File

@@ -108,6 +108,9 @@
padding-left: 28px;
}
.titulops {
width: 300px !important;
}
.GVAnticipos input {
text-align: right;
@@ -411,6 +414,9 @@
<asp:LinkButton ID="LnkCalcularPromociones" runat="server" CausesValidation="False" Text="<i class='fa fa-tag'></i> Aplicar promociones" OnClick="LnkCalcularPromociones_Click"
data-toggle="confirmation" data-popout="true" data-original-title="¿Aplicar Promociones?" data-btn-ok-label="si" />
</li>
<li>
<asp:LinkButton ID="LbVerificarExistencia" Visible="false" runat="server"><i class='fa fa-list-alt'></i>Verificar Existencias</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
@@ -1982,7 +1988,7 @@
<asp:TemplateField>
<HeaderTemplate>Producto</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serie" Visible="false">
@@ -9281,6 +9287,29 @@
</div>
</div>
<div id="DivModalExistenciaTotal" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Existencias</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UPExist" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvExist" runat="server" AutoGenerateColumns="true" GridLines="None" BorderWidth="0" CssClass="table table-striped table-hover Widthall">
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -5461,6 +5461,10 @@ Partial Class Ventas
UPCondicionesPago.Update()
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DbRowVenta("TipoDocto").ToString().Contiene("Cot", "Rem") Then
LbVerificarExistencia.Visible = True
End If
'ESCONDE ACCIONES
LnkRemisiones.Visible = False
LnkPedido2SinFacturar.Visible = False
@@ -40627,5 +40631,70 @@ Partial Class Ventas
End If
End Sub
Private Sub LbVerificarExistencia_Click(sender As Object, e As EventArgs) Handles LbVerificarExistencia.Click
'RegistraScript(String.Format("AbrirVentana('/Inventarios/PopUpExistenciasAlmacenDT.aspx?CveOrdenCompra={0}',800,547,'N');", CveOrdenCompra))
VerificarExistencias()
End Sub
Private Sub VerificarExistencias()
Dim objInv As New ClsInventarios
Dim tmpDTPS As DataTable = Nothing
If objInv.GetExistenciasPSVenta(CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
tmpDTPS = objInv.DtResultados.Copy()
End If
objInv.Dispose()
If tmpDTPS IsNot Nothing Then
' limpio los almacenes donde no tiene ningun producto existencia
For i As Integer = tmpDTPS.Columns.Count - 1 To 1 Step -1
If Not tmpDTPS.Columns(i).ColumnName.Contiene("Producto") AndAlso tmpDTPS.SUM(String.Format("[{0}]", tmpDTPS.Columns(i).ColumnName)) = 0 Then
tmpDTPS.Columns.RemoveAt(i)
End If
Next
Dim DtExistencias = tmpDTPS.Clone()
For i As Integer = 0 To DtExistencias.Columns.Count - 1
If DtExistencias.Columns(i).DataType <> GetType(String) Then DtExistencias.Columns(i).DataType = GetType(String)
Next
For Each dr As DataRow In tmpDTPS.Rows
DtExistencias.ImportRow(dr)
Next
'FORMATEAR NUEVO DT
For j = 0 To DtExistencias.Rows.Count - 1
For i As Integer = DtExistencias.Columns.Count - 1 To 1 Step -1
If Not DtExistencias.Columns(i).ColumnName.Contiene("Producto") Then
If DtExistencias.Rows(j)(i).ToString().ToEntero() = 0 Then
DtExistencias.Rows(j)(i) = "-"
Else
DtExistencias.Rows(j)(i) = DtExistencias.Rows(j)(i).ToString().Replace(".0000", "")
End If
End If
Next
Next
GvExist.DataSource = DtExistencias
GvExist.DataBind()
'GvExist.Columns(0).ItemStyle.Width = New Unit(200, UnitType.Pixel)
'ORDENA HACIA LA DERECHA LAS CANTIDAD - OJO!! NO SE USO GV.COLUMNS.COUNT PORQUE LAS COLUMNAS GENERADAS EN BEHIND NO LAS RECONOCE
For index As Integer = 0 To DtExistencias.Columns.Count - 1
For Each gvr As GridViewRow In GvExist.Rows
If index = 0 Then
gvr.Cells(index).CssClass = "titulops"
Else
gvr.Cells(index).HorizontalAlign = HorizontalAlign.Right
End If
Next
Next
End If
RegistraScript("$('#DivModalExistenciaTotal').modal('show');")
UPExist.Update()
End Sub
End Class