diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx b/Acumuladores/RepEntradasUsadosClientes.aspx index c2da0c83c..2a92b403e 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx +++ b/Acumuladores/RepEntradasUsadosClientes.aspx @@ -3,6 +3,11 @@ + Reporte Entradas Usados Clientes @@ -80,7 +85,8 @@ - + <%--OnClick="CargarVentasGrupo"--%> + @@ -122,8 +128,8 @@ - - + + diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx.vb b/Acumuladores/RepEntradasUsadosClientes.aspx.vb index 75e36daaf..b21eba707 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx.vb +++ b/Acumuladores/RepEntradasUsadosClientes.aspx.vb @@ -102,6 +102,6 @@ Partial Class Acumuladores_RepEntradasUsadosClientes ObjAcum.Dispose() GvVentas.DataBind() - RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") + RegistraScript("$('#ModalVentasAvance').modal();") End Sub End Class diff --git a/App_Code/ClsCompProveedores.vb b/App_Code/ClsCompProveedores.vb index 2f2e2794e..bbbc1b8f1 100644 --- a/App_Code/ClsCompProveedores.vb +++ b/App_Code/ClsCompProveedores.vb @@ -1858,7 +1858,7 @@ Public Class ClsCompProveedores Return Retorno End Function - Public Function GetRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer) As Boolean + Public Function GetRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer, Optional CveProveedor As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1868,6 +1868,7 @@ Public Class ClsCompProveedores .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor End With diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index e0d5d3f62..08036f1b9 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -14,6 +14,7 @@ Imports System.Net Imports System.IO.Compression Imports System.Text Imports System.Net.Http +Imports System.Collections.Generic Namespace Modelos @@ -539,7 +540,64 @@ Namespace Modelos Public Property CveEstatus As Integer End Class - + Public Function RegenerarPrePolizas(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional ObjACTransac As ClsContPAQi = Nothing) As Boolean + Dim ErrorPrePolizas As Boolean = False + + Dim ObjVentas As ClsVentas = Nothing + If TransaccionCompartida IsNot Nothing Then + ObjVentas = New ClsVentas(TransaccionCompartida) + Else + ObjVentas = New ClsVentas() + ObjVentas.IniciaTransacSQL() + End If + + Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) + Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) + Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) + Dim ObjAC As ClsContPAQi = Nothing + + If ObjACTransac Is Nothing Then + If UsuarioActual.Empresa.UsaAC Then + ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() + End If + Else + ObjAC = ObjACTransac + End If + + ErrorPrePolizas = Not RegeneracionPolizas(Me, ObjVentas, ObjAC, ObjConta, ObjBancos, ObjEventos) + + If TransaccionCompartida Is Nothing Then + ObjVentas.Commit() + ObjVentas.Dispose() + ObjBancos.Dispose() + ObjEventos.Dispose() + End If + + If ObjACTransac Is Nothing Then + If ObjAC IsNot Nothing Then + ObjAC.Commit() + ObjAC.Dispose() + End If + End If + + Return Not ErrorPrePolizas + End Function + Private Function RegeneracionPolizas(ObjFactura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos, ObjEventos As ClsOIEventos) As Boolean + Dim ErrorPrePolizas As Boolean = False + + 'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA + ErrorPrePolizas = Not ObjConta.RemovePrePolizasDetalle(ObjFactura.CvePrePoliza, -1, ObjFactura.CveVenta, 2) + + 'VUELVE A GENERAR LAS PREPOLIZAS + If Not ErrorPrePolizas Then + ErrorPrePolizas = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, ValorMultiplicador:=1, ObjBancos:=ObjBancos, ObjVentas:=ObjVentas, ObjEventos:=ObjEventos, DtRemisionesRelacionadas:=New DataTable, SeCancelaRemisionProceso:=False, + CancelarRemisiones:=False, ListaRemisionesCancelar:=New List(Of Integer)) + End If + + If Not ErrorPrePolizas Then ErrorPrePolizas = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, 1) + + Return Not ErrorPrePolizas + End Function Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura Dim Retorno As New MMensajeFactura() @@ -1059,7 +1117,7 @@ Namespace Modelos Return Retorno End Function - Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = true) As Byte() + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim File As Byte() = Nothing Try @@ -6067,7 +6125,7 @@ Namespace Modelos End Set End Property - Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable + Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) @@ -6085,7 +6143,7 @@ Namespace Modelos GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get - + End Property Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable Get diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx index bcbcf062c..ae72b0047 100644 --- a/Compras/Proveedores.aspx +++ b/Compras/Proveedores.aspx @@ -603,6 +603,51 @@ --%> + +
+
+
+ + Representastes Legales + +
+
+
+
+
+ +
+ + + + +
+
+
+ + + + + + + + + + <%-- + + + + + --%> + + + + + +
+
+ diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 3036fa58f..b32464910 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -380,6 +380,9 @@ Partial Class Compras_Proveedores End If HlEvento.Visible = True HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveProveedor=" & CveProveedor & "&TB_iframe=true&height=370&width=600;" + + CargaRepresentantes() + Else 'Configuración de Modalidad Insert @@ -500,6 +503,30 @@ Partial Class Compras_Proveedores 'ViewState("OUsuario") = "Usuario DESC" End Sub + + Private Sub CargaRepresentantes() + + If CveProveedor > 0 Then + + Dim ObjProveedores As New ClsCompProveedores + + If ObjProveedores.GetRePresentanteLegal(-1, UsuarioActual.CveEmpresa, CveProveedor) Then + + GvRepresentante.DataSource = ObjProveedores.DtResultados + Else + GvRepresentante.DataSource = Nothing + End If + + ObjProveedores.Dispose() + + GvRepresentante.DataBind() + End If + + + End Sub + + + Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1) If UsuarioActual.Empresa.UsaContabilidad Then Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 3be76f987..1f3700713 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -787,7 +787,7 @@ Partial Class Inventarios_TraspasoAlmacen CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, CveChofer:=If(ChkTransitorio.Checked, DdlChofer.SelectedValue.ToEntero, -1), Placa:=If(ChkTransitorio.Checked, TxtPlaca.Text.Trim, "-1"), FechaEntrega:=If(ChkTransitorio.Checked, TxtFechaEntrega.Text.Trim.ToDateTime.ToString("dd/MM/yyyy"), "-1"), EspecifUnidad:=If(ChkTransitorio.Checked, TxtEspecifUnidad.Text.Trim, "-1"), ResponsableCarga:=If(ChkTransitorio.Checked, TxtResponsableCarga.Text.Trim, "-1"), ResponsableRecibio:=If(ChkTransitorio.Checked, TxtResponsableRecibio.Text.Trim, "-1"), Identificacion:=If(ChkTransitorio.Checked, TxtIdentificacion.Text.Trim, "-1"), Domicilio:=If(ChkTransitorio.Checked, TxtDomicilio.Text.Trim, "-1"), - Telefono:=If(ChkTransitorio.Checked, TxtTelefono.Text.Trim, "-1"), Ciudad:=If(ChkTransitorio.Checked, TxtCiudad.Text.Trim, "-1"), Licencia:=If(ChkTransitorio.Checked, TxtLicencia.Text.Trim, "-1"), Modulo:="TA/G") + Telefono:=If(ChkTransitorio.Checked, TxtTelefono.Text.Trim, "-1"), Ciudad:=If(ChkTransitorio.Checked, TxtCiudad.Text.Trim, "-1"), Licencia:=If(ChkTransitorio.Checked, TxtLicencia.Text.Trim, "-1"), Modulo:="TA/G2") FolioSalida = ObjInventario.Folio Folio = ObjInventario.Folio If CveMovimientoSalida <= 0 Then @@ -852,7 +852,7 @@ Partial Class Inventarios_TraspasoAlmacen AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), - CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") + CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3") FolioEntrada = ObjInventario.Folio If CveMovimientoEntrada <= 0 Then TextoError = "Ocurrió un error al generar el movimiento de entrada" @@ -1039,7 +1039,7 @@ Partial Class Inventarios_TraspasoAlmacen 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, CveConceptoInventario, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), - GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G") + GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G4") Dim FolioMov As Integer = ObjInventario.Folio If CveMovimiento <= 0 Then @@ -1508,96 +1508,118 @@ Partial Class Inventarios_TraspasoAlmacen If Not GvDatosRecepcion.Rows.Count > 0 Then Alert("No hay movimientos para el traspaso", TipoMensaje.MsgAdvertencia) Exit Sub - End If + End If + + Dim CveMovimientoEntrada As Integer = 0 + Dim Folio As Integer = 0 + Dim ErrorMovInv As Boolean = False + Dim TextoError As String = "" + Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate Dim ObjInventario As New ClsInventarios Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) ObjInventario.IniciaTransacSQL() - Dim CveMovimientoEntrada As Integer = 0 - Dim Folio = 0 - Dim ErrorMovInv As Boolean = False - Dim TextoError = "" - Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate - - CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, - CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") - - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePoliza <= 0 Then - TextoError = "No se pudo generar la Poliza para la cancelacion" - ErrorMovInv = True - End If - - Folio = ObjInventario.Folio - - If CveMovimientoEntrada <= 0 And Not ErrorMovInv Then - TextoError = "No se pudo generar el movimiento de entrada correctamente" - ErrorMovInv = True - Else - Dim CveMovimientoDetalleSalida As Integer = 0 - Dim importe As Double = 0 - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero - Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble - Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble - If CveMovimientoDetalleSalida <= 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de salida" - Exit For - End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - importe += Cantidad * PrecioUnitario - Next - - End If - If Not ErrorMovInv Then - Dim ImporteDecimal As Decimal = importe.ToDecimal - Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero + Try + CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, + CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/C") + If CveMovimientoEntrada <= 0 Then + TextoError = "No se pudo generar el movimiento" + ErrorMovInv = True + End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, - CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then + Dim CvePrePoliza As Integer = -1 + If Not ErrorMovInv Then + Folio = ObjInventario.Folio + CvePrePoliza = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePrePoliza <= 0 Then + TextoError = "No se pudo generar la Poliza para la cancelación" ErrorMovInv = True End If + End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, - CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then + If CveMovimientoEntrada <= 0 And Not ErrorMovInv Then + TextoError = "No se pudo generar el movimiento de entrada correctamente" + ErrorMovInv = True + Else + Dim CveMovimientoDetalleSalida As Integer = 0 + Dim importe As Double = 0 + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero + Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble + Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble + If CveMovimientoDetalleSalida <= 0 Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de salida" + Exit For + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" + Exit For + End If + importe += Cantidad * PrecioUnitario + Next + Else ErrorMovInv = True - End If - End If - - End If - - If Not ErrorMovInv Then - ObjInventario.Commit() - - TxtRecibio.Text = "" - TxtFechaRecepcion.Text = Now.ToShortDateString - TxtObservacionesRecepcion.Text = "" - - Dim Mensaje As StringBuilder = New StringBuilder - Mensaje.AppendFormat("Se realizo correctamente la cancelación.
Folio de Entrada: {0}", Folio, CveMovimientoEntrada) - Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) 'onclick='ImprimirTraslado()' - - Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) - - DivCodigoSeriePSRecepcion.Visible = False - - GvDatosRecepcion.DataBind() - UpDatosRecepcion.Update() - UPDatosAlmacen.Update() - Else - ObjInventario.RollBack() - ObjConta.RollBack() - Alert(TextoError, TipoMensaje.MsgError) - End If + TextoError = "Ocurrió un error al obtener los movimientos de salida" + End If + + If Not ErrorMovInv Then + Dim ImporteDecimal As Decimal = importe.ToDecimal + Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then + ErrorMovInv = True + TextoError = "Ocurrió un erro al cancelar el traspaso" + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then + ErrorMovInv = True + TextoError = "Ocurrió un erro al cancelar el traspaso" + End If + End If + + End If + + Catch ex As Exception + ErrorMovInv = True + TextoError = "Ocurrió un erro al cancelar el traspaso" + OnError(TextoError, ex) + End Try + + If Not ErrorMovInv Then + ObjInventario.Commit() + + TxtRecibio.Text = "" + TxtFechaRecepcion.Text = Now.ToShortDateString + TxtObservacionesRecepcion.Text = "" + + Dim Mensaje As StringBuilder = New StringBuilder + Mensaje.AppendFormat("Se realizo correctamente la cancelación.
Folio de Entrada: {0}", Folio, CveMovimientoEntrada) + Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) 'onclick='ImprimirTraslado()' + + Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) + + DivCodigoSeriePSRecepcion.Visible = False + + GvDatosRecepcion.DataBind() + UpDatosRecepcion.Update() + UPDatosAlmacen.Update() + Else + ObjInventario.RollBack() + + Alert(TextoError, TipoMensaje.MsgError) + End If + ObjConta.Dispose() ObjInventario.Dispose() + CargaRecepcion() End Sub @@ -1648,7 +1670,7 @@ Partial Class Inventarios_TraspasoAlmacen 'AGREGAMOS LA ENTRADA CveMovimientoSalida = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") + Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1") Folio = ObjInventario.Folio If CveMovimientoSalida <= 0 Then diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index 28a85c533..d23679560 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -648,7 +648,8 @@ $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN'; } } - function FnSeleccionaNC(chk, chkNC) + + function FnSeleccionaNC(chk, chkNC,txtImporte) { if (chk.checked) { chkNC.disabled = false; @@ -659,6 +660,11 @@ chkNC.click(); } } + txtImporte.disabled = chkNC.checked; + } + + function FnEditarImporte(chkNC, txtImporte) { + txtImporte.disabled = chkNC.checked; } function FnLimites(chk, txt, limiteInferior, limiteSuperior) { diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index e6545ee13..b391a503c 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -616,7 +616,7 @@ Partial Class Ventas_ClientesAbonar End Select If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then - e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID)) + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6},{0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID)) Else e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda)) End If @@ -646,8 +646,7 @@ Partial Class Ventas_ClientesAbonar If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then e.Row.FCCheckBox("ChkGenerarNC").Visible = True - e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda)) - + e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnEditarImporte({2}, {0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda)) End If Else @@ -1540,12 +1539,26 @@ Partial Class Ventas_ClientesAbonar If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If MsgError = "" Then If ListaFacturasGenerarNC.Count > 0 Then - Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC) - If Resp.CveVenta > 0 Then - NCGeneradas.Add(Resp) - Else - MsgError = "No se pudo generar la nota de credito" + For Each Fac As Modelos.Factura In ListaFacturasGenerarNC + Dim ListaNC As New List(Of Modelos.Factura) + ListaNC.Add(Fac) + + Dim Resp As Modelos.Factura.MMensajeFactura = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC) + + If Resp.CveVenta > 0 Then + NCGeneradas.Add(Resp) + Else + MsgError = "No se pudo generar la nota de crédito" + Exit For + End If + Next + + If MsgError = "" Then + If NCGeneradas.Count <> ListaFacturasGenerarNC.Count Then + MsgError = "No se generaron las notas de crédito seleccionadas" + End If End If + End If End If End If @@ -1641,21 +1654,14 @@ Partial Class Ventas_ClientesAbonar If ObjConta IsNot Nothing Then ObjConta.Commit() Dim StrMsg As New StringBuilder - StrMsg.Append("Abono Registrado Correctamente.
") - StrMsg.AppendFormat("Folio {1}", CveIE, ObjIE.Folio) + StrMsg.AppendFormat("Abono Registrado Correctamente. Folio {1}
", CveIE, ObjIE.Folio) - If IDPoliza > 0 Then StrMsg.AppendFormat("
Poliza: {1}", IDPoliza, FolioPoliza) + If IDPoliza > 0 Then StrMsg.AppendFormat("Poliza: {1}
", IDPoliza, FolioPoliza) Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago) - Dim SbMensaje As New StringBuilder - SbMensaje.Append(String.Format("Abono Registrado Correctamente.

Poliza: {1}

{2}", IDPoliza, FolioPoliza, TextoComplementoPago)) - For Each NC In NCGeneradas - For Each msg In NC.Mensajes - StrMsg.Append(msg) - Next - StrMsg.Append("
") + StrMsg.AppendFormat("Nota de crédito generada correctamente.

Folio: {1}
", NC.CveVenta, NC.SerieFolio) Next Alert($"{StrMsg.ToString}

{TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx""")) @@ -1680,7 +1686,7 @@ Partial Class Ventas_ClientesAbonar #Region " N O T A - D E - C R E D I T O" - Private Function GenerarNC(Trasac As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura + Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual) ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario @@ -1844,8 +1850,8 @@ Partial Class Ventas_ClientesAbonar DtVentasNC.AcceptChanges() ObjFacturaDevolucion.DtVentasNC = DtVentasNC - 'ObjFacturaDevolucion.GenerarPDFFactura = True - Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=Trasac, ObjContPaqTransac:=ObjConta) + + Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta) ObjFacturaDevolucion.Dispose() @@ -2370,7 +2376,12 @@ Partial Class Ventas_ClientesAbonar #End Region #Region " COMPLEMENTOS PAGO " - Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String + Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String + + If Not UsuarioActual.Empresa.FacturaProduccion Then + Return "" + End If + If Not ChkComplementoPago.Checked Then Return "" End If diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index d60fe016f..07ff5a1dc 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -621,7 +621,8 @@ - + <%--0--%> @@ -1331,12 +1332,18 @@
- + + + +
+ + +
@@ -2556,7 +2563,7 @@ - + + -
+

@@ -2807,7 +2814,7 @@
-