This commit is contained in:
Rene Molina
2019-10-17 12:50:40 -07:00
16 changed files with 8644 additions and 8369 deletions

View File

@@ -6698,10 +6698,12 @@ Public Class ClsPaginas
'If EmpresaActual = 48 Then
' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE"
'End If
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta))
If Not Archivo.Exists OrElse EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 72, 80, 122, 126) Then
params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2)))
End If
'DATOS PARA DESCUENTO
If EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 72, 80, 122, 126) Then 'EMPRESAS QUE YA TIENEN EL AJUSTE EN EL FORMATO
params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2)))
params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString))
params.Add(New ReportParameter("SubTotal2", DtDetalle.SUM("Total").ToString))
Else
@@ -6768,8 +6770,8 @@ Public Class ClsPaginas
Dim FirmaSol As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioSol))
params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioSol))).AbsoluteUri, "")))
Dim FirmaAut As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioAut))
params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, "")))
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta))
params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, "")))
If Archivo.Exists Then
bytes = StreamPDF(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta), DtDetalle, params, $"OC_{ObjOC.Folio.ToString}", RDSName:="DsOC", MR:=MR)
Else

View File

@@ -3823,13 +3823,6 @@ Namespace Modelos
Dim TieneAlmacen As Boolean = False
'If Not EsRefacturacion AndAlso ObjFactura.SaldoAlmacen <> 0 Then
' Retorno.Mensaje = "El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén."
' Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
' Return Retorno
'End If
'VALIDA QUE LA FACTURA NO TENGA PAGOS
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
@@ -4286,13 +4279,6 @@ Namespace Modelos
End If
End If
If Not ErrorCancelar Then
If Not GeneraMovimientosApartados(ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
End If
End If
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
If Not ErrorCancelar AndAlso RevivirRemisiones Then
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
@@ -4302,22 +4288,25 @@ Namespace Modelos
End If
If Not ErrorCancelar Then
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
If CveMovimiento > 0 AndAlso RealizarDevolucionAlmacen Then
If Not ErrorCancelar Then
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
ErrorCancelar = True
End If
End If
If Not GeneraMovimientosApartados(ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
End If
End If
'AGREGA BITACORA A VENTA
If Not ErrorCancelar Then
Dim MensajeBitacora = "Devuelta"
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
ErrorCancelar = True
End If
End If
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
If Not ErrorCancelar Then
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
ErrorCancelar = True
End If
End If
'AGREGA BITACORA A VENTA
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimiento > 0 Then
Dim MensajeBitacora = "Devuelta"
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
ErrorCancelar = True
End If
End If
@@ -4432,7 +4421,7 @@ Namespace Modelos
End If
Else
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd hh:mm:ss.mmm")) Then
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm")) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
End If
@@ -4551,58 +4540,47 @@ Namespace Modelos
Dim SeCancela As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = DrMovtos("CveRem").ToString.ToEntero()))
If Not SeCancela Then
Dim ObjRem As New Modelos.Factura(UsuarioActual, DrMovtos("CveRem").ToString.ToEntero(), UsuarioActual.CveEmpresa)
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
If ObjRem.SaldoAlmacen = 0 Then
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
ErrorCancelar = True
Exit For
End If
'SALIDA GENERAL
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacenDevolucion, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
FolioMovimientoSalidaDevRem = ObjInventario.Folio
'ENTRADA ADELANTADO
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDevolucion)
FolioMovimientoEntradaDevRem = ObjInventario.Folio
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
ErrorCancelar = True
Exit For
End If
'SALIDA POR TRAPASO DE GENERAL
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
If Not CveVentaDetalleRem > 0 Then
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
ErrorCancelar = True
Exit For
End If
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
'SALIDA GENERAL
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacenDevolucion, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
FolioMovimientoSalidaDevRem = ObjInventario.Folio
'ENTRADA ADELANTADO
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDevolucion)
FolioMovimientoEntradaDevRem = ObjInventario.Folio
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
ErrorCancelar = True
Exit For
End If
'SALIDA POR TRAPASO DE GENERAL
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
If Not CveVentaDetalleRem > 0 Then
ErrorCancelar = True
Exit For
End If
Next
If ErrorCancelar Then
Exit For
End If
Next
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
ErrorCancelar = True
Exit For
End If
Next
If ErrorCancelar Then
Exit For
End If
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
ErrorCancelar = True
If ErrorCancelar Then
Exit For
End If
Next
@@ -4611,16 +4589,31 @@ Namespace Modelos
Exit For
End If
Else
ErrorCancelar = True
Exit For
End If
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
ErrorCancelar = True
Exit For
End If
Next
If ErrorCancelar Then
Exit For
End If
Else
ErrorCancelar = True
Exit For
End If
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
ErrorCancelar = True
Exit For
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
ErrorCancelar = True
Exit For
End If
End If
ObjRem.Dispose()
End If

View File

@@ -769,7 +769,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
Using httpClient = New HttpClient()
httpClient.Timeout = New TimeSpan(0, 15, 0)
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}", CveEmpresa, DateTime.UtcNow.Ticks)))
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
Dim response = httpClient.SendAsync(request).Result
If response.StatusCode = Net.HttpStatusCode.OK Then
File = response.Content.ReadAsByteArrayAsync().Result

View File

@@ -140,12 +140,14 @@
</div>
</div>
<div class="row" id="trNotificar" runat="server" visible="False">
<label class="col-md-2">Notificar:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtNotificarA" CssClass="form-control input-sm" runat="server" MaxLength="12" Width="400px" Rows="2" TextMode="MultiLine" ClientIDMode="Static"></asp:TextBox>
</div>
</div>
<div class="row" id="trCuentaDeposito" runat="server" visible="False">
<label class="col-md-2">Cuenta Depósito:</label>
<div class="col-md-10">

View File

@@ -816,7 +816,7 @@ Partial Class ContabilidadC_RegPrePoliza
Dim Conta As ClsContPAQi = Nothing
Dim IDPoliza As Integer = 0
Dim MsgError As String = ""
Dim CveIE As Integer
Dim CveIE As Integer = -1
Dim CveIEInsertado As Integer = -1
Dim FolioIE As String = ""
@@ -925,7 +925,7 @@ Partial Class ContabilidadC_RegPrePoliza
If MsgError = "" Then
'MENSAJE IE
If CveIE Then
If CveIE > 0 Then
MensajeAlert.AppendFormat("<br/><br/>Folio Bancario: <b><a href = ""/Bancos/IE.aspx?CveIE={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CveIE, FolioIE)
Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()")
Else

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -801,7 +801,9 @@ Partial Class General_SaldosIniciales
ObjClientes.IniciaTransacSQL()
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
NumRow = NumRow + 1
NumRow = NumRow + 1
Dim Codigo As String = Row("Codigo").ToString
Dim RazonSocial As String = Row("RazonSocial").ToString
Dim RFC As String = Row("RFC").ToString.Trim
@@ -812,36 +814,148 @@ Partial Class General_SaldosIniciales
Dim Poblacion As String = Row("Población").ToString
Dim Estado As String = Row("Estado").ToString
Dim Pais As String = Row("Pais").ToString
Dim Telefono As String = Row("Teléfono").ToString
Dim Contacto As String = Row("Contacto").ToString
Dim CelularContacto As String = Row("Celular Contacto").ToString
Dim Telefono As String = Row("Teléfono").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
Dim Contacto As String = Row("Contacto").ToString
Dim Vendedor As String = Row("Vendedor").ToString
Dim Clasificacion As String = Row("Clasificación").ToString
Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero
Dim CveVendedor As Integer = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString.ToEntero
Dim CveClasificación As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString = "si", True, False)
Dim CargoUsado As Boolean = If(Row("CargoUsado").ToString = "si", True, False)
Dim BonificacionUsado As Boolean = If(Row("BonificacionUsado").ToString = "si", True, False)
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString.ToUpper = "SI", True, False)
Dim CargoUsado As Boolean = If(Row("Cargo Usados").ToString.ToUpper = "SI", True, False)
Dim BonificacionUsado As Boolean = If(Row("EmitirBon Usado").ToString.ToUpper = "SI", True, False)
Dim LimiteCredito As Decimal = Row("Limite Credito").ToString.ToDecimal
Dim CobranzaCorreo As String = Row("CorreoPago").ToString
Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero
Dim DìaVisita As String = Row("Dia Pago").ToString
Dim DiasPagoEspecifico As String = Row("Dìa Visita").ToString
Dim CobranzaContacto As String = Row("Encargado Pago").ToString
Dim CobranzaTelefono As String = Row("Celular Contacto").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
' CobranzaContacto = Regex.Replace(CobranzaContacto, "[^0-9]", "")
'Telefono
If Telefono.Trim.Length > 10 Then
Telefono = ""
End If
If CobranzaTelefono.Trim.Length > 10 Then
CobranzaTelefono = ""
End If
Dim FormaPago As String = Row("Forma Pago").ToString
Dim CveFormaPago33 As Integer = 99
Select Case FormaPago
Case "01"
CveFormaPago33 = 1
Exit Select
Case "02"
CveFormaPago33 = 2
Exit Select
Case "03"
CveFormaPago33 = 3
Exit Select
Case "04"
CveFormaPago33 = 4
Exit Select
Case "05"
CveFormaPago33 = 5
Exit Select
Case "06"
CveFormaPago33 = 6
Exit Select
Case "08"
CveFormaPago33 = 7
Exit Select
Case "12"
CveFormaPago33 = 8
Exit Select
Case "13"
CveFormaPago33 = 9
Exit Select
Case "14"
CveFormaPago33 = 10
Exit Select
Case "15"
CveFormaPago33 = 11
Exit Select
Case "17"
CveFormaPago33 = 12
Exit Select
Case "23"
CveFormaPago33 = 13
Exit Select
Case "24"
CveFormaPago33 = 14
Exit Select
Case "25"
CveFormaPago33 = 15
Exit Select
Case "26"
CveFormaPago33 = 16
Exit Select
Case "27"
CveFormaPago33 = 17
Exit Select
Case "28"
CveFormaPago33 = 18
Exit Select
Case "29"
CveFormaPago33 = 19
Exit Select
Case "99"
CveFormaPago33 = 20
Exit Select
Case "30"
CveFormaPago33 = 21
Exit Select
Case "31"
CveFormaPago33 = 22
Exit Select
Case Else
CveFormaPago33 = 99
End Select
'Dim RazonSocial As String = Row("RazonSocial").ToString
'Contacto
If CveCliente > 0 Then
ExisteCliente = True
Contador = Contador + 1
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
' ErrorClientes = True
' RFC.GuardaLog
' Exit For
'End If
Contador = Contador + 1
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
' ErrorClientes = True
' RFC.GuardaLog
' Exit For
'End If
Else
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, Pais, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, -1, -1,
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado, BonificacionUsado:=BonificacionUsado) Then
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString, "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1,
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, LimiteCredito, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado,
BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33) Then
ErrorClientes = True
RFC.GuardaLog
Exit For
End If
End If
Next
@@ -1713,7 +1827,7 @@ Partial Class General_SaldosIniciales
If firstRowHasHeaders Then
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString().Trim)
Else
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
End If
@@ -1722,9 +1836,11 @@ Partial Class General_SaldosIniciales
Else
dataTable.Columns.Add("Column " & (cols + 1))
End If
Next
While curRow < worksheet.Rows.Count
While curRow < worksheet.Rows.Count
columns = New String(cols - 1) {}
For curCol = 0 To cols - 1
@@ -1734,13 +1850,16 @@ Partial Class General_SaldosIniciales
Else
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
End If
Next
dataTable.Rows.Add(columns)
curRow += 1
End While
Return dataTable
End Function
End Class

View File

@@ -588,8 +588,8 @@ Partial Class Inventarios_EntradasSalidas
If DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero > 0 Then
HplPrePoliza.Visible = True
HplPrePoliza.NavigateUrl = String.Format("/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}", DtMov.Rows(0)("CvePrePoliza"))
CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero
Else
CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero
Else
If UsuarioActual.CveRol = 1 Then
BtnGeneraPrepoliza.Visible = True
End If
@@ -874,7 +874,18 @@ Partial Class Inventarios_EntradasSalidas
TxtFecha.Enabled = True
ImgFecha.Enabled = True
TxtObservaciones.Enabled = True
End If
End If
Dim ObjContabilidad As New ClsContabilidad
If ObjContabilidad.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then
Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("")
If dr IsNot Nothing Then
If dr("IdPoliza").ToString.ToEntero > 0 Then
BtnEliminar.Visible = False
End If
End If
End If
ObjContabilidad.Dispose()
'SI TIENE PREPOLIZA NO SE DEBE PODER EDITAR
If Mov.TienePrePoliza > 0 Then

View File

@@ -1897,83 +1897,91 @@ Partial Class Inventarios_RecepcionAlmacen
End Sub
Private Function GeneraPrePolizaSalidaEntregaDirecta(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContaContPAQ As ClsContPAQi) As Boolean
Dim DtCostos As DataTable = Nothing
Dim ValorInventario As Decimal = 0
Dim ValorInventarioME As Decimal = 0
Dim CveConcepto As Integer = 3
Dim Retorno As Boolean = True
ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa)
Dim CveVenta As Integer = ObjInventario.CveVenta
Dim CveAlmacen As Integer = ObjInventario.CveAlmacen
Dim SerieFolio As String = ObjInventario.DtResultados.Rows(0)("SerieFolioVenta").ToString
Dim MovAlmacen As Boolean = True
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConcepto).ToEntero
If OrigenMov = 1 Then MovAlmacen = False Else MovAlmacen = True
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim ConceptoPoliza As String = String.Format("{0}-{1}", "Salida de Almacen", SerieFolio)
If tmpCostos.Rows.Count > 0 Then
Dim Concepto As String = ConceptoPoliza
Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
Dim tCveConcepto As Integer = 69
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL
If tCveConcepto = 69 Then
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then
Retorno = False
Exit For
End If
Next
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total").RoundSQL) Then
Retorno = False
End If
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
Retorno = False
End If
End If
'CONTABILIZAR - SIMPLIFICAR
If Retorno Then
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
Retorno = False
End If
End If
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
If ObjContaContPAQ Is Nothing Then
ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa)
ObjContaContPAQ.IniciaTransacSQL()
End If
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then
Retorno = False
End If
End If
End If
End If
End If
Private Function GeneraPrePolizaSalidaEntregaDirecta(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContaContPAQ As ClsContPAQi) As Boolean
Dim Retorno As Boolean = True
Try
Dim DtCostos As DataTable = Nothing
Dim ValorInventario As Decimal = 0
Dim ValorInventarioME As Decimal = 0
Dim CveConcepto As Integer = 3
ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa)
Dim CveVenta As Integer = ObjInventario.CveVenta
Dim CveAlmacen As Integer = ObjInventario.CveAlmacen
Dim SerieFolio As String = ObjInventario.DtResultados.Rows(0)("SerieFolioVenta").ToString
Dim MovAlmacen As Boolean = True
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConcepto).ToEntero
If OrigenMov = 1 Then MovAlmacen = False Else MovAlmacen = True
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim ConceptoPoliza As String = String.Format("{0}-{1}", "Salida de Almacen", SerieFolio)
If tmpCostos.Rows.Count > 0 Then
Dim Concepto As String = ConceptoPoliza
Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
Dim tCveConcepto As Integer = 69
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL
If tCveConcepto = 69 Then
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then
Retorno = False
Exit For
End If
Next
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total").RoundSQL) Then
Retorno = False
End If
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
Retorno = False
End If
End If
'CONTABILIZAR - SIMPLIFICAR
If Retorno Then
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
Retorno = False
End If
End If
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
If ObjContaContPAQ Is Nothing Then
ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa)
ObjContaContPAQ.IniciaTransacSQL()
End If
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then
Retorno = False
End If
End If
End If
Else
Retorno = False
End If
Else
Retorno = False
End If
Catch ex As Exception
OnError("Ocurrió un error al guadar la prepoliza", ex)
Retorno = False
End Try
Return Retorno
End Function

View File

@@ -1465,8 +1465,6 @@ Partial Class Inventarios_RecepcionEntrega
End If
'VALIDA CANTIDAD DE SALIDA
Dim Cantidad As Decimal = 0.0D
For Each Gvr As GridViewRow In GvDatos.Rows
@@ -2214,122 +2212,123 @@ Partial Class Inventarios_RecepcionEntrega
End If
End If
End If
' SE REALIZARA AL MOMENTO DE CANCELAR LA FACTURA {
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
Dim DtDevRem As New DataTable
Dim DtMovtosDev As New DataTable
Dim CveAlmacenTraspasoDestinoDevRem = -1
Dim CveVentaDetalleRem = -1
Dim CantidadDevolver As Decimal = 0
Dim CantidadRem As Decimal = 0
'If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
' Dim DtDevRem As New DataTable
' Dim DtMovtosDev As New DataTable
' Dim CveAlmacenTraspasoDestinoDevRem = -1
'CARGA REMISIONES DE LA VENTA DEVUELTA
If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0")
Else
ErrorMovInv = True
End If
' Dim CveVentaDetalleRem = -1
' Dim CantidadDevolver As Decimal = 0
' Dim CantidadRem As Decimal = 0
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
DtMovtosDev = ObjInventario.DtResultados
Else
ErrorMovInv = True
End If
' 'CARGA REMISIONES DE LA VENTA DEVUELTA
' If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
' DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0")
' Else
' ErrorMovInv = True
' End If
If Not ErrorMovInv Then
If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then
' 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
' If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
' DtMovtosDev = ObjInventario.DtResultados
' Else
' ErrorMovInv = True
' End If
For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener el almacén de devolucion de remisión."
Exit For
End If
' If Not ErrorMovInv Then
' If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then
'SALIDA GENERAL
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
FolioMovimientoSalidaDevRem = ObjInventario.Folio
' For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows
' CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
' If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al obtener el almacén de devolucion de remisión."
' Exit For
' End If
'ENTRADA ADELANTADO
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero)
FolioMovimientoEntradaDevRem = ObjInventario.Folio
' 'SALIDA GENERAL
' CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
' FolioMovimientoSalidaDevRem = ObjInventario.Folio
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al generar los movimientos de devolución a remisión."
Exit For
End If
' 'ENTRADA ADELANTADO
' CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero)
' FolioMovimientoEntradaDevRem = ObjInventario.Folio
' If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al generar los movimientos de devolución a remisión."
' Exit For
' End If
'SALIDA POR TRAPASO DE GENERAL
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
'CantidadDevolver = DtMovtosDev.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").ToDouble
'If (Dr("Cantidad").ToString.ToDouble > CantidadRem, CantidadRem, Dr("Cantidad").ToString.ToDouble) Then
' 'SALIDA POR TRAPASO DE GENERAL
' For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
' CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
' CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
' 'CantidadDevolver = DtMovtosDev.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").ToDouble
' 'If (Dr("Cantidad").ToString.ToDouble > CantidadRem, CantidadRem, Dr("Cantidad").ToString.ToDouble) Then
If Not CveVentaDetalleRem > 0 Then
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener la relación de la venta con la remisión."
Exit For
End If
' If Not CveVentaDetalleRem > 0 Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al obtener la relación de la venta con la remisión."
' Exit For
' End If
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida de traspaso de devolucion de remisión."
Exit For
End If
Next
' For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al guardar los movimientos de salida de traspaso de devolucion de remisión."
' Exit For
' End If
' Next
If ErrorMovInv Then
Exit For
End If
Next
' If ErrorMovInv Then
' Exit For
' End If
' Next
If ErrorMovInv Then
Exit For
End If
' If ErrorMovInv Then
' Exit For
' End If
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada de traspaso de devolucion de remisión."
Exit For
End If
Next
' 'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
' For Each Dr As DataRow In ObjInventario.DtResultados.Rows
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al guardar los movimientos de entrada de traspaso de devolucion de remisión."
' Exit For
' End If
' Next
If ErrorMovInv Then
Exit For
End If
' If ErrorMovInv Then
' Exit For
' End If
Else
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener los detalles de la devolución de almacén"
Exit For
End If
' Else
' ErrorMovInv = True
' TextoError = "Ocurrió un error al obtener los detalles de la devolución de almacén"
' Exit For
' End If
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
TextoError = "Ocurrió un error al hacer la devolucion hacia la remision. Por favor vuelva a intentar."
ErrorMovInv = True
Exit For
End If
' If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
' TextoError = "Ocurrió un error al hacer la devolucion hacia la remision. Por favor vuelva a intentar."
' ErrorMovInv = True
' Exit For
' End If
Next
End If
Else
TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
ErrorMovInv = True
End If
End If
' Next
' End If
' Else
' TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
' ErrorMovInv = True
' End If
'End If
'}
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
If Not ErrorMovInv And EsDevolucionVenta = 1 Then

View File

@@ -148,7 +148,13 @@
</div>
</div>
</div>
<div class="row" id="DivFactura" runat="server" visible="false">
<label class="col-md-1 truncate" style="width: 110px">Factura:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlFactura" runat="server" CssClass="form-control input-sm select2me" Style="max-width: 200px" DataTextField="SerieFolio" DataValueField="CveVenta">
</asp:DropDownList>
</div>
</div>
<div class="row" id="DivDepartamentoEntrega" runat="server" visible="False">
<label class="col-md-1 truncate" style="width: 110px">
<asp:Label runat="server" ID="LblDepartamentoEntrega"> Depto. entrega:</asp:Label>

View File

@@ -373,18 +373,11 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub PermisoVerImportes()
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
End Sub
End Sub
#End Region
Private Function isWhitFamily() As Boolean
Return (UsuarioActual.CveEmpresa = 66)
End Function
#Region " VALORES INICIALES "
Protected Sub CreaDT()
Dim dt As New DataTable
@@ -435,31 +428,16 @@ Partial Class Inventarios_RecepcionUsados
DtMovimientosSalidaInvFisico = dt.Clone
End Sub
Private Sub CargaCombos()
'Llenar el dropdownlist de Secciones
If UsuarioActual.CveEmpresa = 66 Then
'DdlClasificacion.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion")
Else
Dim ObjClasificaciones As New ClsClasificaciones
If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then
' DdlClasificacion.DataSource = ObjClasificaciones.DtResultados
End If
ObjClasificaciones.Dispose()
End If
'DdlClasificacion.DataBind()
Private Sub CargaCombos()
DdlSeccion.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa)
DdlSeccion.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlSeccion.DataBind()
'Llenar el dropdownlist de monedas
DdlMoneda.DataSource = GlobalDTMonedas
DdlMoneda.DataBind()
'Llenar el dropdownlist de almacén
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen IN (22)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
@@ -472,10 +450,7 @@ Partial Class Inventarios_RecepcionUsados
DdlAlmacen_SelectedIndexChanged(DdlAlmacen, EventArgs.Empty)
End If
CargaPS()
End Sub
Private Sub CargaPS()
Dim ObjAcum As New ClsAcumuladores
@@ -487,45 +462,24 @@ Partial Class Inventarios_RecepcionUsados
If drow("CvePSCargo").ToString.ToEntero > 0 Then
lista.Add(drow("CvePSCargo").ToString)
End If
End If
Next
End If
If lista.Count > 0 Then
Filtro = "CvePS in(" & String.Join(",", lista) & ")"
'DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTamaño > 0")
' Filtro
DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros(Filtro)
DdlProducto2.DataBind()
DdlProducto2.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
'DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
'If UsuarioActual.CveEmpresa = 66 Then
' DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios")
'End If
'If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then
' DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2")
' DdlProducto2.DataBind()
' DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
'End If
ObjAcum.Dispose()
End Sub
Private Sub CargaSubProyectos()
DdlSubProyecto.DataSource = If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
DdlSubProyecto.DataBind()
'DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
@@ -564,13 +518,12 @@ Partial Class Inventarios_RecepcionUsados
DdlPersonal.DataSource = dt
DdlPersonal.DataBind()
'DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
End Sub
#End Region
#Region " CARGA DATOS "
Private Sub BloqueaEdicionEncabezado()
@@ -596,11 +549,10 @@ Partial Class Inventarios_RecepcionUsados
DdlSeccion.Enabled = False
End If
UppGrid.Update()
End Sub
End Sub
#End Region
#Region " BOTONES: ELIMINAR, NUEVO "
Protected Sub BtnNuevo_Click(sender As Object, e As EventArgs) Handles BtnNuevo.Click
'Response.Redirect("EntradasSalidas.aspx")
@@ -993,8 +945,6 @@ Partial Class Inventarios_RecepcionUsados
Dim ImporteConcepto = 0.0
Try
Dim CveSubProyecto = -1
Dim ActivoFijo = -1
@@ -1015,16 +965,18 @@ Partial Class Inventarios_RecepcionUsados
Dim tCveProveedor As Integer = -1
If DdlProveedor.SelectedValue.ToEntero > 0 Then tCveProveedor = DdlProveedor.SelectedValue.ToEntero
Dim CveVenta As Integer = -1
If CveRemisionRecibida > 0 Then
CveVenta = CveRemisionRecibida
ElseIf EsDistribuidor AndAlso DdlFactura.SelectedValue.ToEntero() > 0 Then
CveVenta = DdlFactura.SelectedValue.ToEntero()
End If
'Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, $" {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta,
CveSubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero,
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor)
If CveMovimiento <= 0 Then
Alert("No se pudo almacenar el movimiento correctamente", TipoMensaje.MsgError)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
@@ -1054,13 +1006,10 @@ Partial Class Inventarios_RecepcionUsados
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2)
If RBLOpcion.SelectedValue.ToEntero <> 3 Then
If EsDistribuidor Then
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, -1, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
'CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
'CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String
@@ -1069,11 +1018,7 @@ Partial Class Inventarios_RecepcionUsados
Exit For
End If
End If
End If
Next
If Not ErrorMovInv Then
@@ -1088,10 +1033,8 @@ Partial Class Inventarios_RecepcionUsados
ObjInventario.Commit() ' aplica los movimientos insertados
'If ObjContaAC IsNot Nothing Then ObjContaAC.Commit()
Alert(Msg.ToString, TipoMensaje.MsgInformacion)
'Limpia Valores cuando inserta de campos especiales
If UsuarioActual.CveEmpresa = 66 Then
DdlSubProyecto.SelectedValueExist("-1")
@@ -1103,7 +1046,6 @@ Partial Class Inventarios_RecepcionUsados
UPDatos.Update()
LimpiarMovimiento()
Else
ObjInventario.RollBack() 'deshace lo insertado
CveMovimiento = 0
@@ -1111,18 +1053,11 @@ Partial Class Inventarios_RecepcionUsados
Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError)
' RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If
End If
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
End If
Catch ex As Exception
ObjInventario.RollBack() 'deshace lo insertado
CveMovimiento = 0
@@ -1138,11 +1073,11 @@ Partial Class Inventarios_RecepcionUsados
Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgError)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If
End Sub
#End Region
#Region " ADD INVENTARIO INICIAL "
Protected Sub BtnCodigoBarras_Click(sender As Object, e As EventArgs)
@@ -1218,12 +1153,11 @@ Partial Class Inventarios_RecepcionUsados
TxtCodigoBarras.Focus()
RegistraScript("beep-07.wav')")
End Sub
End Sub
#End Region
#Region " DdlConcepto, DdlClasificacion, DdlAlmacen | Index CHANGED "
Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs)
If EsConsumoInterno Then
@@ -1270,34 +1204,6 @@ Partial Class Inventarios_RecepcionUsados
FolioAsignado = Folio
End Sub
'Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged
' ChangeDdlProducto()
'End Sub
'Private Sub ChangeDdlProducto()
' If UsuarioActual.Empresa.Funcionalidad(105) = "" Then
' Dim filtro As String = ""
' If Not (DdlClasificacion.SelectedValue = "-1") Then
' If isWhitFamily() Then
' filtro = String.Format("CveSubFamilia={0}", DdlClasificacion.SelectedValue)
' Else
' filtro = String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue)
' End If
' End If
' DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros($"{filtro} AND CveTipoPS = 2", "PSCodigo")
' DdlProducto2.DataBind()
' DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
' Else
' If isWhitFamily() Then
' DdlProducto2.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacion.SelectedValue)
' Else
' DdlProducto2.ddlWS.Attributes.Add("data-idClasificacion", DdlClasificacion.SelectedValue)
' End If
' End If
'End Sub
Protected Sub DdlProducto2_SelectedIndexChanged(sender As Object, e As EventArgs)
ElProductoChange()
End Sub
@@ -1343,10 +1249,9 @@ Partial Class Inventarios_RecepcionUsados
ObjAcum.Dispose()
UPDatos.Update()
End Sub
End Sub
#End Region
#Region " GVM "
Private Sub CargaGVM(DtTemp As DataTable)
GvM.DataSource = DtTemp
@@ -1441,16 +1346,9 @@ Partial Class Inventarios_RecepcionUsados
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
End Sub
End Sub
#End Region
#Region " TIPO DE CAMBIO "
Protected Sub DdlMonedaTC_SelectedIndexChanged(sender As Object, e As EventArgs)
Select Case DdlMonedaTC.SelectedValue.ToEntero
@@ -1485,14 +1383,13 @@ Partial Class Inventarios_RecepcionUsados
'LtTotal.Text = DtMovimientos.SUM("Total", "").ToString.FormatoNumero
UPDatos.Update()
End Sub
End Sub
#End Region
#Region " BITACORA "
Private Sub InicializaBitacoraTemporal()
@@ -1693,61 +1590,56 @@ Partial Class Inventarios_RecepcionUsados
UPEventoBitacora.Update()
End If
End Sub
End Sub
#End Region
#Region " CONSUMO INTERNO "
'Private Sub ActivaConsumoInterno()
' EsConsumoInterno = True
' DdlAlmacen.AutoPostBack = False
' DivFolio1.Visible = False
' DivFolio2.Visible = False
' divMonedaSeccion.Visible = False
' divGuia.Visible = False
' TrResponsable.Visible = False
' CargaPersonal()
' 'RECARGA ALMACENES SOLO DE CONSUMO INTERNO
' DdlAlmacen.Items.Clear()
' DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
' DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
' DdlAlmacen.SelectedValue = "-1"
' DdlAlmacen.DataBind()
' If IsNothing(Request("CveMovimiento")) Then
' DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
' End If
'End Sub
'Private Sub ActivaConsumoInterno()
' EsConsumoInterno = True
' DdlAlmacen.AutoPostBack = False
' DivFolio1.Visible = False
' DivFolio2.Visible = False
' divMonedaSeccion.Visible = False
' divGuia.Visible = False
' TrResponsable.Visible = False
' CargaPersonal()
' 'RECARGA ALMACENES SOLO DE CONSUMO INTERNO
' DdlAlmacen.Items.Clear()
' DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
' DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
' DdlAlmacen.SelectedValue = "-1"
' DdlAlmacen.DataBind()
' If IsNothing(Request("CveMovimiento")) Then
' DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
' End If
'End Sub
#End Region
#Region "PAQUETERIA GUIA"
'Protected Sub LnkAgregarGuia_Click(sender As Object, e As EventArgs)
' RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveMovimiento={0}',800,620);", CveMovimiento))
'End Sub
'Protected Sub LnkAgregarGuia_Click(sender As Object, e As EventArgs)
' RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveMovimiento={0}',800,620);", CveMovimiento))
'End Sub
#End Region
#Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED"
Private Sub InicializaClientes()
@@ -1775,6 +1667,26 @@ Partial Class Inventarios_RecepcionUsados
DivClienteSucursal.Visible = False
DdlClientesSucursales.Items.Clear()
CargaSucursalesCliente()
CargaFacturasCliente()
UpGenerales.Update()
End Sub
Private Sub CargaFacturasCliente()
DivFactura.Visible = True
Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero()
If CveCliente > 0 Then
Me.EsDistribuidor = True
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then
DdlFactura.DataSource = ObjVentas.DtResultados.Copy()
End If
ObjVentas.Dispose()
DdlFactura.DataBind()
DdlFactura.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End Sub
Protected Sub CargaSucursalesCliente()
DdlClientesSucursales.Enabled = True
@@ -1882,14 +1794,10 @@ Partial Class Inventarios_RecepcionUsados
ObjInventario.Dispose()
ObjConta.Dispose()
End Sub
End Sub
#End Region
Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String)
Dim ObjEventos As New ClsOIEventos()
@@ -1907,7 +1815,6 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Protected Sub LnkAgregarUsado_Click(sender As Object, e As EventArgs)
AgregarUsado = True
ResetModalUsados()
@@ -1916,8 +1823,6 @@ Partial Class Inventarios_RecepcionUsados
UpModalAgregar.Update()
End Sub
Protected Sub LnkModalAgregarUsado_Click(sender As Object, e As EventArgs)
AgregarPS()
End Sub
@@ -1970,7 +1875,6 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub RBLOpcion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLOpcion.SelectedIndexChanged
If RBLOpcion.SelectedValue.ToEntero = 3 Then
DivCliente.Visible = False
Else
@@ -1996,7 +1900,6 @@ Partial Class Inventarios_RecepcionUsados
Me.CveRemisionRecibida = -1
Me.CveRemisionRecibida = CType(CType(sender, LinkButton).NamingContainer, GridViewRow).DataKey("CveVenta").ToEntero()
Dim DtUsados As DataTable = Nothing
Dim CveCliente As Integer = -1
@@ -2008,10 +1911,13 @@ Partial Class Inventarios_RecepcionUsados
If EsDistribuidor Then
DivCliente.Visible = True
DdlClientes.SelectedValueExist(CveCliente)
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
DdlFactura.SelectedValueExist(CveRemisionRecibida)
Else
DivCliente.Visible = False
DivFactura.Visible = False
End If
DdlClientes.SelectedValueExist(CveCliente)
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
DtUsados = ObjVentas.DtResultados.Copy()

View File

@@ -964,6 +964,7 @@ Partial Class OC
DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer))
DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double))
DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
' DtDetalle.Columns.Add("ClasificacionOG", GetType(String))
@@ -5872,7 +5873,7 @@ Partial Class OC
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath)
Dim excelFile As ExcelFile = excelFile.Load(flatFilePath)
Dim unnamed As Integer = 0
Dim cols As Integer

View File

@@ -6401,6 +6401,38 @@
}
}
function CalculaTotalRNCChk(TxtImporte, Saldo, Chk) {
if (Chk.checked) {
TxtImporte.value = FormatoNumero(Saldo, 2);
} else {
TxtImporte.value = "";
}
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1')
{
CompararNC();
}
}
function LimitaCantidadRNCMasivo(TxtImporte,Saldo, Chk) {
var ImporteNuevo = TxtImporte.value;
Chk.checked = true;
if (ImporteNuevo > Saldo) {
ImporteNuevo = Saldo;
Entro = 1;
}
if (Entro == 1) {
TxtImporte.value = FormatoNumero(ImporteNuevo, 2);
}
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1')
{
CompararNC();
}
}
function LimitaCantidadNCMasivo(Porcentaje, Saldo, Total, Subtotal, TxtTotalGv, TxtTotal, Chk, TxtImporte) {
var ImporteNivel = 0, ImporteNuevo = 0, Entro = 0, ValorMaximoPorPorcentaje = 0, TotalConPorcentaje = 0, TotalImportes = 0;
ImporteNivel = ($('#C_DdlNCNivelImporte').val() == "1" ? Total : Subtotal);

View File

@@ -7306,7 +7306,7 @@ Partial Class Ventas
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
'Registramos la venta
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos)
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
''Timbramos
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
@@ -8801,7 +8801,9 @@ Partial Class Ventas
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing)
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False)
Dim Msgok As New StringBuilder
Dim CveAlmacenTraspasoOrigen As Integer = -1
@@ -9125,8 +9127,10 @@ Partial Class Ventas
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos)
If ErrorList.Count = 0 Then
'inventarios
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
ErrorList.Add("Ocurrio un error al Guardar Inventario")
If Not EsNCAmortizacion Then
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
ErrorList.Add("Ocurrio un error al Guardar Inventario")
End If
End If
If ErrorList.Count = 0 Then
'estimaciones
@@ -9147,7 +9151,9 @@ Partial Class Ventas
End If
End Sub
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing)
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False)
Dim CveIE As Integer = -1
Dim DT As DataTable = Nothing
@@ -9175,7 +9181,9 @@ Partial Class Ventas
End If
End If
End Sub
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi, Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing) As Boolean
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False) As Boolean
Try
Dim DT As DataTable
Dim CvePlantilaPoliza As Integer
@@ -9422,146 +9430,149 @@ Partial Class Ventas
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
If Not EsNCAmortizacion Then
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
Dim Importe91 As Decimal = 0
Dim ImporteMN91 As Decimal = 0
Dim Importe251 As Decimal = 0
Dim ImporteMN251 As Decimal = 0
Dim Importe91 As Decimal = 0
Dim ImporteMN91 As Decimal = 0
Dim Importe251 As Decimal = 0
Dim ImporteMN251 As Decimal = 0
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal
TipoCambioNC = 1
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal
TipoCambioNC = 1
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
ImporteMN91 = Dr("Importe").ToString.ToDecimal
End If
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
ImporteMN251 = Dr("Importe").ToString.ToDecimal
Else
ImporteMN251 = Dr("Importe").ToString.ToDecimal
End If
Importe251 = (Importe251 * Multiplicador).RoundSQL
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
ImporteMN91 = Importe91
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
ImporteMN91 = Dr("Importe").ToString.ToDecimal
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
ImporteAcumulado91 += (ImporteMN91).RoundSQL
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Importe251
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'considero fluctuación.
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
ImporteMN251 = Dr("Importe").ToString.ToDecimal
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
ImporteMN251 = Dr("Importe").ToString.ToDecimal
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
Importe251 = (Importe251 * Multiplicador).RoundSQL
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
ImporteMN91 = Importe91
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
End If
ImporteAcumulado91 += (ImporteMN91).RoundSQL
Next
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Importe251
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
If ImporteConcepto12 < ImporteAcumulado91 Then
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
'considero fluctuación.
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
ErrorPrepoliza = True
Exit For
End If
End If
Next
If ImporteConcepto12 < ImporteAcumulado91 Then
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
' Dim DtTest = ObjConta.DtResultados
'End If
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
' Dim DtTest = ObjConta.DtResultados
'End If
End If
End If
End If
If ErrorPrepoliza Then
Exit For
If ErrorPrepoliza Then
Exit For
End If
End If
End If
'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
@@ -16754,6 +16765,21 @@ Partial Class Ventas
End If
ObjCliente.Dispose()
RecargaGlobalCliente()
End Sub
Private Sub RecargaGlobalCliente()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
Hilo.Start()
End Sub
Private Sub GeneraGlobalDTCliente()
Dim Objclientes As New ClsClientes
If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then
Application("GlobalDTCliente") = Objclientes.DtResultados
End If
Objclientes.Dispose()
End Sub
#End Region
@@ -20330,6 +20356,12 @@ Partial Class Ventas
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadNCMasivo({TxtNCPorcentaje.Text.ToDouble()},{e.Row.DBCampo("Saldo").ToDouble},{e.Row.DBCampo("Original").ToDouble},{e.Row.DBCampo("SubTotal").ToDouble},{TxtTotalGv.ClientID},{TxtNCImporte.ClientID},{e.Row.FCCheckBox("ChkCxC").ClientID}, this);")
End If
End Sub
Protected Sub GvRemisionesNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNC.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaTotalRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadRNCMasivo({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
End If
End Sub
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0