diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 36ef49c65..c0b1a6eb8 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6083,6 +6083,26 @@ Public Class ClsInventarios Return Retorno End Function + Public Function UpdateVentasDetalleNumeroPedimento(CveVenta As Integer, CveVentaDetalle As Integer, NumeroPedimento As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasDetalleNumeroPedimentoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle + .Add("@NumeroPedimento", SqlDbType.VarChar).Value = NumeroPedimento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el pedimento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region " IDisposable Support " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index a0626d3da..56877acac 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1476,11 +1476,14 @@ Public Class ClsVentas SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al actualizar el documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al eliminar el detalle de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function + + + #End Region #Region "V E N T A - P R E S U P U E S T O" diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index a5d315eef..cf452736c 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2519,21 +2519,12 @@ Partial Class Ventas TrObsAlmacen.Visible = False TrTxtObsAlmacen.Visible = False TrPedido.Visible = False - - - TrOC.Visible = False - - - DdlTipoComprobante.SelectedValue = "Op" Else Opcion = "Ing" DdlTipoComprobante.SelectedValue = "Ing" End If - - - 'DdlTipoComprobante.Attributes.Add("onChange", "ActivaReferencia(this)") TxtFecha.Text = Now.ToShortDateString() TxtFechaEjecucion.Text = Now.ToShortDateString @@ -10192,7 +10183,7 @@ Partial Class Ventas NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura) Dim ObjTimbradoNC As New Timbrado - Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada) + Dim TimbroNC As Boolean = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada) If Not TimbroNC Then Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError) @@ -12493,18 +12484,18 @@ Partial Class Ventas 'detalles Dim tPS As String If UsuarioActual.CveEmpresa = 119 Then - Dim ObjPed As New ClsInventarios - If ObjPed.GetVentasPedimento(CveVenta, UsuarioActual.CveEmpresa) Then - Dim dttped As DataTable = ObjPed.DtResultados - If Not Obj.DtDetalle.Columns.Contains("NumeroPedimento") Then - Obj.DtDetalle.Columns.Add("NumeroPedimento", Type.GetType("System.String")) - End If - For Each drt As DataRow In Obj.DtDetalle.Rows - Dim Pedimento As String = dttped.FiltroPrimeroValor("Pedimento", $"CveVentaDetalle = {drt("CveVentaDetalle")}") - drt("NumeroPedimento") = Pedimento - Next - End If - ObjPed.Dispose() + 'Dim ObjPed As New ClsInventarios + 'If ObjPed.GetVentasPedimento(CveVenta, UsuarioActual.CveEmpresa) Then + ' Dim dttped As DataTable = ObjPed.DtResultados + ' If Not Obj.DtDetalle.Columns.Contains("NumeroPedimento") Then + ' Obj.DtDetalle.Columns.Add("NumeroPedimento", Type.GetType("System.String")) + ' End If + ' For Each drt As DataRow In Obj.DtDetalle.Rows + ' Dim Pedimento As String = dttped.FiltroPrimeroValor("Pedimento", $"CveVentaDetalle = {drt("CveVentaDetalle")}") + ' drt("NumeroPedimento") = Pedimento + ' Next + 'End If + 'ObjPed.Dispose() End If For Each drr As DataRow In Obj.DtDetalle.Rows @@ -15106,8 +15097,19 @@ Partial Class Ventas OcurrioError = True ErrorList.Add("Ocurrió un error al guardar movimiento de almacen.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") End If - 'End If + 'E119, verifica si la salida está con ps de importación para que se guarde el pedimento + If UsuarioActual.CveEmpresa = 119 AndAlso factura.TipoDocto.Contiene("Ing") Then + + 'If ObjInventario.GetVentasPedimento(CveVenta, UsuarioActual.CveEmpresa) Then + ' Dim dttped As DataTable = ObjInventario.DtResultados + + ' For Each drt As DataRow In dttped.FiltraParametros("NumeroPedimento <> ''").Rows + + ' ObjVentas.UpdateVentasDetalleNumeroPedimento(factura.CveVenta, drt("CveVentaDetalle").ToString.ToEntero, drt("NumeroPedimento").ToString) + ' Next + 'End If + End If Else OcurrioError = True ErrorList.Add("Ocurrió un error al consultar los movimientos de almacen.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") @@ -15118,7 +15120,7 @@ Partial Class Ventas End If - 'DEBE GENERAR MOVIMIENTO SI SE FACTURAON PRODUCTOS, O NO SE REALIZA UNA REFACTURACION + 'DEBE GENERAR MOVIMIENTO SI SE FACTURARON PRODUCTOS, O NO SE REALIZA UNA REFACTURACION Dim DebeGenerarMovimiento As Boolean = TmpDT.COUNT("CvePS", "CveTipoPS = 2") > 0 AndAlso (NuevaFactura <> 1) 'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN If Not OcurrioError AndAlso DebeGenerarMovimiento AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then @@ -20319,6 +20321,16 @@ Partial Class Ventas OcurrioError = True End If End If + + If Not OcurrioError AndAlso UsuarioActual.CveEmpresa = 119 Then + If ObjInventario.GetVentasPedimento(CveVenta, UsuarioActual.CveEmpresa) Then + Dim dttped As DataTable = ObjInventario.DtResultados + + For Each drt As DataRow In dttped.FiltraParametros("Pedimento <> ''").Rows + ObjInventario.UpdateVentasDetalleNumeroPedimento(CveVenta, drt("CveVentaDetalle").ToString.ToEntero, drt("Pedimento").ToString) + Next + End If + End If Else OcurrioError = True End If @@ -32393,7 +32405,7 @@ Partial Class Ventas If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() - Dim PU = GvRow.DataKey("PU").ToDecimal() + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal() Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal() Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU) @@ -32459,7 +32471,7 @@ Partial Class Ventas 'SI TIENE ALGUN AJUSTE O GARANTIA If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then - For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1) + For Each RNC As Modelos.Factura In ListaRemisionesNC.Where(Function(x) x.Num2 = 1) Dim Salir As Boolean = False Using ObjAcum As New ClsAcumuladores @@ -32522,8 +32534,6 @@ Partial Class Ventas Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA) TotalRNC += TotalRNCDetalle - - End If End If @@ -32668,7 +32678,6 @@ Partial Class Ventas TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray) End If - Next End If End If