diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index abb33f395..4ca46507c 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -618,29 +618,7 @@ Public Class ClsCompras Return Retorno End Function - Public Function GetRepPromociones(CveProveedor As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, Tipo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Comp_PromocionesRepGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Promociones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function 'Reporte de Compras @@ -2130,29 +2108,6 @@ Public Class ClsCompras #End Region -#Region " REPORTE FACTURAS PENDIENTES POR AUTORIZAR " - - Public Function GetFacturasPendientesDeAutorizar(CveEmpresa As Integer, FechaInc As Date, FechaFin As Date) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_FacturasPendientesAu") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al consultar las facturas pendientes de autorizar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - -#End Region #Region "Reporte Evaluación proveedores " @@ -2444,31 +2399,6 @@ Public Class ClsCompras End Function - Public Function GetComplementoTrasladoRep(CveEmpresa As Integer, CveProveedor As Integer, CveTipoProveedor As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveUsuarioRegistro As Integer, CveSubProyecto As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Comp_ComplementoTrasladoRepGet") - With SqlAdapter.SelectCommand.Parameters - - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveUsuarioRegistro", SqlDbType.Int).Value = CveUsuarioRegistro - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - - - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error obtener las vinculaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function Public Function AddVincularPago(CveFactura As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 41b19d05e..c39d24f8f 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1199,6 +1199,25 @@ Public Class ClsContabilidad Return Retorno End Function + Public Function GetPrePolizasDetalleCompra(CveCompra As Integer, CveEmpresa As Integer, Optional CveIE As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_PrePolizasDetalleCompraGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener movimientos prepolizas de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdatePrePolizasDetalleBloquear(CvePrePoliza As Integer, Bloquear As Boolean) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_PrePolizasDetalleBloquearUpdate") diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 19c44dfe0..05c4a0abe 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1346,24 +1346,22 @@ Public Class ClsInventarios Retorno = True End If Catch Ex1 As SqlException - If Ex1.Message.Contains("50019") Then Me.OnError(" El producto no tiene existencia.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ElseIf Ex1.Message.Contains("CK_Inv_MovimientosDetalle_MetodoInventario") Then - Me.OnError("El movimiento debe de tener una Serie.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Else - If Ex1.Message.Contains("50021") Then - Me.OnError(" El producto ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + If Ex1.Message.Contains("50021;") Then + If String.IsNullOrEmpty(Serie) Then + Me.OnError("El producto ya fue ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + OnError(String.Format("El producto '{0}' con la serie: '{1}' ya fue ingresado previamente.", Ex1.Message.GetTagValue("codigops"), Serie), Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If Else Me.OnError("Ocurrió un error al guardar los detalles del movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End If End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los detalles del movimiento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 65ef143b6..5a98574fa 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1446,14 +1446,14 @@ Public Class ClsPaginas Application("GlobalDTPrecioListas") = value End Set End Property - Property GlobalDTMesas() As DataTable - Get - GlobalDTMesas = DirectCast(Application("GlobalDTMesas"), DataTable) - End Get - Set(value As DataTable) - Application("GlobalDTMesas") = value - End Set - End Property + 'Property GlobalDTMesas() As DataTable + ' Get + ' GlobalDTMesas = DirectCast(Application("GlobalDTMesas"), DataTable) + ' End Get + ' Set(value As DataTable) + ' Application("GlobalDTMesas") = value + ' End Set + 'End Property Property GlobalDTTipoOrdenServicios(CveEmpresa As Integer) As DataTable Get GlobalDTTipoOrdenServicios = DirectCast(Application("GlobalDTTipoOrdenServicios"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) @@ -4296,8 +4296,6 @@ Public Class ClsPaginas PaginaDict.Add("/Documentacion/TableroMaterialidadDetalle.aspx".ToUpper(), 965) PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/FiniquitoB.aspx".ToUpper(), -1) - ''CONFIGURACIONES GENERALES - PaginaDict.Add("/Sistemas/SistemaSIG.aspx".ToUpper(), 9999) 'Páginas agregadas recientemente (Implementación Metronic) @@ -4730,7 +4728,6 @@ Public Class ClsPaginas PaginaDict.Add("/Compras/ReembolsosComprobaciones.aspx".ToUpper(), 350) PaginaDict.Add("/Compras/RepProductosServicios.aspx".ToUpper(), 97) - PaginaDict.Add("/Compras/PopUpFacturasPendientesAutorizar.aspx".ToUpper(), 559) PaginaDict.Add("/Compras/RepEvaluacionProveedor.aspx".ToUpper(), 564) PaginaDict.Add("/Compras/RepRembolsoComprobaciones.aspx".ToUpper(), 591) PaginaDict.Add("/Compras/ComprasO.aspx".ToUpper(), -1) @@ -4743,7 +4740,7 @@ Public Class ClsPaginas PaginaDict.Add("/Compras/RepComprasPersonal.aspx".ToUpper(), 637) PaginaDict.Add("/Compras/RepComprasPersonalDetalle.aspx".ToUpper(), 637) PaginaDict.Add("/Compras/RepComplementoPago.aspx".ToUpper(), 657) - PaginaDict.Add("/Compras/RepPromociones.aspx".ToUpper(), 638) + PaginaDict.Add("/Compras/RepProductosServiciosPeriodo.aspx".ToUpper(), 866) PaginaDict.Add("/Compras/RepGastosFijos.aspx".ToUpper(), 661) PaginaDict.Add("/Compras/RepPagado.aspx".ToUpper(), 872) @@ -4768,7 +4765,6 @@ Public Class ClsPaginas PaginaDict.Add("/OI/CircularDetalleB.aspx".ToUpper(), 757) PaginaDict.Add("/Compras/CatTipoGasto.aspx".ToUpper(), 759) - PaginaDict.Add("/Compras/RepCartaPorteTraslados.aspx".ToUpper(), 1323) @@ -5450,7 +5446,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepProductos.aspx".ToUpper(), 32) PaginaDict.Add("/Ventas/CatVendedores.aspx".ToUpper(), 142) PaginaDict.Add("/Ventas/PuntoVenta.aspx".ToUpper(), 163) - PaginaDict.Add("/Ventas/CatMesas.aspx".ToUpper(), 244) + 'PaginaDict.Add("/Ventas/CatMesas.aspx".ToUpper(), 244) PaginaDict.Add("/Ventas/CatPreciosLista.aspx".ToUpper(), 378) PaginaDict.Add("/Ventas/RepProductosServicios.aspx".ToUpper(), 352) PaginaDict.Add("/Ventas/RepProductosServiciosDetalle.aspx".ToUpper(), 352) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index f590ed159..d2852c461 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -408,7 +408,7 @@ Public Class ClsVentas Public Function AddVenta(TipoDocto As String, FolioFact As Integer, CveCliente As Integer, CveClienteSucursal As Integer, SubTotal As Double, Descuento As Double, Amortizacion As Double, IVA As Double, RetIVA As Double, RetISR As Double, Total As Double, CveMoneda As Integer, TipoCambio As Double, CveMetodoPago As Integer, CondicionesPago As Integer, FormaPago As Integer, FechaVencimiento As DateTime, Fecha As DateTime, MotivoDescuento As String, Observaciones As String, FechaEjecucion As Date, CveVendedor As Integer, Alfa1 As String, Alfa2 As String, Alfa3 As String, Num1 As Double, Num2 As Double, Num3 As Double, - Fech1 As Date, Fech2 As Date, Fech3 As Date, CveCorte As Integer, CveMesa As Integer, NumeroPersonas As Integer, CvePrePoliza As Integer, CveUsuario As Integer, CveEmpresa As Integer, + Fech1 As Date, Fech2 As Date, Fech3 As Date, CveCorte As Integer, NumeroPersonas As Integer, CvePrePoliza As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional Propina As Double = -1, Optional CveVentaTerminal As Integer = -1, Optional AtencionA As String = "-1", Optional CveContrato As Integer = -1, Optional CveVentaPadre As Integer = -1, Optional Det_OrdenCompra As String = "", Optional Det_FechaOrdenCompra As String = "", Optional otros As Decimal = 0, Optional Entrega As String = "-1", Optional Vigencia As DateTime = MinFecha, Optional CveAlmacenTraspasoDestino As Integer = -1, Optional CveAlmacenTraspasoOrigen As Integer = -1, Optional CveDireccionEnvio As Integer = -1, @@ -458,7 +458,6 @@ Public Class ClsVentas .Add("@Fech2", SqlDbType.VarChar).Value = IIf(Fech2.ToString.Contiene("1/1/0001 12:00:00 a. m.", "01/01/0001 12:00:00 a. m."), "-1", Fech2.ToString("yyyy/MM/dd")) .Add("@Fech3", SqlDbType.VarChar).Value = IIf(Fech3.ToString.Contiene("1/1/0001 12:00:00 a. m.", "01/01/0001 12:00:00 a. m."), "-1", Fech3.ToString("yyyy/MM/dd")) .Add("@CveCorte", SqlDbType.Int).Value = CveCorte - .Add("@CveMesa", SqlDbType.Int).Value = CveMesa .Add("@NumeroPersonas", SqlDbType.Int).Value = NumeroPersonas .Add("@Propina", SqlDbType.Float).Value = Propina .Add("@CveVentaTerminal", SqlDbType.Int).Value = CveVentaTerminal @@ -2022,107 +2021,6 @@ Public Class ClsVentas End Function #End Region -#Region "V E N T A S - M E S A S" - Public Function GetMesas(Optional CveEmpresa As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Vta_MesasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Mesas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddMesa(Mesa As String, CveUsuario As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Vta_MesasAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Mesa", SqlDbType.VarChar).Value = Mesa - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Mesa con el mismo nombre: " & Mesa & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Mesa.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Mesa", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateMesa(Mesa As String, Estatus As Boolean, CveSubProyecto As Integer, CveMesa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Vta_MesasUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Mesa", SqlDbType.VarChar).Value = Mesa - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveMesa", SqlDbType.Int).Value = CveMesa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Mesa con el mismo nombre: " & Mesa & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Mesa", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Mesa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveMesa(CveMesa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Vta_MesasRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveMesa", SqlDbType.Int).Value = CveMesa - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Mesa no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Mesa.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Mesa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - #Region "V E N T A S - B I T A C O R A" Public Function GetVta_Bitacora(CveVenta As Integer, FechaI As String, FechaF As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -5602,6 +5500,36 @@ Public Class ClsVentas Return Retorno + End Function + + + Public Function RepLineasAdicionales(Agrupador As Integer, CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, TipoLinea As Integer, CveMoneda As Integer, + FechaI As Date, FechaF As Date, CveLineaAdicionalEstatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_LineasAdicionalesRep") + With SqlAdapter.SelectCommand.Parameters + + .Add("@Agrupador", SqlDbType.Int).Value = Agrupador + .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error obtener el reporte de lineas adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index df4f9c307..1328bcd5a 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -501,7 +501,7 @@ Namespace Modelos Me.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda} ") Me.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda} ") Me.RefDocto = "" - Me.CveMesa = -1 + ' Me.CveMesa = -1 Me.Fecha = Now Me.CvePrePoliza = -1 Me.FechaPago = Now @@ -1505,7 +1505,7 @@ Namespace Modelos factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, factura.Alfa1, factura.Alfa2, factura.Alfa3, factura.Num1, factura.Num2, factura.Num3, - factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, + factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, AtencionA:=factura.AtencionA, TelefonoGenerico:=factura.TelefonoGenerico, CveContrato:=factura.CveContrato, CveVentaPadre:=If(AplicaDevolucion, CveVentaDevolucion, factura.CveVentaPadre), Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, Entrega:=factura.Entrega, Vigencia:=If(factura.TipoDocto = "Cot", FechaVencimiento, MinFecha), @@ -7113,7 +7113,7 @@ Namespace Modelos Public Property EsDiasCreditoFijo As Boolean Public Property CveCorte As Integer = -1 - Public Property CveMesa As Integer = -1 + 'Public Property CveMesa As Integer = -1 Public Property NumeroPersonas As Integer = 0 diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb deleted file mode 100644 index 4c013f546..000000000 --- a/App_Code/WS_PuntoVenta.vb +++ /dev/null @@ -1,1742 +0,0 @@ -Imports System.Data -Imports System.Web.Services -Imports Extensiones - -' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. -' _ - - - -Public Class WS_PuntoVenta - Inherits System.Web.Services.WebService - - Partial Public Class RespuestaWS - Public Property Respuesta As Integer - Public Property Descripcion As String - Public Property HuboError As Boolean = True - Public Property Datos As New DataTable("Resultados") - Public Property Datos2 As New DataTable("Resultados") - End Class - - Partial Public Class Envio - Public Property Empresa As Empresa - Public Property Correo As String - Public Property Correos As String() - Public Property Asunto As String - Public Property Contenido As String - End Class - - Partial Public Class ClsProductosServiciosWS - Public Property CvePS As Integer - Public Property CveClasificacion As Integer - Public Property CveUnidadMedida As Integer - Public Property Codigo As String - Public Property PS As String - Public Property Precio As Double - Public Property Oferta As Double - Public Property IVA As Double - Public Property RetIVA As Double - Public Property MargenGanancia As Double - Public Property IdCtaContVentas As Integer - Public Property IdCtaContCompras As Integer - Public Property IdCtaContInventarios As Integer - Public Property AsientoContableVentas As Integer - Public Property AsientoContableCompras As Integer - Public Property AplicaParaConcepto As Boolean - Public Property Estado As Boolean - Public Property Fecha As Date - Public Property Usuario As String - Public Property CveEmpresa As Integer - End Class - - Partial Public Class ClsClasificacionesWS - Public Property CveClasificacion As Integer - Public Property Clasificacion As Integer - Public Property CveEmpresa As Integer - End Class - - Partial Public Class ClsMovimientosCajaWS - Public Property CveMovimiento As Integer - Public Property CveCorte As Integer - Public Property Importe As Double - Public Property Descripcion As String - Public Property TipoMovimiento As String - - Public Sub New() - - End Sub - - Public Sub New(CveMovimiento As Integer, CveCorte As Integer, Importe As Double, Descripcion As String, TipoMovimiento As String) - Me.CveMovimiento = CveMovimiento - Me.CveCorte = CveCorte - Me.Importe = Importe - Me.Descripcion = Descripcion - Me.TipoMovimiento = TipoMovimiento - End Sub - End Class - - Partial Public Class ClsMetodosPagoWS - Public Property CveMetodoPago As Integer - Public Property MetodoPago As String - Public Property Importe As Double - - Public Sub New() - - End Sub - - Public Sub New(CveMetodoPago As Integer, MetodoPago As String) - Me.CveMetodoPago = CveMetodoPago - Me.MetodoPago = MetodoPago - End Sub - End Class - - Partial Public Class ClsVta_BitacoraWS - Public Property CveBitacora As Integer - Public Property CveVenta As Integer - Public Property Fecha As DateTime - Public Property Observacion As String - Public Property CveUsuario As Integer - - Public Sub New() - - End Sub - - Public Sub New(CveBitacora As Integer, CveVenta As Integer, Fecha As DateTime, Observacion As String, CveUsuario As Integer) - Me.CveVenta = CveVenta - Me.Fecha = Fecha - Me.Observacion = Observacion - Me.CveUsuario = CveUsuario - End Sub - End Class - - Partial Public Class ClsVtaCortesWS - Public Property CveCorte As Integer - Public Property FechaInicial As DateTime - Public Property FechaFinal As DateTime - Public Property ImporteInicial As Double - Public Property ImporteFinal As Double - Public Property Diferencia As Double - Public Property Descripcion As String - Public Property Estatus As String - Public Property Usuario As String - Public Property UsuarioNombre As String - Public Property Vendido As Double - Public Property VendidoEfectivo As Double - Public Property Retirado As Double - Public Property Ingresado As Double - Public Property CveEmpresa As Integer - Public Property CortesDetalles As List(Of ClsVtaCortesDetallesWS) - - Partial Public Class ClsVtaCortesDetallesWS - Public Property CveCorte As Integer - Public Property CveMetodoPago As Integer - Public Property Importe As Double - - Public Sub New() - - End Sub - - Public Sub New(CveCorte As Integer, CveMetodoPago As Integer, Importe As Double) - Me.CveCorte = CveCorte - Me.CveMetodoPago = CveMetodoPago - Me.Importe = Importe - End Sub - End Class - - Public Sub New() - - End Sub - - Public Sub New(CveCorte As Integer, FechaInicial As DateTime, FechaFinal As DateTime, ImporteInicial As Double, ImporteFinal As Double, Descripcion As String, Estatus As String, Usuario As String, UsuarioNombre As String, Vendido As Double, VendidoEfectivo As Double, Retirado As Double, Ingresado As Double) - Me.CveCorte = CveCorte - Me.FechaInicial = FechaInicial - Me.FechaFinal = FechaFinal - Me.ImporteInicial = ImporteInicial - Me.ImporteFinal = ImporteFinal - Me.Descripcion = Descripcion - Me.Estatus = Estatus - Me.Usuario = Usuario - Me.UsuarioNombre = UsuarioNombre - Me.Vendido = Vendido - Me.VendidoEfectivo = VendidoEfectivo - Me.Retirado = Retirado - Me.Ingresado = Ingresado - End Sub - End Class - - Partial Public Class ClsVtaVentasPagoWS - Public Property CveCorte As Integer - Public Property MetodoPago As String - Public Property Importe As Double - - Public Sub New() - - End Sub - - Public Sub New(CveCorte As Integer, MetodoPago As String, Importe As Double) - Me.CveCorte = CveCorte - Me.MetodoPago = MetodoPago - Me.Importe = Importe - End Sub - End Class - - Partial Public Class UsuarioWS - Public Property CveUsuario As Integer - Public Property Usuario As String - Public Property Contraseña As String - Public Property Nombre As String - Public Property CveRol As Integer - Public Property Rol As String - Public Property NombreEmpresa As String - Public Property CveEmpresa As Integer - Public Property Liga As String - Public Property Portal As Boolean = False - 'Public Property Modulos As HybridDictionary - 'Public Property Procesos As HybridDictionary - Public Property SeleccionoEmpresa As Boolean - Public Property CveSucursal As Integer - Public Property CveProveedor As Integer - Public Property CveCliente As Integer - Public Property CveSupervisor As Integer - Public Property CveCoordinador As Integer - Public Property CveProspecto As Integer - Public Property CveVendedor As Integer - Public Property EsRestaurant As Boolean - Public Property Referencia As String - Public Property EsSupervisorRH As Boolean - Public Property Empresa As Empresa = Nothing - Public Property ModoSimulacion As Boolean = False - Public Property NombreAbreviatura As String - End Class - - ' Public Class Empresa - - ' Public CveEmpresa As Integer - ' Public Empresa As String - ' Public Direccion As String - ' Public NoExt As String - ' Public NoInt As String - ' Public Colonia As String - ' Public Ciudad As String - ' Public Estado As String - ' Public CP As Integer - ' Public RFC As String - ' Public RegistroPatronal As String - ' Public Telefono As String - ' Public Contacto As String - ' Public Mail As String - ' Public TipoFacturacion As String - ' Public ContraseñaKey As String - ' Public ArchivoKey As String - ' Public ArchivoCer As String - ' Public ArchivoPfx As String - ' Public BIUsuario As String - ' Public BIContraseña As String - ' Public Banner As String - ' Public FacturaProduccion As Boolean - ' Public FechaIng As Date - ' Public CveUsuario As Integer - ' Public SendMail As String - ' Public SendMailPassword As String - ' Public SendMailServer As String - ' Public SendMailPuerto As Integer - ' Public SendMailSSL As Boolean - ' Public Usuario As String - ' Public MostrarRetIVA As Boolean - ' Public EjercicioActual As Integer - ' Public PeriodoActual As Integer - ' Public GralSoloProyecto As Boolean - ' Public MetodoOC As Integer - ' Public RequiereCentroCostos As Boolean - ' Public Tipo_CentroCosto As Integer - ' Public Property MostrarRetISR As Boolean - ' Public Property Regimen As String - ' Public Property EstatusFacturacion As Boolean - ' Public Property Estatus As Boolean - ' Public Property UsaContabilidad As Boolean - ' Public Property UsaBancos As Boolean - ' Public Property UsaVentas As Boolean - ' Public Property UsaCompras As Boolean - ' Public Property UsaCxC As Boolean - ' Public Property UsaInventarios As Boolean - ' Public Property UsaRH As Boolean - ' Public Property UsaNomina As Boolean - ' Public Property UsaOS As Boolean - ' Public Property UsaAC As Boolean - ' Public Property BDContPAQi As String - ' Public Property ServerContPAQi As String - ' Public Property UsrContPAQi As String - ' Public Property PwdContPAQi As String - ' Public Property Buzon_Mail As String - ' Public Property Buzon_Server As String - ' Public Property Buzon_Puerto As Integer - ' Public Property Buzon_SSL As Boolean - ' Public Property Buzon_USR As String - ' Public Property Buzon_PWD As String - ' Public Property Timbres As Integer - ' Public Property Ruta As String - ' Public Property IdCuentaIVAxTrasladar As Integer - ' Public Property IdCuentaIVATrasladado As Integer - ' Public Property IdCuentaPerdidaCambiaria As Integer - ' Public Property IdCuentaGananciaCambiaria As Integer - ' Public Property ContaContabilizacionNC As Integer - ' Public Property PV_TerminalTipo As Integer - - ' 'Public Property Funcionalidades As HybridDictionary - - ' ' Public Function ValorFuncionalidad(CveFuncionalidad As Integer) As string - ' ' Return if(Funcionalidades IsNot Nothing AndAlso Funcionalidades.Item(CveFuncionalidad) IsNot Nothing, Funcionalidades.Item(CveFuncionalidad).ToString,"") - ' 'End Function - - 'End Class - - - Partial Public Class ClsVentaWS - Public CveVenta As Integer - Public CveVentaTerminal As Integer - Public TipoDocto As String - Public FolioFact As Integer - Public CveCliente As Integer - Public CveClienteSucursal As Integer - Public SubTotal As Double - Public Descuento As Double - Public Amortizacion As Double - Public IVA As Double - Public RetIVA As Double - Public RetISR As Double - Public Total As Double - Public CveMoneda As Integer - Public TipoCambio As Double - Public CveMetodoPago As Integer - Public CondicionesPago As Integer - Public FormaPago As Integer - Public FechaPago As DateTime - Public Fecha As DateTime - Public MotivoDescuento As String - Public Observaciones As String - Public FechaEjecucion As DateTime - Public CveVendedor As Integer - Public CveSucursalEjecucion As Integer - Public Alfa1 As String - Public Alfa2 As String - Public Alfa3 As String - Public Num1 As Double - Public Num2 As Double - Public Num3 As Double - Public Fech1 As String - Public Fech2 As String - Public Fech3 As String - Public CveUsuario As Integer - Public CveCorte As Integer - Public CveMesa As Integer - Public NumeroPersonas As Integer - Public CveSubProyecto As Integer - Public CveEmpresa As Integer - Public Propina As Double - - Public Detalle As List(Of ClsVentaDetalleWS) - Public MetodoPago As List(Of ClsMetodosPagoWS) - Public Bitacora As List(Of ClsVta_BitacoraWS) - - Public Class ClsVentaDetalleWS - Public CveVenta As Integer - Public CvePS As Integer - Public Cantidad As Double - Public CveUnidadMedida As Integer - Public PU As Double - Public IVA As Double - Public TotalIVA As Double - Public Total As Double - Public Observaciones As String - Public Oferta As Double - Public PrecioFinal As Double - Public Descuento As Double - Public TipoDescuento As Integer - Public CveSubProyecto As Integer - Public EsPaquete As Boolean - - Public PS As String - Public Codigo As String - - Public Caracteristicas As List(Of ClsVentaDetalleCaracteristicaWS) - End Class - - Public Class ClsVentaDetalleCaracteristicaWS - Public CveVentaDetalle As Integer - Public CvePS As Integer - Public CveOpcion As Integer - End Class - End Class - - Partial Public Class ClsPrePolizaWS - Public CvePrepoliza As Integer - Public CvePrepolizaTerminal As Integer - Public Modulo As String - Public CveTipoPoliza As Integer - Public Cargos As Double - Public Abonos As Double - Public CveMoneda As Integer - Public Fecha As Date - Public NumeroPoliza As String - Public FechaConta As DateTime - Public IdPoliza As Integer - Public Estatus As Boolean - Public FechaIng As DateTime - Public CveUsuario As Integer - Public CveEmpresa As Integer - - Public Detalle As List(Of ClsPrePolizaDetalleWS) - - Public Class ClsPrePolizaDetalleWS - Public CvePrePolizaDetalle As Integer - Public CvePrePoliza As Integer - Public TipoMovto As Boolean - Public Importe As Double - Public Referencia As String - Public CveConceptoContable As Integer - Public Concepto As String - Public FechaVencimiento As DateTime - Public IdCtaContable As Integer - Public IdSegmentoNegocio As Integer - Public CveIE As Integer - Public CveVenta As Integer - Public CveCompra As Integer - Public CveSubProyecto As Integer - Public CveCliente As Integer - Public CveProveedor As Integer - Public CvePersonal As Integer - Public CveMovimientoAlmacen As Integer - Public CveActivoFijo As Integer - End Class - End Class -#Region "Empresas, Sucursales, Clientes, Monedas, UnidadesMedida, Vta_Promociones, Vta_PromocionesDetalle" - - Public Function GetEmpresa(CveEmpresa As Integer) As RespuestaWS - Dim objEmpresa As New ClsSisEmpresas - Dim Respuesta As New RespuestaWS - - If objEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then - Respuesta.Datos = objEmpresa.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objEmpresa.Dispose() - Return Respuesta - End Function - - - Public Function GetSubProyectos(CveEmpresa As Integer) As RespuestaWS - Dim objProyecto As New ClsSubProyectos - Dim Respuesta As New RespuestaWS - - If objProyecto.GetSubProyectos(CveEmpresa) Then - Respuesta.Datos = objProyecto.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objProyecto.Dispose() - Return Respuesta - End Function - - - Public Function GetClientes(CveEmpresa As Integer) As RespuestaWS - Dim objClientes As New ClsClientes - Dim Respuesta As New RespuestaWS - - If objClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - Respuesta.Datos = objClientes.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objClientes.Dispose() - Return Respuesta - End Function - - Public Function GetGral_Folios(CveEmpresa As Integer) As RespuestaWS - Dim objFolios As New ClsGralFolios - Dim Respuesta As New RespuestaWS - - If objFolios.GetFolios() Then - Respuesta.Datos = objFolios.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objFolios.Dispose() - Return Respuesta - End Function - 'Candiddato a borrar - 'COMENTADO IPP: CAMBIO LA FORMA DE USAR LAS PROMOCIONES | 2 NOVIEMBRE 2016 - ' - 'Public Function GetVta_PromocionesDetalle(CvePS As Integer, Fecha As String, CveSucursal As Integer, CveEmpresa As Integer) As RespuestaWS - ' Dim objPromocionesDetalle As New ClsVentas - ' Dim Respuesta As New RespuestaWS - - ' If objPromocionesDetalle.GetPromocionesDetalle(-1, CvePS, Fecha, CveSucursal, CveEmpresa) Then - ' Respuesta.Datos = objPromocionesDetalle.DtResultados - ' Respuesta.Datos.TableName = "Resultados" - ' Respuesta.HuboError = False - ' Else - ' Respuesta.Descripcion = "HUBO UN ERROR" - ' End If - - ' objPromocionesDetalle.Dispose() - ' Return Respuesta - 'End Function - - - Public Function GetVta_Promociones(Fecha As String, CveSubProyecto As Integer, CveEmpresa As Integer) As RespuestaWS - Dim objPromociones As New ClsVentas - Dim Respuesta As New RespuestaWS - - If objPromociones.GetPromociones(-1, Fecha, -1, -1, 1, CveEmpresa, CveSubProyecto) Then - Respuesta.Datos = objPromociones.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPromociones.Dispose() - Return Respuesta - End Function - - - Public Function GetUnidadesMedida(CveEmpresa As Integer) As RespuestaWS - Dim objUnidadesMedida As New ClsUnidadesMedida - Dim Respuesta As New RespuestaWS - - If objUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then - Respuesta.Datos = objUnidadesMedida.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objUnidadesMedida.Dispose() - Return Respuesta - End Function - - - Public Function GetMonedas(CveEmpresa As Integer) As RespuestaWS - Dim objMonedas As New ClsMonedas - Dim Respuesta As New RespuestaWS - - If objMonedas.GetMonedas() Then - Respuesta.Datos = objMonedas.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objMonedas.Dispose() - Return Respuesta - End Function -#End Region - -#Region "ProductosServicios" - - Public Function GetProductosServicios(CvePS As Integer, CveClasificacion As Integer, Codigo As String, PS As String, CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS - Dim objPS As New ClsProductosServicios - Dim Respuesta As New RespuestaWS - - If objPS.GetPS(CvePS, CveClasificacion, CveEmpresa, Codigo, PS, CveSubProyecto:=CveSubProyecto, pAplicaParaVenta:=1, pEstado:=1) Then - Respuesta.Datos = objPS.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPS.Dispose() - Return Respuesta - End Function - - - Public Function GetClasificaciones(CveEmpresa As Integer) As RespuestaWS - Dim objClasificaciones As New ClsClasificaciones - Dim Respuesta As New RespuestaWS - - If objClasificaciones.GetClasificaciones() Then - Respuesta.Datos = objClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " + CveEmpresa.ToString) - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objClasificaciones.Dispose() - Return Respuesta - End Function - - - Public Function GetCategorias(CveEmpresa As Integer) As RespuestaWS - Dim objCategorias As New ClsGenerales - Dim Respuesta As New RespuestaWS - - If objCategorias.GetCategorias() Then - Respuesta.Datos = objCategorias.DtResultados.FiltraParametros("CveEmpresa = " + CveEmpresa.ToString) - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objCategorias.Dispose() - Return Respuesta - End Function - - - Public Function GetProductosServiciosEquivalencias(CvePS As Integer, CveEmpresa As Integer) As RespuestaWS - Dim objPS As New ClsProductosServicios - Dim Respuesta As New RespuestaWS - - If objPS.GetPSEquivalencias(CvePS, CveEmpresa) Then - Respuesta.Datos = objPS.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPS.Dispose() - Return Respuesta - End Function - - - Public Function GetProductosServiciosCaracteristicas(CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS - Dim objPSCaracteristicas As New ClsGralProductosServiciosCaracteristicas - Dim Respuesta As New RespuestaWS - - If objPSCaracteristicas.GetProductosServiciosCaracteristicas(CveEmpresa, CveSubProyecto) Then - Respuesta.Datos = objPSCaracteristicas.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPSCaracteristicas.Dispose() - Return Respuesta - End Function - - - Public Function GetProductosServiciosCaracteristicasOpciones(CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS - Dim objPSCaracteristicas As New ClsGralProductosServiciosCaracteristicas - Dim Respuesta As New RespuestaWS - - If objPSCaracteristicas.GetProductosServiciosCaracteristicasOpciones(CveEmpresa, CveSubProyecto) Then - Respuesta.Datos = objPSCaracteristicas.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPSCaracteristicas.Dispose() - Return Respuesta - End Function - - - Public Function GetProductosServiciosPaquetes(CveEmpresa As Integer) As RespuestaWS - Dim objPSPaquetes As New ClsProductosServicios - Dim Respuesta As New RespuestaWS - - If objPSPaquetes.GetPaqueteDetalle(-1, CveEmpresa) Then - Respuesta.Datos = objPSPaquetes.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objPSPaquetes.Dispose() - Return Respuesta - End Function -#End Region - -#Region "Usuarios" - - Public Function GetUsuariosDetalle(CveUsuario As Integer) As UsuarioWS - Dim objUsuario As New ClsSisUsuarios - Dim objEmpresa As New ClsSisEmpresas - - Dim Usuario As New UsuarioWS - - If objUsuario.GetUsuariosDetalle(CveUsuario, -1) Then - With Usuario - .CveUsuario = objUsuario.CveUsuario - .Usuario = objUsuario.Usuario - .Contraseña = objUsuario.Contraseña - .Nombre = objUsuario.Nombre - .CveRol = objUsuario.CveRol - '.Rol = - '.NombreEmpresa = objUsuario.no - .CveEmpresa = objUsuario.CveEmpresa - '.Liga = - '.Portal = - '.Modulos As HybridDictionary - '.Procesos As HybridDictionary - '.SeleccionoEmpresa As Boolean - '.CveSucursal = - '.CveProveedor = - '.CveCliente = - '.CveSupervisor As Integer - '.CveCoordinador As Integer - '.CveProspecto As Integer - '.CveVendedor As Integer - '.Referencia As String - '.EsSupervisorRH As Boolean - '.Empresa As Empresa = Nothing - '.ModoSimulacion As Boolean = False - '.NombreAbreviatura As String - - If objEmpresa.GetEmpresas(.CveEmpresa, "-1", "-1", "-1", "-1") Then - .Empresa = objEmpresa.Empresa - End If - End With - End If - - objUsuario.Dispose() - objEmpresa.Dispose() - - Return Usuario - End Function - - - Public Function GetUsuariosRolesProcesos(Usuario As String, Contraseña As String, CveProceso As Integer) As Integer - Dim CveUsuario As Integer = -1 - Dim objUsuarios As New ClsSisUsuarios - Dim objUsuario As New Usuario - - objUsuario = objUsuarios.ValidaUsuario(Usuario, Encripta(Contraseña), IMEI) - If objUsuario IsNot Nothing AndAlso objUsuario.TienePermisoProceso(CveProceso) Then - CveUsuario = objUsuario.CveUsuario - End If - - objUsuarios.Dispose() - - Return CveUsuario - End Function - - - Public Function GetUsuarios(CveEmpresa As Integer) As RespuestaWS - Dim Respuesta As New RespuestaWS - Respuesta.HuboError = False - - Using objUsuarios As New ClsSisUsuarios - - If objUsuarios.GetUsuarios(-1) Then - Respuesta.Datos = objUsuarios.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0} AND Estatus = 1 ", CveEmpresa)) - Respuesta.Datos.TableName = "Resultados" - Else - Respuesta.HuboError = True - Respuesta.Descripcion = "HUBO UN ERROR" - End If - End Using - Using objsubproy As New ClsSubProyectos - If objsubproy.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then - - Respuesta.Datos2 = objsubproy.DtResultados - Respuesta.Datos2.TableName = "Resultados" - End If - - End Using - - Return Respuesta - End Function - - - Public Function GetProcesos() As RespuestaWS - Dim objProcesos As New ClsSisProcesos - Dim Respuesta As New RespuestaWS - - If objProcesos.GetProcesos(-1) Then - Respuesta.Datos = objProcesos.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objProcesos.Dispose() - Return Respuesta - End Function - - Public Function GetUsuariosProcesos(CveUsuario As Integer) As RespuestaWS - Dim objUsuariosProcesos As New ClsSisUsuarios - Dim Respuesta As New RespuestaWS - - If objUsuariosProcesos.GetUsuariosProcesos(CveUsuario) Then - Respuesta.Datos = objUsuariosProcesos.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If - - objUsuariosProcesos.Dispose() - Return Respuesta - End Function -#End Region - -#Region "MetodosPago" - - Public Function GetMetodosPagos() As RespuestaWS - Dim objMetodoPago As New ClsMetodosPagos - Dim Respuesta As New RespuestaWS - - If objMetodoPago.GetMetodosPago() Then - Respuesta.Datos = objMetodoPago.DtResultados - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - End If - - objMetodoPago.Dispose() - Return Respuesta - End Function -#End Region - - -#Region "Ventas" - - Public Function AddVenta(ArregloVentas As ClsVentaWS()) As List(Of ListItem) - Dim MM As String = "AddVenta -- INFORMACION, ENTRO A AddVenta de WS_PuntoVenta" - MM.GuardaLog() - - Dim Errores As Boolean = False - Dim CveVentas As New List(Of ListItem) - Dim TotalPagado As Double = 0 - - - For Each objVenta As ClsVentaWS In ArregloVentas - Dim Fech1, Fech2, Fech3 As Date - If objVenta.Fech1 IsNot Nothing AndAlso objVenta.Fech1.Trim.Length > 0 AndAlso IsDate(objVenta.Fech1) Then Fech1 = objVenta.Fech1.Trim.ToDate - If objVenta.Fech2 IsNot Nothing AndAlso objVenta.Fech2.Trim.Length > 0 AndAlso IsDate(objVenta.Fech2) Then Fech2 = objVenta.Fech2.Trim.ToDate - If objVenta.Fech3 IsNot Nothing AndAlso objVenta.Fech3.Trim.Length > 0 AndAlso IsDate(objVenta.Fech3) Then Fech3 = objVenta.Fech3.Trim.ToDate - - Dim objVentas As New ClsVentas() - Dim ObjConta As New ClsContabilidad(objVentas.IniciaTransacSQL()) - Dim ObjPs As New ClsProductosServicios() - - Dim ErrorDetalles As Boolean = False - Dim ErrorMovtosVentas As Boolean = False - Dim ErrorMovtosDSV As Boolean = False - Dim ErrorMovtosCxC As Boolean = False - Dim ErrorMovtosTrasladoIVA As Boolean = False - Dim CvePrePoliza As Integer = 0 - - Try - - If objVenta.CveVenta = 0 Then - objVenta.Amortizacion = 0 - - - - If objVentas.GetVentaTerminal(objVenta.CveVentaTerminal, objVenta.Fecha, objVenta.CveSubProyecto, objVenta.CveEmpresa) Then - - CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "Punto de Venta addVenta", objVenta.CveUsuario, objVenta.CveEmpresa) - - If objVentas.DtResultados.Rows.Count = 0 Then - If objVentas.AddVenta(objVenta.TipoDocto, objVenta.FolioFact, objVenta.CveCliente, objVenta.CveClienteSucursal, - objVenta.SubTotal, objVenta.Descuento, objVenta.Amortizacion, objVenta.IVA, objVenta.RetIVA, objVenta.RetISR, - objVenta.Total, objVenta.CveMoneda, objVenta.TipoCambio, objVenta.CveMetodoPago, objVenta.CondicionesPago, - objVenta.FormaPago, Now, objVenta.Fecha, objVenta.MotivoDescuento, objVenta.Observaciones, objVenta.FechaEjecucion, - objVenta.CveVendedor, If(objVenta.Alfa1 IsNot Nothing, objVenta.Alfa1, ""), If(objVenta.Alfa2 IsNot Nothing, objVenta.Alfa2, ""), If(objVenta.Alfa3 IsNot Nothing, objVenta.Alfa3, ""), objVenta.Num1, - objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, objVenta.CveMesa, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal, CveSubProyecto:=objVenta.CveSubProyecto, CveSubProyectoEjecucion:=objVenta.CveSubProyecto) Then - objVenta.CveVenta = objVentas.CveVenta - 'Ingresar los detalles - For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle - If objVentas.AddVentaDetalle(objVentas.CveVenta, Detalle.CvePS, Detalle.Cantidad, Detalle.CveUnidadMedida, Detalle.PU, Detalle.IVA, Detalle.Total, Detalle.Observaciones, Detalle.Descuento, Detalle.TipoDescuento, Detalle.CveSubProyecto, -1) Then - 'Ingresar las caracteristicas del detalle de la venta - For Each Caracteristica As ClsVentaWS.ClsVentaDetalleCaracteristicaWS In Detalle.Caracteristicas - If objVentas.AddVentaDetalleCaracteristica(objVentas.CveVentaDetalle, Caracteristica.CvePS, Caracteristica.CveOpcion) = False Then - 'Error al ingresar las caracteristicas del detalle de la venta - Errores = True - Exit For - End If - Next - Else - 'Error al ingresar el detalle de la venta - ErrorDetalles = True - Exit For - End If - Next - - 'Ingresar Inventario Modificado por Charlie - 'Dim ObjInv As New ClsInventarios(objVentas.IniciaTransacSQL) - - 'Dim CveInvMovimiento As Integer = ObjInv.AddMovimiento(6, 3, objVenta.CveMoneda, objVenta.Fecha, -1, objVenta.CveUsuario, objVenta.CveEmpresa, -1, objVenta.CveVenta, -1, -1) - - 'If CveInvMovimiento > 0 Then - ' For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle - ' If (Detalle.EsPaquete) Then - ' If ObjPs.GetPaqueteDetalle(Detalle.CvePS) Then - ' Dim contador As Integer = 0 'Declaramos el contador para manejar las filas - ' For Each Row As DataRow In ObjPs.DtResultados.Rows - ' If Not ObjInv.AddMovimientoDetalle(CveInvMovimiento, ObjPs.DtResultados.Rows(contador)("Cantidad").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("CveUnidadMedida").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("CvePS").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("Precio").ToString.ToDouble, -1) Then - ' ErrorDetalles = True - ' End If - ' contador += 1 - ' Next - ' Else - ' ErrorDetalles = True - ' End If - ' Else - ' If Not ObjInv.AddMovimientoDetalle(CveInvMovimiento, Detalle.Cantidad, Detalle.CveUnidadMedida, Detalle.CvePS, Detalle.PU, -1) Then - ' ErrorDetalles = True - ' End If - ' End If - - ' Next - - 'Else - ' Errores = True - 'End If - - If Errores = False And ErrorDetalles = False Then - 'Ingresar los metodos de pago - 'si el registro va correcto y no hay errores - For Each MetodoPago As ClsMetodosPagoWS In objVenta.MetodoPago - If MetodoPago.Importe > 0 Then - TotalPagado = TotalPagado + MetodoPago.Importe - If objVentas.AddVta_VentaPago(objVenta.CveVenta, MetodoPago.CveMetodoPago, MetodoPago.Importe) = False Then - 'Error al ingresar el detalle de la venta - Errores = True - Exit For - End If - End If - Next - End If - - If Errores = False And ErrorDetalles = False Then - 'Ingresar los registros de bitacora - If objVenta.Bitacora.Count > 0 Then - For Each Bitacora As ClsVta_BitacoraWS In objVenta.Bitacora - If objVentas.AddVta_Bitacora(objVenta.CveVenta, Bitacora.Fecha, Bitacora.Observacion, Bitacora.CveUsuario) = False Then - 'Error al ingresar el detalle de la venta - Errores = True - Exit For - End If - Next - End If - End If - - 'Ingresar PrePoliza si no esta pagada - If Errores = False And ErrorDetalles = False And TotalPagado < objVenta.Total Then - Dim CveIE As Integer = -1 - - Dim IdCtaContClientes As Integer - Dim CveConceptoAfectacion As Integer = 1 'Cliente - Dim CveConceptoAntCli As Integer = 3 'Anticipo Cliente - Dim CveConceptoVenta As Integer = 4 'Venta - Dim CveConceptoCanAnt As Integer = 11 'Cancelacion Anticipos - Dim CveConceptoDSV As Integer = 12 ' DSV - Dim CveConceptoIVA As Integer = 13 'IVA Trasladado - Dim CveConceptoRetIVA As Integer = 8 'Ret IVA - Dim CveConceptoRetISR As Integer = 9 'Ret ISR - Dim IdCtaContDSV As Integer - - Dim ObjFisConfiguracion As New ClsFISConfiguracion - If ObjFisConfiguracion.GetConfiguracion(objVenta.CveEmpresa) Then - IdCtaContDSV = ObjFisConfiguracion.ERDSV - Else - IdCtaContDSV = 0 - End If - ObjFisConfiguracion.Dispose() - - Dim ObjCliente As New ClsClientes() - If ObjCliente.GetClientes(objVenta.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, objVenta.CveEmpresa) Then - If ObjCliente.DtResultados.Rows.Count > 0 Then - IdCtaContClientes = ObjCliente.IdCtaContClientes - End If - End If - ObjCliente.Dispose() - - - If CvePrePoliza > 0 Then - Dim TipoMovimientoVenta As Boolean = True - Dim TipoMovimientoImpuestos As Boolean = False - Dim ImporteMov As Double - - 'Se agregan los movimientos de la Venta - 'If DT.Rows.Count > 0 Then - 'Se agrega movimiento separado por la cuenta de ventas (ER) - ' For Each Row As DataRow In DT.Rows - ImporteMov = objVenta.SubTotal ' TmpDT.SUM("Total", "IdCtaContVentas = '" & Row("IdCtaContVentas").ToString & "'") - Dim CveClasificacion_04 = -1 - If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, CveSubProyecto:=objVenta.CveSubProyecto, CveClasificacion:=CveClasificacion_04) Then - ErrorMovtosVentas = True - End If - End If - ' Next - - 'Se agregan los DSV DESCUENTOS - ImporteMov = objVenta.Descuento - If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then - ErrorMovtosDSV = True - End If - End If - 'End If - - 'Se agregan las CxC - ImporteMov = objVenta.Total - TotalPagado - If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then - ErrorMovtosCxC = True - End If - End If - - 'Si hubo un pago agregarlo - ImporteMov = TotalPagado - If ImporteMov <> 0 Then - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then - ErrorMovtosCxC = True - End If - End If - - 'Se agregan el Traslado de IVA - ImporteMov = objVenta.IVA - If ImporteMov <> 0 Then - Dim PorcentajeImpuesto = 0 - If objVenta.SubTotal > 0 Then - PorcentajeImpuesto = (objVenta.IVA / objVenta.SubTotal) - End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, PorcentajeImpuesto:=PorcentajeImpuesto) Then - ErrorMovtosTrasladoIVA = True - End If - End If - End If - End If - Else - Errores = True - End If - Else - objVentas.CveVenta = objVentas.DtResultados.Rows(0)("CveVenta").ToString.ToEntero - MM = "AddVenta -- INFORMACION, LA VENTA YA EXISTE EN LA BASE DE DATOS" - MM.GuardaLog() - End If - Else - Errores = True - End If - - - - Else - objVentas.CveVenta = objVenta.CveVenta - 'Ingresar los metodos de pago - 'si el registro va correcto y no hay errores - objVentas.RemoveVta_VentaPago(objVenta.CveVenta, -1) - - For Each MetodoPago As ClsMetodosPagoWS In objVenta.MetodoPago - If MetodoPago.Importe > 0 Then - If objVentas.AddVta_VentaPago(objVenta.CveVenta, MetodoPago.CveMetodoPago, MetodoPago.Importe) = False Then - 'Error al ingresar el detalle de la venta - Errores = True - Exit For - End If - End If - Next - End If - - Catch ex As Exception - Errores = True - End Try - - If Errores OrElse ErrorDetalles OrElse ErrorMovtosVentas OrElse ErrorMovtosDSV OrElse ErrorMovtosCxC OrElse ErrorMovtosTrasladoIVA Then - objVentas.RollBack() - CveVentas.Add(New ListItem(objVenta.CveVentaTerminal.ToString, "-1")) - Else - objVentas.Commit() - CveVentas.Add(New ListItem(objVenta.CveVentaTerminal.ToString, objVentas.CveVenta.ToString)) - End If - objVentas.Dispose() - ObjConta.Dispose() - Next - - - - Return CveVentas - End Function - -#End Region - - -#Region "Cortes" - - Public Function GetVtaCortes(FechaI As String, FechaF As String, CveUsuario As Integer, CveEmpresa As Integer, Finalizado As Integer) As List(Of ClsVtaCortesWS) - Dim objPV As New ClsPuntoVenta - Dim objVtaCortes As New List(Of ClsVtaCortesWS) - - If (objPV.GetVta_Cortes(FechaI, FechaF, CveUsuario, -1, CveEmpresa, Finalizado) = True) Then - For Each Row As DataRow In objPV.DtResultados.Rows - objVtaCortes.Add(New ClsVtaCortesWS(Row("CveCorte").ToString.ToEntero, Row("FechaInicial").ToString.ToDateTime, If(IsDate(Row("FechaFinal")), Row("FechaFinal").ToString.ToDateTime, New DateTime), Row("ImporteInicial").ToString.ToDouble, If(Not IsDBNull(Row("ImporteFinal")), Row("ImporteFinal").ToString.ToDouble, 0), Row("Descripcion").ToString(), Row("Estatus").ToString, Row("Usuario").ToString, Row("UsuarioNombre").ToString, Row("Vendido").ToString.ToDouble, Row("VendidoEfectivo").ToString.ToDouble, Row("Retirado").ToString.ToDouble, Row("Ingresado").ToString.ToDouble)) - Next - End If - objPV.Dispose() - - Return objVtaCortes - End Function - - - Public Function GetVta_MovimientosCajas(CveCorte As Integer, TipoMovimiento As Integer) As List(Of ClsMovimientosCajaWS) - Dim objPV As New ClsPuntoVenta() - Dim objMovimientosCaja As New List(Of ClsMovimientosCajaWS) - - If objPV.GetVta_MovimientosCajas(CveCorte, TipoMovimiento) Then - For Each Row As DataRow In objPV.DtResultados.Rows - objMovimientosCaja.Add(New ClsMovimientosCajaWS(Row("CveMovimiento").ToString.ToEntero, Row("CveCorte").ToString.ToEntero, Row("Importe").ToString.ToEntero, Row("Descripcion").ToString, Row("TipoMovimiento").ToString)) - Next - End If - - objPV.Dispose() - - Return objMovimientosCaja - End Function - - - Public Function AddVta_MovimientosCajas(CveCorte As Integer, CveUsuario As Integer, Importe As Double, Descripcion As String, TipoMovimiento As Integer, Fecha As DateTime) As Integer - Dim objPV As New ClsPuntoVenta() - Dim CveMovimiento As Integer - - If objPV.AddVta_MovimientosCajas(CveCorte, CveUsuario, Importe, Descripcion, TipoMovimiento, Fecha) Then - CveMovimiento = objPV.CveMovimiento - End If - - objPV.Dispose() - - Return CveMovimiento - End Function - - - Public Function AddVtaCortes(FechaInicial As DateTime, ImporteInicial As Decimal, CveUsuario As Integer, Descripcion As String, CveEmpresa As Integer) As Integer - Dim objPV As New ClsPuntoVenta() - Dim CveCorte As Integer - - If objPV.AddVtaCortes(FechaInicial, ImporteInicial, CveUsuario, Descripcion, CveEmpresa) Then - CveCorte = objPV.CveCorte - End If - - objPV.Dispose() - - Return CveCorte - End Function - - - Public Function AddVtaCortesDetalles(CveCorte As Integer, CveMetodoPago As Integer, Importe As Double) As Boolean - Dim Retorno As Boolean = False - Dim objPV As New ClsPuntoVenta() - - If objPV.AddVtaCortesDetalles(CveCorte, CveMetodoPago, Importe) Then - Retorno = True - End If - - objPV.Dispose() - - Return Retorno - End Function - - - Public Function PruebaMail() As Boolean - EnviarCorreo(3246, 61) - Return True - End Function - - - Public Function UpdateVtaCortes(VtaCorte As ClsVtaCortesWS) As Boolean - Dim objPV As New ClsPuntoVenta() - Dim Respuesta As Boolean = False - - objPV.IniciaTransacSQL() - - If objPV.UpdateFinalizadoVtaCortes(VtaCorte.CveCorte, VtaCorte.ImporteFinal, VtaCorte.Diferencia, VtaCorte.FechaFinal, VtaCorte.CveEmpresa) Then - Respuesta = True - End If - - If Respuesta = True Then - For Each CorteDetalle As ClsVtaCortesWS.ClsVtaCortesDetallesWS In VtaCorte.CortesDetalles - If Not objPV.AddVtaCortesDetalles(CorteDetalle.CveCorte, CorteDetalle.CveMetodoPago, CorteDetalle.Importe) Then - Respuesta = False - Exit For - End If - Next - End If - - If Respuesta = True Then - objPV.Commit() - - 'Enviar correo de corte de turno - EnviarCorreo(VtaCorte.CveCorte, VtaCorte.CveEmpresa) - - ' Dim cuenta As Integer = GetCuenta(2090) - Else - objPV.RollBack() - End If - - objPV.Dispose() - - Return Respuesta - End Function - - - Public Function GetVentasPagoGet(CveCorte As Integer, CveEmpresa As Integer) As List(Of ClsVtaVentasPagoWS) - Dim objPV As New ClsPuntoVenta - Dim objVentasPago As New List(Of ClsVtaVentasPagoWS) - - ' Dim Respuesta As String - - If objPV.GetVta_VentasPago(CveCorte, CveEmpresa) Then - For Each Row As DataRow In objPV.DtResultados.Rows - objVentasPago.Add(New ClsVtaVentasPagoWS(CveCorte, Row("MetodoPago").ToString, Row("Importe").ToString.ToDouble)) - Next - End If - objPV.Dispose() - - Return objVentasPago - End Function - - ' - 'Public Function GetCuenta(CveSucursal As Integer) As Integer - ' Dim objSU As New ClsSucursales - ' Dim Cuenta As Integer - - ' 'Cuenta = objSU.GetCuenta(CveSucursal) - ' objSU.Dispose() - - ' Return Cuenta - 'End Function - - - Public Function AddBancosIE(Importe As Double, Moneda As Integer, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, Cuenta As Integer, Comprobante As String, Opcion As String) As Boolean - Dim ObjIE As New ClsBancos() - Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - Dim Folio As Long - Dim Banco As New ClsBancos - - Dim Respuesta As Boolean = False - Dim CveIE As Integer - Dim MsgError As String = "" - Dim CveConceptoContable As Integer = 4 - Dim CveConceptoCompra As Integer = 30 - Dim CIF As Double = 0 - Dim CvePlantillaPoliza As Integer = 4 - Dim CveTipoPoliza As Integer = 1 - Dim CvePrePoliza As Integer = 0 - Dim CveTipoTransaccion As Integer = 4 - - Try - - CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "Punto de venta IE", CveUsuario, CveEmpresa) - - 'valida prepoliza - If CvePrePoliza > 0 Then - - Folio = Banco.GetNextFolio(Cuenta, CveTipoTransaccion) - Banco.Dispose() - - CveIE = ObjIE.AddBancos_IE(Cuenta, CveTipoTransaccion, Fecha, Folio, "", Importe, Moneda, - 0, Opcion, "", False, False, -1, CvePrePoliza, "pdf", CveUsuario, CveEmpresa) - - - If CveIE > 0 Then - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE, ImporteMX:=Importe) Then - Dim IVA As Double = 0 - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE, ImporteMX:=Importe - IVA - CIF) Then - - Else - MsgError = "no se pudo insertar el detalle de la póliza2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - - End If - - End If - - ObjIE.Commit() - Respuesta = True - - Catch ex As Exception - Respuesta = False - ObjIE.RollBack() - End Try - - ObjMov.Dispose() - ObjIE.Dispose() - - Return Respuesta - End Function -#End Region - - -#Region "Vendedores" - - Public Function GetVendedores(CveEmpresa As Integer) As RespuestaWS - Dim objVend As New ClsVtaVendedores - Dim Respuesta As New RespuestaWS - - If objVend.GetVendedores(CveEmpresa) Then - Respuesta.Datos = objVend.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Vendedores" - Respuesta.HuboError = False - - End If - - objVend.Dispose() - Return Respuesta - End Function -#End Region - - -#Region "Mesas" - - Public Function GetMesas(CveEmpresa As Integer) As RespuestaWS - Dim objVent As New ClsVentas - Dim Respuesta As New RespuestaWS - - If objVent.GetMesas(CveEmpresa) Then - Respuesta.Datos = objVent.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Mesas" - Respuesta.HuboError = False - - End If - - objVent.Dispose() - Return Respuesta - End Function -#End Region - -#Region "Inventario" - - Public Function GetInv_Almacenes(CveEmpresa As Integer) As RespuestaWS - Dim objInventario As New ClsInventarios - Dim Respuesta As New RespuestaWS - - If objInventario.GetAlmacenes(-1, -1, CveEmpresa, -1) Then - Respuesta.Datos = objInventario.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Almacenes" - Respuesta.HuboError = False - End If - - objInventario.Dispose() - Return Respuesta - End Function - - - Public Function GetInv_Conceptos() As RespuestaWS - Dim objInventario As New ClsInventarios - Dim Respuesta As New RespuestaWS - - If objInventario.GetConceptos() Then - Respuesta.Datos = objInventario.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Inv_Conceptos" - Respuesta.HuboError = False - End If - - objInventario.Dispose() - Return Respuesta - End Function - - - Public Function GetInv_SeccionesAlmacenes(CveEmpresa As Integer) As RespuestaWS - Dim objInventario As New ClsInventarios - Dim Respuesta As New RespuestaWS - - If objInventario.GetSeccionesAlmacenes(CveEmpresa, -1) Then - Respuesta.Datos = objInventario.DtResultados '.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Inv_SeccionesAlmacenes" - Respuesta.HuboError = False - End If - - objInventario.Dispose() - Return Respuesta - End Function - - Public Function GetInv_TiposAlmacenes(CveEmpresa As Integer) As RespuestaWS - Dim objInventario As New ClsInventarios - Dim Respuesta As New RespuestaWS - - If objInventario.GetTiposAlmacenes() Then - Respuesta.Datos = objInventario.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - Respuesta.Datos.TableName = "Inv_TiposAlmacenes" - Respuesta.HuboError = False - End If - - objInventario.Dispose() - Return Respuesta - End Function - - Public Function GetInv_Movimientos(CveEmpresa As Integer) As RespuestaWS - Dim objInventario As New ClsInventarios - Dim Respuesta As New RespuestaWS - - If objInventario.GetMovimientos(-1, -1, -1, CveEmpresa) Then - Respuesta.Datos = objInventario.DtResultados.FiltraParametros("CveMovimientoTerminal IS NULL") - Respuesta.Datos.TableName = "Inv_Movimientos" - - For Each Row As DataRow In Respuesta.Datos.Rows - If objInventario.GetMovimientosDetalle(Row("CveMovimiento").ToString.ToEntero, CveEmpresa) Then - If objInventario.DtResultados.Rows.Count > 0 Then - Respuesta.Datos2.Merge(objInventario.DtResultados) - End If - End If - Next - - Respuesta.HuboError = False - End If - - objInventario.Dispose() - Return Respuesta - End Function -#End Region - - -#Region "Contabilidad" - ' _ - 'Public Function GetConta_ConceptosContables() As RespuestaWS - ' Dim objConta As New ClsContabilidad - ' Dim Respuesta As New RespuestaWS - - ' If objConta.GetConta_ConceptosContables() Then - ' Respuesta.Datos = objConta.DtResultados - ' Respuesta.Datos.TableName = "Conta_ConceptosContables" - ' Respuesta.HuboError = False - ' End If - - ' objConta.Dispose() - ' Return Respuesta - 'End Function - - ' _ - 'Public Function AddPrePolizas(ArregloPrePolizas As ClsPrePolizaWS()) As List(Of ListItem) - ' Dim Errores As Boolean = False - ' Dim CvePrePolizas As New List(Of ListItem) - ' Dim CvePrePoliza As Integer - - ' Dim objConta As New ClsContabilidad - - ' For Each objPrepoliza As ClsPrePolizaWS In ArregloPrePolizas - ' objConta.IniciaTransacSQL() - - ' CvePrePoliza = objConta.AddPrePolizas(objPrepoliza.Modulo, objPrepoliza.CveTipoPoliza, objPrepoliza.Cargos, objPrepoliza.Abonos, objPrepoliza.CveMoneda, objPrepoliza.Fecha, objPrepoliza.CveUsuario, objPrepoliza.CveEmpresa) - ' If CvePrePoliza > 0 Then - ' 'Ingresar los detalles - ' For Each Detalle As ClsPrePolizaWS.ClsPrePolizaDetalleWS In objPrepoliza.Detalle - ' If objConta.AddPrePolizasDetalle(objPrepoliza.CvePrepoliza, Detalle.TipoMovto, Detalle.Importe, Detalle.Referencia, Detalle.CveConceptoContable, Detalle.Concepto, Detalle.FechaVencimiento, Detalle.IdCtaContable, Detalle.IdSegmentoNegocio, Detalle.CveIE, Detalle.CveVenta, Detalle.CveCompra, Detalle.CveSubProyecto, Detalle.CveCliente, Detalle.CveProveedor, Detalle.CvePersonal, Detalle.CveMovimientoAlmacen, Detalle.CveActivoFijo) = False Then - ' 'Error al ingresar el detalle de la venta - ' Errores = True - ' Exit For - ' End If - ' Next - ' End If - - ' If Errores = False Then - ' objConta.Commit() - ' CvePrePolizas.Add(New ListItem(objPrepoliza.CvePrepolizaTerminal.ToString, CvePrePoliza.ToString)) - ' Else - ' objConta.RollBack() - ' CvePrePolizas.Add(New ListItem(objPrepoliza.CvePrepolizaTerminal.ToString, "-1")) - ' End If - ' Next - - ' objConta.Dispose() - ' Return CvePrePolizas - 'End Function - - -#End Region - -#Region "ENVIO CORREO" - Protected Sub EnviarCorreo(CveCorte As Integer, CveEmpresa As Integer) - Dim Body As String ''GlobalDTUsuarios(CveUsuario)(0)("correo").ToString - - Dim Correo As String = If(CveEmpresa = 61, "ariel@grupoabt.mx", "rene.molina@gmail.com") - Dim Correos() As String = If(CveEmpresa = 61, {"roberto@grupoabt.mx", "isaac@grupoabt.mx", "grisey@grupoabt.mx"}, {"julian@adsistemas.mx", "jonaslopez@gmail.com"}) - 'Dim Correo As String = If(CveEmpresa = 61, "charlie.cuchm@gmail.com", "charlie.cuchm@gmail.com") - 'Dim Correos() As String = If(CveEmpresa = 61, {"charlie.cuchm@gmail.com"}, {"charlie.cuchm@gmail.com", "charlie.cuchm@gmail.com"}) - Dim Sucursal As String = "" - - Try - Body = GeneraCorreo(CveCorte, CveEmpresa, Sucursal, "") - - Dim Empresa As Empresa = Nothing - Dim ObjEmpresa As New ClsSisEmpresas() - If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then - Empresa = ObjEmpresa.Empresa - 'Empresa.Ruta = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa) - End If - ObjEmpresa.Dispose() - - Dim Asunto As String = String.Format("SIG. Corte de Turno de: {0}", Sucursal) - Dim Hilo As New System.Threading.Thread(AddressOf MandaCorreo) - - Dim Parametros(3) As Object - Parametros(0) = Empresa - Parametros(1) = Correo - Parametros(2) = Asunto - Parametros(3) = Body - - Dim Env As New Envio - Env.Empresa = Empresa - Env.Correos = Correos - Env.Correo = Correo - Env.Asunto = Asunto - Env.Contenido = Body - - Hilo.Start(Env) - ' Alert("Se enviara correo por cambio Modificacion") - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - - Private Sub MandaCorreo(Data As Object) - Dim Env As Envio = CType(Data, Envio) - Dim Empresa As Empresa = Env.Empresa - Dim Correo As String = Env.Correo - Dim Asunto As String = Env.Asunto - Dim Body As String = Env.Contenido - Dim Correos() As String = Env.Correos - - Dim Mail As New ClsSisMail() - Mail.SendMail(Empresa, Correo, Asunto, Body) - End Sub - - Private Function GeneraCorreo(CveCorte As Integer, CveEmpresa As Integer, ByRef Sucursal As String, Opciones As String) As String - Dim strBody As New StringBuilder - 'Obtener datos del corte de turno - Dim objPV As New ClsPuntoVenta - Dim strDetalle As New StringBuilder - Dim strProductos As New StringBuilder - Dim VendidoEfectivo As Double = 0 - - If objPV.GetVta_Cortes("-1", "-1", -1, CveCorte, CveEmpresa, -1) Then - If objPV.CveCorte > 0 Then - Sucursal = objPV.Sucursal - If objPV.GetVta_CortesDetalles(CveCorte) Then - For Each dr As DataRow In objPV.DtResultados.Rows - If dr("CveMetodoPago").ToString.ToEntero = 1 Then - VendidoEfectivo = dr("Importe").ToString.ToDouble - strDetalle.AppendFormat(" {0} ${1} ", - dr("MetodoPago"), (dr("Importe").ToString.ToDouble - objPV.Propina).FormatoNumero) - Else - strDetalle.AppendFormat(" {0} ${1} ", - dr("MetodoPago").ToString, dr("Importe").ToString.FormatoNumero) - End If - Next - End If - - Dim ObjVentas As New ClsPV() - If ObjVentas.GetRepPVVentas("-1", "-1", "-1", "-1", -1, -1, -1, "-1", -1, -1, "-1", CveEmpresa, 6, CveCorte) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - For Each Col As DataColumn In ObjVentas.DtResultados.Columns - If Col.ColumnName.Split("_"c).Length = 3 AndAlso Col.ColumnName.Split("_"c)(1).ToUpper = "TOTAL" Then - strProductos.AppendFormat(" {0} ${1} ", - Col.ColumnName.Split("_"c)(2).ToUpper, ObjVentas.DtResultados.Rows(0)(Col.ColumnName).ToString.FormatoNumero) - End If - Next - End If - End If - ObjVentas.Dispose() - - - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Empresa") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Sucursal) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Empresa) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Direccion) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Colonia) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Ciudad, objPV.Estado, "83333") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.RFC) - strBody.AppendFormat(" ") - strBody.AppendFormat("
{0}
{0}
{0}
Col. {0}
{0}, {1}, C.P.{2}
RFC {0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Corte de Turno") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Descripcion) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.FechaInicial.ToString("dd/MM/yyyy HH:mm")) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.UsuarioNombre) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.FechaFinal.ToString("dd/MM/yyyy HH:mm")) - strBody.AppendFormat(" ") - strBody.AppendFormat("
Descripcion:{0}Inicio:{0}
Usuario:{0}Termino:{0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Movimiento de Efectivo") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.ImporteInicial.FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", VendidoEfectivo.FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Ingresado.FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Retirado.FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objPV.Propina.FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", (objPV.ImporteInicial + VendidoEfectivo + objPV.Ingresado - objPV.Retirado - objPV.Propina).FormatoNumero) - strBody.AppendFormat(" ") - strBody.AppendFormat("
MetodoImporte
Importe Inicial:${0}
Ventas Efectivo:${0}
Entradas:${0}
Salidas:${0}
Propinas:${0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
NETO DE EFECTIVO${0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Detalles de Pagos") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - 'POngo el detalle - strBody.AppendFormat("{0}", strDetalle.ToString) - - strBody.AppendFormat("
MetodoImporte
") - strBody.AppendFormat("
") - - - strBody.AppendFormat("
") - strBody.AppendFormat(" Ventas por Categoria de Producto") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - 'Pongo el detalle por productos - strBody.AppendFormat("{0}", strProductos.ToString) - - strBody.AppendFormat("
CategoriaImporte
") - strBody.AppendFormat("
") - - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.Append("") - End If - End If - - objPV.Dispose() - Return strBody.ToString - End Function -#End Region - -End Class \ No newline at end of file diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 87171a475..681afe43a 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -150,6 +150,17 @@ Namespace Extensiones #Region "Log" + + Public Function GetTagValue(Obj As String, tag As String) As String + Try + Dim Regex = New Regex($"<{tag}>(.*)") + Dim match = Regex.Match(Obj) + Return match.Groups(1).ToString() + Catch ex As Exception + Return "" + End Try + End Function + Public Sub GuardaLog(Str As String) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 914eed43d..95c0d6c4f 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -931,7 +931,7 @@ Public Class E141 : Implements IHttpHandler ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda)) ObjFactura.TipoDocto = TipoDocto ObjFactura.RefDocto = "" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index a47aae2e8..816d27346 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -314,7 +314,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda)) ObjFactura.TipoDocto = "Ing" ObjFactura.RefDocto = "" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/Ashx/SIGFacturacionCiclica.ashx b/Ashx/SIGFacturacionCiclica.ashx index 63fd22d9f..650e27487 100644 --- a/Ashx/SIGFacturacionCiclica.ashx +++ b/Ashx/SIGFacturacionCiclica.ashx @@ -297,7 +297,7 @@ Public Class SIGFacturacionCiclica : Implements IHttpHandler, IRequiresSessionSt ObjFactura.RefDocto = "" ObjFactura.Folio = -1 ObjFactura.Serie = "-1" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = DR("FechaVenc").ToString.ToDate ObjFactura.CvePrePoliza = -1 ObjFactura.CveMetodoPago = 1 diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 541b8f249..c6825298b 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -744,6 +744,10 @@ Partial Class Compras_Compras End Property Private Property CveCompraRefacturacion As Integer Get + If ViewState("CveCompraRefacturacion") Is Nothing Then + ViewState("CveCompraRefacturacion") = -1 + End If + Return ViewState("CveCompraRefacturacion").ToString.ToEntero End Get Set(value As Integer) @@ -4305,10 +4309,18 @@ Partial Class Compras_Compras x = x + 1 End If Next - If x = 0 AndAlso GvInv.Rows.Count > 0 Then - Alert("Favor de seleccionar un producto en la pestaña de almacen", TipoMensaje.MsgAdvertencia) - Exit Sub + + If Not (CveCompraRefacturacion > 0 AndAlso ChkRefacturacionConAlmacen.Checked) Then + + If x = 0 AndAlso GvInv.Rows.Count > 0 Then + Alert("Favor de seleccionar un producto en la pestaña de almacen", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + + End If End If @@ -9235,8 +9247,7 @@ Partial Class Compras_Compras tipoCambioPago = 1 End If - - + Dim DtPrePolizas As DataTable = Nothing If ObjConta.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPrePoliza) Then For Each Row As DataRow In ObjConta.DtResultados.Rows @@ -9252,13 +9263,16 @@ Partial Class Compras_Compras Select Case ConceptoContable Case 6 + Dim CveProveedorConcepto As Integer = 0, CveIE As Integer = 0, CveCreditoDetalle As Integer = 0 Dim ConceptoPersonal As String = "", Concepto As String = "" - If Not ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then + If Not ObjConta.GetPrePolizasDetalleCompra(CveCompra, UsuarioActual.CveEmpresa) Then ErrorPrepoliza = True Else - If ObjConta.DtResultados.FiltraParametros("CveConceptoContable IN (6,68,49,205,176)").Rows.Count > 0 Then + DtPrePolizas = ObjConta.DtResultados.FiltraParametros("CveConceptoContable IN (6,68,49,205,176)") + + If DtPrePolizas.Rows.Count > 0 Then CveProveedorConcepto = ObjConta.DtResultados.FiltraParametros("CveConceptoContable = 6 OR CveConceptoContable = 68 OR CveConceptoContable = 49 OR CveConceptoContable = 205 OR CveConceptoContable = 176").Rows(0)("CveProveedor").ToString.ToEntero CveIE = ObjConta.DtResultados.FiltraParametros("CveConceptoContable = 6 OR CveConceptoContable = 68 OR CveConceptoContable = 49 OR CveConceptoContable = 205 OR CveConceptoContable = 176").Rows(0)("CveIE").ToString.ToEntero CveCreditoDetalle = ObjConta.DtResultados.FiltraParametros("CveConceptoContable = 6 OR CveConceptoContable = 68 OR CveConceptoContable = 49 OR CveConceptoContable = 205 OR CveConceptoContable = 176").Rows(0)("CveCreditoDetalle").ToString.ToEntero @@ -9270,181 +9284,192 @@ Partial Class Compras_Compras CveProveedorConcepto = DdlProveedor.SelectedValue.ToEntero End If - 'Removemos los conceptos de la prepoliza - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 6, CveCompra, 1) Then ErrorPrepoliza = True 'GASTO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 68, CveCompra, 1) Then ErrorPrepoliza = True 'ALMACEN - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 49, CveCompra, 1) Then ErrorPrepoliza = True 'AF - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 205, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 230, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 231, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 176, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 228, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO - If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 229, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO + If Not ErrorPrepoliza Then + For Each RowPrePoliza As DataRow In DtPrePolizas.FiltraParametros("", DistinctColumns:={"CvePrePoliza"}).Rows - 'OBTIENE METODO DE CONTABILIZACIÓN AL GUARDAR - Dim ConceptoContabilizacionAlmacen = 0 - If ObjCompra.GetCompras(CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then - ConceptoContabilizacionAlmacen = ObjCompra.DtResultados.FiltroPrimeroValor("CveConceptoContableAlmacen").ToEntero - End If + Dim CvePrePoliza As Integer = RowPrePoliza("CvePrePoliza").ToString().ToEntero() - 'AF - DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) = 2") - If DT.Rows.Count > 0 AndAlso DdlTipoComprobante.SelectedValue <> "NC" Then - For Each Row2 As DataRow In DT.Rows - importeMovimiento = Row2("Total").ToString.ToDecimal - importeMN = importeMovimiento * tipoCambioActual * Multiplicador - If ObjConta.GetRetCuenta(49, Row2("CveActivoFijo").ToString.ToEntero) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContActivoFijo").ToString.ToEntero + 'Removemos los conceptos de la prepoliza + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 6, CveCompra, 1) Then ErrorPrepoliza = True 'GASTO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 68, CveCompra, 1) Then ErrorPrepoliza = True 'ALMACEN + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 49, CveCompra, 1) Then ErrorPrepoliza = True 'AF + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 205, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 230, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 231, CveCompra, 1) Then ErrorPrepoliza = True 'PS YA RECIBIDO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 176, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 228, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO + If Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 229, CveCompra, 1) Then ErrorPrepoliza = True 'PS NO RECIBIDO + + 'OBTIENE METODO DE CONTABILIZACIÓN AL GUARDAR + Dim ConceptoContabilizacionAlmacen = 0 + If ObjCompra.GetCompras(CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then + ConceptoContabilizacionAlmacen = ObjCompra.DtResultados.FiltroPrimeroValor("CveConceptoContableAlmacen").ToEntero + End If + + 'AF + DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) = 2") + If DT.Rows.Count > 0 AndAlso DdlTipoComprobante.SelectedValue <> "NC" Then + For Each Row2 As DataRow In DT.Rows + importeMovimiento = Row2("Total").ToString.ToDecimal + importeMN = importeMovimiento * tipoCambioActual * Multiplicador + If ObjConta.GetRetCuenta(49, Row2("CveActivoFijo").ToString.ToEntero) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContActivoFijo").ToString.ToEntero + End If + End If + + If importeMovimiento <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Row2("CodAF").ToString, 49, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveActivoFijo:=Row2("CveActivoFijo").ToString.ToEntero, CveIE:=CveIE, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then + ErrorPrepoliza = True + End If + End If + Next + End If + + 'LIMPIA + importeMovimiento = 0 + IdCtaContable = 0 + + 'COSTO ALMACEN + Dim DtAlmacenes = GlobalDTAlmacen(UsuarioActual.CveEmpresa) + If UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen = 0 Then + DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"}) + 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN + + DT.AcceptChanges() + DT = DT.FiltraParametros("ISNULL(CveAlmacen,0) > 0") + If (DT.Rows.Count > 0) AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then + For Each Row2 As DataRow In DT.Rows + + importeMovimiento = TmpDT.SUM("Total", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal + TmpDT.SUM("CostoIndirectoAlmacen", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal 'Row2("Total").ToString.ToDecimal + Row2("CostoIndirectoAlmacen").ToString.ToDecimal + importeMN = importeMovimiento * tipoCambioActual * Multiplicador + If ObjConta.GetRetCuenta(68, GvInv.HeaderRow.FCDropDownList("ddlAlmacen").SelectedValue.ToString.ToEntero) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero + End If + End If + If importeMovimiento <> 0 Then + Dim SeContabiliza As Boolean = True + 'SI ES GASTO DE ALMACEN NO DEBE CONTABILIZAR CONCEPTO 68 + If DdlTipoCompra.SelectedValue = "10" Then + SeContabiliza = False + IdCtaContable = 0 + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), Contabilizable:=SeContabiliza) Then + ErrorPrepoliza = True + End If + + End If + Next End If End If - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Row2("CodAF").ToString, 49, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveActivoFijo:=Row2("CveActivoFijo").ToString.ToEntero, CveIE:=CveIE, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then - ErrorPrepoliza = True - End If - End If - Next - End If + 'LIMPIA + importeMovimiento = 0 + IdCtaContable = 0 - 'LIMPIA - importeMovimiento = 0 - IdCtaContable = 0 - - 'COSTO ALMACEN - Dim DtAlmacenes = GlobalDTAlmacen(UsuarioActual.CveEmpresa) - If UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen = 0 Then - DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"}) - 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN - - DT.AcceptChanges() - DT = DT.FiltraParametros("ISNULL(CveAlmacen,0) > 0") - If (DT.Rows.Count > 0) AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then - For Each Row2 As DataRow In DT.Rows - - importeMovimiento = TmpDT.SUM("Total", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal + TmpDT.SUM("CostoIndirectoAlmacen", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal 'Row2("Total").ToString.ToDecimal + Row2("CostoIndirectoAlmacen").ToString.ToDecimal + 'INV [MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA) ] + If UsuarioActual.Empresa.UsaInventarios And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen.Contiene(176, 205) Then + importeMovimiento = TmpDT.SUM("Total", $"ISNULL(TipoAF,0) <> 2 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal importeMN = importeMovimiento * tipoCambioActual * Multiplicador - If ObjConta.GetRetCuenta(68, GvInv.HeaderRow.FCDropDownList("ddlAlmacen").SelectedValue.ToString.ToEntero) Then + + If ObjConta.GetRetCuenta(ConceptoContabilizacionAlmacen, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero End If End If - If importeMovimiento <> 0 Then - Dim SeContabiliza As Boolean = True - 'SI ES GASTO DE ALMACEN NO DEBE CONTABILIZAR CONCEPTO 68 - If DdlTipoCompra.SelectedValue = "10" Then - SeContabiliza = False - IdCtaContable = 0 - End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), Contabilizable:=SeContabiliza) Then + If importeMovimiento <> 0 Then + Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionAlmacen, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then ErrorPrepoliza = True End If - End If - Next - End If - End If - 'LIMPIA - importeMovimiento = 0 - IdCtaContable = 0 - - 'INV [MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA) ] - If UsuarioActual.Empresa.UsaInventarios And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen.Contiene(176, 205) Then - importeMovimiento = TmpDT.SUM("Total", $"ISNULL(TipoAF,0) <> 2 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal - importeMN = importeMovimiento * tipoCambioActual * Multiplicador - - If ObjConta.GetRetCuenta(ConceptoContabilizacionAlmacen, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero End If - End If - If importeMovimiento <> 0 Then - Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionAlmacen, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then - ErrorPrepoliza = True - End If - End If + 'NC CON PRODUCTOS - CUENTA PUENTE - End If + If UsuarioActual.Empresa.UsaInventarios And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen.Contiene(225) Then + importeMovimiento = TmpDT.SUM("Total", $"ISNULL(TipoAF,0) <> 2 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal + importeMN = importeMovimiento * tipoCambioActual * Multiplicador - 'NC CON PRODUCTOS - CUENTA PUENTE + If ObjConta.GetRetCuenta(ConceptoContabilizacionAlmacen, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero + End If + End If - If UsuarioActual.Empresa.UsaInventarios And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen.Contiene(225) Then - importeMovimiento = TmpDT.SUM("Total", $"ISNULL(TipoAF,0) <> 2 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal - importeMN = importeMovimiento * tipoCambioActual * Multiplicador - - If ObjConta.GetRetCuenta(ConceptoContabilizacionAlmacen, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero - End If - End If - - If importeMovimiento <> 0 Then - Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionAlmacen, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then - ErrorPrepoliza = True - End If - End If - End If - 'GASTO - DT = TmpDT.Copy - 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN - If DdlTipoCompra.SelectedValue <> "10" Then - For Each Dr As DataRow In DT.Rows - If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then - Dr("CveAlmacen") = 0 - End If - Dr.AcceptChanges() - Next - End If - - DT.AcceptChanges() - DtAlmacenes.Dispose() - - 'QUITA 1-[MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA)] 2-[NC CON PRODUCTOS] - If UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen > 0 Then - DT = DT.FiltraParametros("CveTipoPS <> 2") - End If - - Dim DTDistinct = DT.Copy - If UsuarioActual.Empresa.Funcionalidad(126) = "1" Then - DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"}) - Else - DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"}) - End If - - If DTDistinct.Rows.Count > 0 Then - For Each Row2 As DataRow In DTDistinct.Rows - - 'DETERMINA IMPORTE - If UsuarioActual.Empresa.Funcionalidad(126) = "1" Then - importeMovimiento = DT.SUM("Total", String.Format("ISNULL(TipoAF,0) <> 2 AND CveClasificacion = {0} AND CveSubProyecto = {1} AND ISNULL(CveTipoGasto,0) = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal - Else - importeMovimiento = DT.SUM("Total", String.Format("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveClasificacion = {0} AND CveSubProyecto = {1} AND ISNULL(CveTipoGasto,0) = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal - End If - importeMN = importeMovimiento * tipoCambioActual * Multiplicador - - 'CLASIFICACION - If Row2("CveClasificacion").ToString.ToEntero > 0 Then - If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then - If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero - Else - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero + If importeMovimiento <> 0 Then + Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionAlmacen, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento)) Then + ErrorPrepoliza = True End If End If End If - - 'AGREGA MOVIMIENTO - If importeMovimiento <> 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then - Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then - ErrorPrepoliza = True - End If + 'GASTO + DT = TmpDT.Copy + 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN + If DdlTipoCompra.SelectedValue <> "10" Then + For Each Dr As DataRow In DT.Rows + If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then + Dr("CveAlmacen") = 0 + End If + Dr.AcceptChanges() + Next End If + + DT.AcceptChanges() + DtAlmacenes.Dispose() + + 'QUITA 1-[MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA)] 2-[NC CON PRODUCTOS] + If UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen > 0 Then + DT = DT.FiltraParametros("CveTipoPS <> 2") + End If + + Dim DTDistinct = DT.Copy + If UsuarioActual.Empresa.Funcionalidad(126) = "1" Then + DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"}) + Else + DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"}) + End If + + If DTDistinct.Rows.Count > 0 Then + For Each Row2 As DataRow In DTDistinct.Rows + + 'DETERMINA IMPORTE + If UsuarioActual.Empresa.Funcionalidad(126) = "1" Then + importeMovimiento = DT.SUM("Total", String.Format("ISNULL(TipoAF,0) <> 2 AND CveClasificacion = {0} AND CveSubProyecto = {1} AND ISNULL(CveTipoGasto,0) = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal + Else + importeMovimiento = DT.SUM("Total", String.Format("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveClasificacion = {0} AND CveSubProyecto = {1} AND ISNULL(CveTipoGasto,0) = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal + End If + importeMN = importeMovimiento * tipoCambioActual * Multiplicador + + 'CLASIFICACION + If Row2("CveClasificacion").ToString.ToEntero > 0 Then + If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then + If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero + Else + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero + End If + End If + End If + + 'AGREGA MOVIMIENTO + If importeMovimiento <> 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then + Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then + ErrorPrepoliza = True + End If + End If + Next + End If + + 'LIMPIA + importeMovimiento = 0 + IdCtaContable = 0 Next End If @@ -9452,10 +9477,86 @@ Partial Class Compras_Compras importeMovimiento = 0 IdCtaContable = 0 + ' Case 5 'Proveedores + ' Dim TieneConceptoProveedorAcreedor As Boolean = False + ' Dim CveIE As Integer = -1 + + ' 'If Not ObjConta.GetPrePolizasDetalleCompra(CveCompra, UsuarioActual.CveEmpresa) Then + ' ' ErrorPrepoliza = True + ' 'Else + ' ' If ObjConta.DtResultados.FiltraParametros("CveConceptoContable IN (5,305)").Rows.Count > 0 Then + ' ' TieneConceptoProveedorAcreedor = True + ' ' CveIE = ObjConta.DtResultados.FiltraParametros("CveConceptoContable = 6 OR CveConceptoContable = 68 OR CveConceptoContable = 49 OR CveConceptoContable = 205 OR CveConceptoContable = 176").Rows(0)("CveIE").ToString.ToEntero + ' ' End If + ' 'End If + + ' If TieneConceptoProveedorAcreedor Then + ' If CveTipoConcepto = 2 Then ConceptoContable = 305 'cuando es acreedor + ' Dim UsaComplementaria As Boolean = True + ' If tipoCambioActual <> 1 Then + ' Select Case ConceptoContable + ' Case 5 + ' ConceptoContable = 311 + ' Case 305 + ' ConceptoContable = 306 + ' Case Else + ' End Select + ' End If + + ' Dim importeProv As Decimal = 0 + ' importeProv = TxtTotal.Text.ToDecimal + + ' If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then + + ' importeMovimiento = importeProv + ' importeMN = importeMovimiento * tipoCambioActual * Multiplicador + + ' If tipoCambioActual > 1 Then Referencia += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" + ' Dim CveConceptoContableComplementaria As Integer = 201 + ' If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 307 + + + + ' If tipoCambioActual = 1 Then + ' IdCtaContable = If(CveTipoConcepto = 2, CtaProveedorAcreedores, CtaProveedor) + ' Dim Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" + + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveSubProyecto:=-1, CveProveedor:=CveProveedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveCreditoDetalle:=-1, ImporteMX:=Math.Round(importeMN, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual) Then + ' ErrorPrepoliza = True + ' Exit For + ' End If + + ' Else + ' IdCtaContable = CtaProveedorComplementaria + ' If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementaria) Then 'Cuando tiene complementaria lo dividimos en dos Then + ' importeMN = importeMovimiento + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, CveConceptoContableComplementaria, Referencia, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * tipoCambioActual - importeMovimiento, ImporteME:=importeMovimiento, TipoCambio:=tipoCambioActual) Then + ' ErrorPrepoliza = True + ' End If + ' End If + ' IdCtaContable = CtaProveedorExtranjera + ' End If + ' End If + ' End If + End Select Next End If + If DtPrePolizas IsNot Nothing Then + For Each RowPrePoliza As DataRow In DtPrePolizas.FiltraParametros("", DistinctColumns:={"CvePrePoliza"}).Rows + If ObjConta.ValidacionPrePolizaCuadre(RowPrePoliza("CvePrePoliza").ToString().ToEntero(), 4) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + ErrorPrepoliza = True + Alert("Error en validacion de prepoliza cuadre", TipoMensaje.MsgAdvertencia) + GuardaLogAD($"Compras/Compras-Actualizar | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + Exit For + End If + End If + Next + End If + + 'VALIDAR PREPOLIZA DE COMPRA If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 4) Then If ObjConta.ValorPolizaDescuadre > 0 Then ErrorPrepoliza = True diff --git a/Compras/PopUpFacturasPendientesAutorizar.aspx b/Compras/PopUpFacturasPendientesAutorizar.aspx deleted file mode 100644 index 7f7beadc9..000000000 --- a/Compras/PopUpFacturasPendientesAutorizar.aspx +++ /dev/null @@ -1,145 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpFacturasPendientesAutorizar.aspx.vb" Inherits="Compras_PopUpFacturasPendientesAutorizar" %> - - - - - - - - - Facturas Pendientes de Autorizar - - - - - - - - - <%--border="1" rules="all" style="border-collapse: collapse;"--%> - - <%-- - - --%> - - <%-- - - - --%> - <%-- --%> - -
Filtros para búsqueda
Fecha Inicial: -
- - - - -
- - - - - - -
Fecha Final: -
- - - - -
- - - - - - -
-
-
-
- - -
- - - - - - - -
-
-
Número de registros encontrados:
-
- - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- - - diff --git a/Compras/PopUpFacturasPendientesAutorizar.aspx.vb b/Compras/PopUpFacturasPendientesAutorizar.aspx.vb deleted file mode 100644 index 8b9005029..000000000 --- a/Compras/PopUpFacturasPendientesAutorizar.aspx.vb +++ /dev/null @@ -1,85 +0,0 @@ -Imports Extensiones -Imports System.Data - -Partial Class Compras_PopUpFacturasPendientesAutorizar - Inherits ClsPaginas - - Private Sub Compras_PopUpFacturasPendientesAutorizar_Load(sender As Object, e As EventArgs) Handles Me.Load - - CType(Me.Master, BaseMasterPage).EsPopup = True - CType(Me.Master, BaseMasterPage).PopupWidth = 750 - - - If Not IsPostBack Then - Dim dTime As Date = Now - ' txtFechaF.Text = dTime.ToString("dd/MM/yyyy") - dTime = dTime.AddDays(-30) - ' txtFechaI.Text = dTime.ToString("dd/MM/yyyy") - cargadatos() - End If - - End Sub - - Private Sub cargadatos() - Dim objCompras As New ClsCompras - - Dim dTime As Date = Now - - Dim FechaInc As Date = dTime - dTime = dTime.AddDays(-30) - Dim FechaFin As Date = dTime - objCompras.GetFacturasPendientesDeAutorizar(UsuarioActual.Empresa.CveEmpresa, FechaInc, FechaFin) - - If objCompras.DtResultados.Rows.Count > 0 Then - TblBusqueda.Visible = True - Else - TblBusqueda.Visible = True - End If - - - LtlTotalRegistros.Text = objCompras.DtResultados.Rows.Count.ToString - - GV.DataSource = objCompras.DtResultados - GV.DataBind() - UPDatos.Update() - - End Sub - - 'Protected Sub BtnBuscar_Click(sender As Object, e As EventArgs) Handles BtnBuscar.Click - ' cargadatos() - 'End Sub - - Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound - - - If e.Row.RowType = DataControlRowType.DataRow Then - If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then - - Dim saldo As Double = e.Row.DBCampo("Saldo").Trim.ToDecimal - - 'ostBackUrl ="" - ' e.Row.FCLinkButton("lnkSerieFolio").PostBackUrl = "" & e.Row.DBCampo("CveCompra") - ' e.Row.FCLinkButton("lnkSerieFolio").Text = e.Row.DBCampo("SerieFolio") - - Dim Liga As String = String.Empty - - Liga = String.Format("", e.Row.DBCampo("CveCompra")) - - e.Row.FCLabel("lblSerieFolio").Text = String.Format("", Liga, e.Row.DBCampo("SerieFolio")) - - - e.Row.FCLabel("LblSaldo").Font.Bold = True - e.Row.FCLabel("LblSaldo").Text = "$" & saldo.ToString("###,###,###.00") & " " & e.Row.DBCampo("Abreviatura").ToString & " " - - e.Row.FCLabel("lblFecha").Text = Date.Parse(e.Row.DBCampo("Fecha").ToString).ToString("dd/MM/yyyy") - e.Row.FCLabel("lblFechav").Text = Date.Parse(e.Row.DBCampo("Fechav").ToString).ToString("dd/MM/yyyy") - - - - - End If - End If - - - End Sub -End Class diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index dad1c926d..caa121514 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -2556,7 +2556,7 @@ Partial Class PopUpVerFactura ObjFactura.RefDocto = "" ObjFactura.Folio = Folio ObjFactura.Serie = "Tra" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx index a5675bbfe..dad72b1e8 100644 --- a/Compras/Proveedores.aspx +++ b/Compras/Proveedores.aspx @@ -264,7 +264,7 @@
- + diff --git a/Compras/RepCartaPorteTraslados.aspx b/Compras/RepCartaPorteTraslados.aspx deleted file mode 100644 index ee9712803..000000000 --- a/Compras/RepCartaPorteTraslados.aspx +++ /dev/null @@ -1,142 +0,0 @@ -<%@ Page Title="Rep. Carta Porte Traslados" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepCartaPorteTraslados.aspx.vb" Inherits="Compras_RepCartaPorteTraslados" %> - - - - - - - - Rep. Carta Porte Traslados - - - - - - - - - - - -
  • - Excel -
  • -
    - - - -
    -
    -
    -
    - - - - - - - -
    -
    -
    - - "> - -
    -
    -
    -
    Proveedor:
    -
    - -
    -
    Fecha Inicio:
    -
    -
    - - - - - - - - -
    -
    -
    Fecha Fin:
    -
    -
    - - - - - - - - -
    -
    - - SubProyecto: -
    - - -
    - -
    -
    -
    -
    > -
    - -
    - - - - - -
    - - -
    - - -
    -
    -
    -
    -
    -
    - - - - - - - - -
    CompraTraslado
    - - - - - - - - - - -
    -
    - - -
    - - - diff --git a/Compras/RepCartaPorteTraslados.aspx.vb b/Compras/RepCartaPorteTraslados.aspx.vb deleted file mode 100644 index 6c883a8eb..000000000 --- a/Compras/RepCartaPorteTraslados.aspx.vb +++ /dev/null @@ -1,117 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports Extensiones -Imports Microsoft.Reporting.WebForms - -Partial Class Compras_RepCartaPorteTraslados - Inherits ClsPaginas - - 'Private Property DTComplemntos As DataTable - ' Get - ' If ViewState("DTComplemntos") Is Nothing Then - ' Return New DataTable - ' Else - ' Return DirectCast(ViewState("DTComplemntos"), DataTable) - ' End If - ' End Get - ' Set(value As DataTable) - ' ViewState("DTComplemntos") = value - ' End Set - 'End Property - - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - - InicializaValores() - - End If - End Sub - -#Region " INICIALIZA VALORES " - Private Sub InicializaValores() - - TxtFiltrosFechaInicio.Text = Now.FirstDayOfMonth.ToShortDateString - TxtFiltrosFechaFin.Text = Now.ToShortDateString - - DdlProveedores.setEsWebService(True) - DdlProveedores.Attributes.Add("data-metodo", "getproveedores") - - 'DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - 'DdlProveedores.DataBind() - 'DdlProveedores.Items.Insert(0, New ListItem("Todos", "-1")) - - 'DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) - 'DdlSubProyecto.DataBind() - 'DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) - - CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto:=LblSubProyecto) - - DdlUsuarioRegistra.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa) - DdlUsuarioRegistra.DataBind() - DdlUsuarioRegistra.Items.Insert(0, New ListItem("Todos", "-1")) - - UpFiltros.Update() - End Sub -#End Region - - -#Region " CARGA DATOS " - Protected Sub BtnConsultarFiltros_Click(sender As Object, e As EventArgs) - CargaDatos() - End Sub - Private Sub CargaDatos() - - LnkExcel.Visible = False - - Dim CveProveedor As Integer = If(DdlProveedores.SelectedValue.ToEntero = 0, -1, DdlProveedores.SelectedValue.ToEntero) - Dim CveTipoProveedor = DdlTipoProveedor.SelectedValue.ToEntero - Dim FechaInicio = If(IsDate(TxtFiltrosFechaInicio.Text), TxtFiltrosFechaInicio.Text.ToDate, MinFecha) - Dim FechaFin = If(IsDate(TxtFiltrosFechaFin.Text), TxtFiltrosFechaFin.Text.ToDate, MaxFecha) - Dim Count As Integer = 0 - - Dim ObjCompras As New ClsCompras - If ObjCompras.GetComplementoTrasladoRep(UsuarioActual.CveEmpresa, CveProveedor, CveTipoProveedor, FechaInicio, FechaFin, UsuarioActual.CveUsuario, DdlUsuarioRegistra.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero) Then - GvDatos.DataSource = ObjCompras.DtResultados - - If ObjCompras.DtResultados.Rows.Count > 0 Then - LnkExcel.Visible = True - End If - Else - GvDatos.DataSource = Nothing - End If - - ObjCompras.Dispose() - - GvDatos.DataBind() - - UpAcciones.Update() - UpDatos.Update() - - - End Sub - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - End If - End Sub -#End Region - - - - -#Region "IMPRESION" - - Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) - GeneraImpresion("Excel") - End Sub - - Private Sub GeneraImpresion(Optional Formato As String = "PDF") - - GvDatos.ExportToExcel2("RepCartaPorteTraslados.xlsx") - - End Sub -#End Region -End Class diff --git a/Compras/RepPromociones.aspx b/Compras/RepPromociones.aspx deleted file mode 100644 index 4485f0c48..000000000 --- a/Compras/RepPromociones.aspx +++ /dev/null @@ -1,115 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPromociones.aspx.vb" Inherits="Compras_RepPromociones" %> - - - - - - - - Reporte de Promociones - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -
    Proveedor:
    -
    - - - -
    -
    Tipo:
    -
    - - - - - -
    - <%--
    Tipo Gasto:
    -
    - - - -
    --%> -
    Fecha Inicio:
    -
    -
    - - - - - - - - -
    -
    -
    Fecha Fin:
    -
    -
    - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - -
    -
    - - - - - -
    FacturaOC
    - - - - - - - - - - - -
    -
    -
    -
    - - -
    - - - diff --git a/Compras/RepPromociones.aspx.vb b/Compras/RepPromociones.aspx.vb deleted file mode 100644 index 6de223eaf..000000000 --- a/Compras/RepPromociones.aspx.vb +++ /dev/null @@ -1,51 +0,0 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Partial Class Compras_RepPromociones - Inherits ClsPaginas - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - - InicializaValores() - - End If - End Sub - - Private Sub InicializaValores() - - TxtFiltrosFechaInicio.Text = $"01/01/{Now.Year}" - TxtFiltrosFechaFin.Text = $"{Now.Day}/{Now.Month}/{Now.Year}" - - DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedor.DataBind() - - 'DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) - 'DdlTipoGasto.DataBind() - - UpFiltros.Update() - End Sub - - - - Protected Sub BtnConsultarFiltros_Click(sender As Object, e As EventArgs) Handles BtnConsultarFiltros.Click - CargaDatos() - End Sub - Private Sub CargaDatos() - Dim CveProveedor = DdlProveedor.SelectedValue.ToEntero - Dim CveTipoGasto = -1 'DdlTipoGasto.SelectedValue.ToEntero - Dim Tipo = DdlTipo.SelectedValue.ToEntero - Dim FechaI = TxtFiltrosFechaInicio.Text.ToDate - Dim FechaF = TxtFiltrosFechaFin.Text.ToDate - - Dim ObjCompras As New ClsCompras - If ObjCompras.GetRepPromociones(CveProveedor, CveTipoGasto, FechaI, FechaF, Tipo, UsuarioActual.CveEmpresa) Then - GvDatos.DataSource = ObjCompras.DtResultados - End If - ObjCompras.Dispose() - GvDatos.DataBind() - UpDatos.Update() - - End Sub -End Class diff --git a/Contratos/FacturacionMasiva.aspx.vb b/Contratos/FacturacionMasiva.aspx.vb index 4057e0c9d..4859f370b 100644 --- a/Contratos/FacturacionMasiva.aspx.vb +++ b/Contratos/FacturacionMasiva.aspx.vb @@ -432,7 +432,7 @@ Partial Class Contratos_FacturacionMasiva ObjFactura.RefDocto = "" ObjFactura.Folio = -1 ObjFactura.Serie = "-1" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = If(DR("FechaVenc").ToString.ToDate > Now, Now, DR("FechaVenc").ToString.ToDate) ObjFactura.CvePrePoliza = -1 diff --git a/Global.asax b/Global.asax index 50d62c751..10ae25b9a 100644 --- a/Global.asax +++ b/Global.asax @@ -278,7 +278,7 @@ 'V E N T A S Using ObjVentas As New ClsVentas - If ObjVentas.GetMesas Then Application("GlobalDTMesas") = ObjVentas.DtResultados Else Application("GlobalDTMesas") = Nothing + 'If ObjVentas.GetMesas Then Application("GlobalDTMesas") = ObjVentas.DtResultados Else Application("GlobalDTMesas") = Nothing If ObjVentas.GetPrecioListas Then Application("GlobalDTPrecioListas") = ObjVentas.DtResultados Else Application("GlobalDTPrecioListas") = Nothing If ObjVentas.GetCondicionesEntrega(-1) Then Application("GlobalDTVtaCondicionesEntrega") = ObjVentas.DtResultados Else Application("GlobalDTVtaCondicionesEntrega") = Nothing If ObjVentas.GetFormaPago() Then Application("GlobalDTVtaFormaPago") = ObjVentas.DtResultados Else Application("GlobalDTVtaFormaPago") = Nothing diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 296498ec3..52ee88524 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -5317,7 +5317,7 @@ Partial Class Inventarios_EntradasSalidas ObjFactura.RefDocto = "" ObjFactura.Folio = Folio.ToEntero ObjFactura.Serie = "Tra" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 70d75f8be..b1be09e13 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -3869,7 +3869,10 @@ Partial Class Inventarios_RecepcionAlmacen If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() If ObjContaContPAQ IsNot Nothing Then ObjContaContPAQ.RollBack() RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

    {MensajeError}", TipoMensaje.MsgError) + + If Not String.IsNullOrEmpty(MensajeError) Then + Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

    {MensajeError}", TipoMensaje.MsgError) + End If End If ObjInventario.Dispose() diff --git a/Inventarios/RecepcionDevolucion.aspx.vb b/Inventarios/RecepcionDevolucion.aspx.vb index 6a937ce9a..b1b536de3 100644 --- a/Inventarios/RecepcionDevolucion.aspx.vb +++ b/Inventarios/RecepcionDevolucion.aspx.vb @@ -331,7 +331,7 @@ Partial Class Inventarios_RecepcionDevolucion Me.ObjRemisionNC.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", Me.ObjRemisionNC.CveMoneda)) Me.ObjRemisionNC.TipoDocto = "RNC" Me.ObjRemisionNC.RefDocto = "" - Me.ObjRemisionNC.CveMesa = -1 + 'Me.ObjRemisionNC.CveMesa = -1 Me.ObjRemisionNC.Fecha = Now Me.ObjRemisionNC.CvePrePoliza = -1 Me.ObjRemisionNC.FechaPago = Now diff --git a/Inventarios/Remanufactura.aspx.vb b/Inventarios/Remanufactura.aspx.vb index b3182ba03..cba83d23a 100644 --- a/Inventarios/Remanufactura.aspx.vb +++ b/Inventarios/Remanufactura.aspx.vb @@ -424,7 +424,7 @@ Partial Class Inventarios_Remanufactura ObjFactura.RefDocto = "" ObjFactura.Folio = Folio.ToEntero ObjFactura.Serie = Serie - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = TxtFecha.Text.ToDate ObjFactura.CvePrePoliza = -1 ObjFactura.CveMetodoPago = 1 @@ -668,7 +668,7 @@ Partial Class Inventarios_Remanufactura factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, factura.Alfa1, factura.Alfa2, factura.Alfa3, factura.Num1, factura.Num2, factura.Num3, - factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, + factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, AtencionA:=factura.AtencionA, TelefonoGenerico:="", CveContrato:=factura.CveContrato, CveVentaPadre:=factura.CveVentaPadre, Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, Entrega:="", Vigencia:=MinFecha, CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, CveDireccionEnvio:=-1, CveOC:=-1, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=-1, diff --git a/PortalCliente/PortalCliente.aspx b/PortalCliente/PortalCliente.aspx index 076c11c0d..93b2dd9c4 100644 --- a/PortalCliente/PortalCliente.aspx +++ b/PortalCliente/PortalCliente.aspx @@ -1432,7 +1432,7 @@
    - + Pedido @@ -2071,6 +2071,13 @@ catch (e) { alert(e); } } + function CerrarModalVenta() { + try { + $('#DivVenta').modal('hide'); + } + catch (e) { alert(e); } + } + //VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C function ValidarCantidad(t, c) { t.value = (ToDouble(t.value) > ToDouble(c) ? c : t.value) diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index aa2950fd4..ae77813c1 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -9,6 +9,7 @@ Imports System.IO.Compression Imports System.Net Imports Microsoft.Reporting.WebForms Imports System.Net.Http +Imports Newtonsoft.Json.Linq Partial Class Ventas_PortalCliente Inherits ClsPaginas @@ -24,6 +25,15 @@ Partial Class Ventas_PortalCliente Set(value As Integer) ViewState("CveCliente") = value End Set + End Property + + Private Property CvePrecioLista As Integer + Get + Return IfNull(ViewState("CvePrecioLista"), "-1", ViewState("CvePrecioLista")).ToString().ToEntero() + End Get + Set(value As Integer) + ViewState("CvePrecioLista") = value + End Set End Property Private Property Destino As String @@ -223,8 +233,13 @@ Partial Class Ventas_PortalCliente CargarTipoBuzon() CargarClienteSucursal() End If - - CargaPedidos() + If UsuarioActual.CveEmpresa = 143 Then + TabPedidos.Visible = True + CargaPedidos(TipoDocto:="Rem") + Else + CargaPedidos() + End If + CargaCuentasDepositos() '??ESTE TAB VA DESAPARECER - PARA QUE SOLO LA EMPRESA GESTIONE A LOS USUARIOS POR CLIENTE?? @@ -260,6 +275,7 @@ Partial Class Ventas_PortalCliente If ObjClientes.DtResultados.Rows.Count > 0 Then 'Campos para Modificación LtlCliente.Text = ObjClientes.Nombre + CvePrecioLista = ObjClientes.CvePrecioLista Else Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) End If @@ -1736,11 +1752,11 @@ Partial Class Ventas_PortalCliente UpIxC.Update() End Sub - Private Sub CargaPedidos(Optional TopPedidos As Integer = 21) + Private Sub CargaPedidos(Optional TopPedidos As Integer = 21, Optional TipoDocto As String = "Pd2") Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim.ToDate, MinFecha) Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim.ToDate, MaxFecha) Dim ObjClientes As New ClsClientes - If ObjClientes.GetHistorialVentas(CveCliente, UsuarioActual.CveEmpresa, TopPedidos, CveClienteSucursal:=-1, TipoDocto:="Pd2", CveEstatusFactura:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then + If ObjClientes.GetHistorialVentas(CveCliente, UsuarioActual.CveEmpresa, TopPedidos, CveClienteSucursal:=-1, TipoDocto:=TipoDocto, CveEstatusFactura:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then GvPedidos.DataSource = ObjClientes.DtResultados If ObjClientes.DtResultados.Rows.Count < 21 Then LnkVerMasPedidos.Visible = False @@ -1753,15 +1769,24 @@ Partial Class Ventas_PortalCliente End Sub Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - CargaPedidos() + Dim TipoDocto As String = "Pd2" + If UsuarioActual.CveEmpresa = 143 Then + TipoDocto = "Rem" + End If + CargaPedidos(TipoDocto:=TipoDocto) End Sub Protected Sub BtnVerMasPedidos_Click(sender As Object, e As EventArgs) + Dim TipoDocto As String = "Pd2" + If UsuarioActual.CveEmpresa = 143 Then + TipoDocto = "Rem" + End If + If BtnVerMasVentas.Text = "Ver Más" Then - CargaPedidos(-1) + CargaPedidos(-1, TipoDocto:=TipoDocto) BtnVerMasVentas.Text = "Ver Menos" Else - CargaPedidos(21) + CargaPedidos(21, TipoDocto:=TipoDocto) BtnVerMasVentas.Text = "Ver Más" End If End Sub @@ -2532,7 +2557,7 @@ Partial Class Ventas_PortalCliente #Region "CARGAS" - Private Sub CargaFolios() + Private Sub CargaFolios(Optional TipoDocto As String = "Pd2") If CveSubProyecto <= 0 Then Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError) @@ -2540,8 +2565,8 @@ Partial Class Ventas_PortalCliente End If Dim ObjFolios As New ClsGralFolios() - If ObjFolios.GetFolios("Pd2", UsuarioActual.CveEmpresa) Then - Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0} And Estado = 'Activo'", CveSubProyecto)) + If ObjFolios.GetFolios(TipoDocto, UsuarioActual.CveEmpresa) Then + Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0} And Estado = 'Activo'", CveSubProyecto)) If DT.Rows.Count > 0 Then ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString.ToEntero ViewState("FolioActual") = DT.Rows(0)("FActual").ToString @@ -2593,8 +2618,13 @@ Partial Class Ventas_PortalCliente TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();") - CargaFolios() - + If UsuarioActual.CveEmpresa = 143 Then + CargaFolios("Rem") + Else + CargaFolios() + End If + + Dim Dt = New DataSet Dt.Tables.Add("Datos") Dt.Tables("Datos").Columns.Add("") @@ -2751,6 +2781,7 @@ Partial Class Ventas_PortalCliente End Sub Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs) + TxtPrecio.Text = "" DdlPSIndexChange() End Sub @@ -2769,25 +2800,45 @@ Partial Class Ventas_PortalCliente DdlUM.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUM.SelectedValue = "-1" DdlUM.DataBind() - DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString) - - TxtPrecio.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "") - - If UsuarioActual.CveEmpresa = 80 Then - 'busca el precio de la sucursal - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSucursales(DdlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveSubProyecto) Then - Dim dtt As DataTable = ObjPS.DtResultados - Dim drPrecio As DataRow = dtt.FiltroPrimero("") - - If drPrecio IsNot Nothing Then - TxtPrecio.Text = drPrecio("Importe").ToString.ToDouble.ToString("N4") - End If - dtt.Dispose() - End If - - ObjPS.Dispose() - End If + DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString) + + If UsuarioActual.CveEmpresa = 143 Then + If CvePrecioLista > 0 Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=DdlPS.SelectedValue.ToEntero()) Then + If ObjPS.DtResultados.Rows.Count > 0 Then + TxtPrecio.Text = ObjPS.DtResultados.Rows(0)("PrecioLista").ToString().ToDecimal().FormatoNumero() + Else + TxtPrecio.Text = "" + End If + Else + TxtPrecio.Text = "" + End If + ObjPS.Dispose() + End If + Else + If UsuarioActual.CveEmpresa = 80 Then + 'busca el precio de la sucursal + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSucursales(DdlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveSubProyecto) Then + Dim dtt As DataTable = ObjPS.DtResultados + Dim drPrecio As DataRow = dtt.FiltroPrimero("") + + If drPrecio IsNot Nothing Then + TxtPrecio.Text = drPrecio("Importe").ToString.ToDouble.ToString("N4") + End If + dtt.Dispose() + End If + + ObjPS.Dispose() + Else + TxtPrecio.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "") + End If + End If + + If TxtPrecio.Text.ToDecimal() <= 0 Then + Alert("No se encontro un precio para el producto seleccionado", TipoMensaje.MsgAdvertencia) + End If If DdlClasificacion.SelectedIndex = 0 Then If drPS("CveClasificacion").ToString IsNot Nothing Then @@ -2804,6 +2855,7 @@ Partial Class Ventas_PortalCliente Else Alert("Es necesario seleccionar el cliente al cual se le va a facturar.", TipoMensaje.MsgAdvertencia, "AbrirVentana(""/Ventas/PopUpBuscarClientes.aspx?Opt=Fact"", 800, 547, ""N"", ""PopUpBuscar"")") End If + RegistraScript("Recalcula();") UpVenta.Update() @@ -2819,6 +2871,21 @@ Partial Class Ventas_PortalCliente #Region "AGREGAR/EDITAR/ELIMINAR" Protected Sub LnkAddPedido_Click(sender As Object, e As EventArgs) + If TmpDT IsNot Nothing Then + TmpDT.Rows.Clear() + TxtObsFact.Text = "" + + GvPS.DataSource = TmpDT + GvPS.DataBind() + + CalculaTotalesVenta() + End If + + If UsuarioActual.CveEmpresa = 143 Then + DdlMoneda.SelectedValueExist(1) + DdlMoneda.Enabled = False + End If + RegistraScript("$('#DivVenta').modal({backdrop: 'static',keyboard: false});") End Sub Protected Sub LnkAddPSVenta_Click(sender As Object, e As EventArgs) @@ -2836,7 +2903,13 @@ Partial Class Ventas_PortalCliente End If DdlClasificacion.SelectedIndex = -1 DdlUM.Items.Clear() - ChkAgregar.Checked = True + ChkAgregar.Checked = True + + If UsuarioActual.CveEmpresa = 143 Then + TxtPrecio.Enabled = False + End If + + UpVenta.Update() UpAddPedido.Update() RegistraScript("$('#DivAddVenta').modal({backdrop: 'static',keyboard: false});") @@ -2850,7 +2923,7 @@ Partial Class Ventas_PortalCliente CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS) UpClasificacion.Update() If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then - DdlPS.SelectedValue = GvRow.DataKey("CvePS") + DdlPS.ddl.SelectedValueExist(GvRow.DataKey("CvePS")) Else DdlPS.SelectedValue = GvRow.DataKey("CvePS") DdlPS.SelectedText = GvRow.DataKey("PS") @@ -2905,7 +2978,21 @@ Partial Class Ventas_PortalCliente UpAddPedido.Update() End Sub - Private Sub AgregarPS() + Private Sub AgregarPS() + If TxtPrecio.Text.ToDecimal() <= 0 Then + Alert("El precio del producto debe ser mayor a cero", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If UsuarioActual.CveEmpresa = 143 Then + For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows + If DdlClasificacion.SelectedValue.ToEntero <> Row("CveClasificacion").ToString().ToEntero() Then + Alert($"El pedido actual solo es para la clasificación '{Row("Clasificacion")}'. Debe seleccionar productos de la misma clasificación", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Next + End If + If Modalidad = "U" Then Dim ErrorEdit As Boolean = True @@ -3092,7 +3179,7 @@ Partial Class Ventas_PortalCliente ObjFactura.RefDocto = "" ObjFactura.Folio = Folio.ToEntero ObjFactura.Serie = Serie - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now @@ -3181,7 +3268,7 @@ Partial Class Ventas_PortalCliente Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT - Timbre.Comprobante.Subtotal = Obj.SubTotal + Timbre.Comprobante.SubTotal = Obj.SubTotal Timbre.Comprobante.Descuentos = Obj.Descuento Timbre.Comprobante.Moneda = Obj.MonedaSAT Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) @@ -3284,11 +3371,139 @@ Partial Class Ventas_PortalCliente i += 1 Next Return Timbre - End Function - - - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - + End Function + + + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + + If UsuarioActual.CveEmpresa = 143 Then + GuardarWS() + Else + Guardar() + End If + + End Sub + + Private Function SubProyectosClasificaciones() As Hashtable + Dim retorno As New Hashtable() + + 'CVECLASIFICACION/CVESUBPROYECTO + retorno.Add(20331, 11713) + retorno.Add(20332, 11761) + retorno.Add(20333, 11714) + + Return retorno + End Function + + Private Sub GuardarWS() + + Dim DtClasificaciones As DataTable = TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}) + + If DtClasificaciones IsNot Nothing AndAlso DtClasificaciones.Rows.Count > 1 Then + Alert("El pedido debe tener productos de una misma clasificación", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveSubProyectoPedido As Integer = -1 + + Dim CveClasificacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion").ToEntero() + + Dim SubProyectos = SubProyectosClasificaciones() + + 'VERIFICA SI LA CLASIFICACION PERTENECE AL SUBPROYECTO + If SubProyectos.ContainsKey(CveClasificacion) Then + CveSubProyectoPedido = SubProyectos(CveClasificacion).ToString().ToEntero() + Else + CveSubProyectoPedido = Me.CveSubProyecto + End If + + Dim productos As New JArray() + For Each Row As DataRow In TmpDT.Rows + productos.Add(New JObject( + New JProperty("CvePS", Row("CvePS").ToString().ToEntero()), + New JProperty("Cantidad", Row("Cantidad").ToString().ToDecimal()), + New JProperty("Obs", Row("Obs").ToString()), + New JProperty("Precio", Row("PU").ToString().ToDecimal()), + New JProperty("Descuento", Row("Descuento").ToString().ToDecimal()) + ) + ) + Next + + Dim URLAPI As String = "https://sig.adssistemas.mx/asmx/WSApp.asmx?WSDL" + + If Not EsProduccion Then + URLAPI = "http://localhost:85/asmx/WSApp.asmx?WSDL" + End If + + Dim jsonResp = EnviarPedidoWS(URLAPI, CveCliente, CveSubProyectoPedido, UsuarioActual.CveUsuario, TxtObsFact.Text, productos.ToString()) + + If Not String.IsNullOrEmpty(jsonResp) Then + Dim resp As JObject = JObject.Parse(jsonResp) + Dim TieneError As Boolean = CBool(resp("TieneError")) + If Not TieneError Then + Alert($"La remisión '{resp("SerieFolio")}' se genero correctamente.", JSBtnAceptar:="CerrarModalVenta();", ShowCloseButton:=False) + CargaPedidos(TipoDocto:="Rem") + Else + Alert($"Ocurrió un error al generar el pedido.", TipoMensaje.MsgError) + End If + End If + + End Sub + + Private Function EnviarPedidoWS(ByVal url As String, CveCliente As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Observaciones As String, Productos As String) As String + Dim retorno = "" + + Try + Dim request As HttpWebRequest = CType(WebRequest.Create($"{url}"), HttpWebRequest) + request.ContentType = "text/xml;charset=""utf-8""" + request.Accept = "text/xml" + request.Method = "POST" + Dim XMLString As String = $" + + + {CveCliente} + {CveSubProyecto} + {CveUsuario} + {Observaciones} + {Productos} + + + " + Dim SOAPReqBody As XmlDocument = New XmlDocument() + SOAPReqBody.LoadXml(XMLString) + + Using stream As Stream = request.GetRequestStream() + SOAPReqBody.Save(stream) + End Using + + Dim response As String = "" + + Using Serviceres As WebResponse = request.GetResponse() + Using rd As StreamReader = New StreamReader(Serviceres.GetResponseStream()) + response = rd.ReadToEnd() + End Using + End Using + + If Not String.IsNullOrEmpty(response) Then + Dim xmlRetorno = New XmlDocument() + xmlRetorno.LoadXml(response) + retorno = xmlRetorno.InnerText + Else + Alert($"Ocurrió un error al leer la respuesta.", TipoMensaje.MsgError) + retorno = "" + End If + + Catch ex As Exception + retorno = "" + OnError("Ocurrió un error al guardar el pedido", ex) + End Try + + Return retorno + End Function + + + Private Sub Guardar() If TmpDT Is Nothing OrElse TmpDT.Rows.Count = 0 Then Alert("Es necesario tener al menos un concepto registrado.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -3423,9 +3638,9 @@ Partial Class Ventas_PortalCliente End If - End If - - End Sub + End If + End Sub + Private Sub EnviarCorreoPedido(ObjFactura As Modelos.Factura) Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura)) Hilo.Start() @@ -3444,7 +3659,7 @@ Partial Class Ventas_PortalCliente factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, factura.Alfa1, factura.Alfa2, factura.Alfa3, factura.Num1, factura.Num2, factura.Num3, - factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, + factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, AtencionA:=factura.AtencionA, CveContrato:=factura.CveContrato, Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveSubProyecto:=factura.CveSubProyecto, CveSubProyectoCobranza:=factura.CveSubProyectoCobranza, CveSubProyectoEjecucion:=factura.CveSubProyectoEjecucion, CveFormaPago33:=factura.CveFormaPago33, diff --git a/Sistemas/CatEmpresas.aspx.vb b/Sistemas/CatEmpresas.aspx.vb index bc0e48e9e..f06c696d9 100644 --- a/Sistemas/CatEmpresas.aspx.vb +++ b/Sistemas/CatEmpresas.aspx.vb @@ -119,9 +119,13 @@ Partial Class Sistemas_CatEmpresas Private Sub CargaGrid(Orden As String) + + + Dim CveUsaurioConsulta As Integer = If(UsuarioActual.CveRol = 1, -1, UsuarioActual.CveUsuario) + Using ObjEmpresas As New ClsSisEmpresas() - If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1", UsuarioActual.CveUsuario) Then + If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1", CveUsaurioConsulta) Then GvDatos.DataSource = ObjEmpresas.DtResultados Else GvDatos.DataSource = Nothing diff --git a/Ventas/CatClientes.aspx b/Ventas/CatClientes.aspx index bd1869aa2..fb29a26ab 100644 --- a/Ventas/CatClientes.aspx +++ b/Ventas/CatClientes.aspx @@ -178,7 +178,9 @@
    - + @@ -348,6 +350,14 @@ + + F Limite Crédito + + + + + + @@ -374,8 +384,6 @@ - - @@ -386,8 +394,6 @@ - - @@ -398,8 +404,7 @@ - - + @@ -410,8 +415,7 @@ - - + @@ -422,8 +426,7 @@ - - + @@ -434,33 +437,33 @@ - - + - - <%----%> - - + + - - + + + + + + + - -
    diff --git a/Ventas/CatClientes.aspx.vb b/Ventas/CatClientes.aspx.vb index 51f83bd8f..4dfd6a1d8 100644 --- a/Ventas/CatClientes.aspx.vb +++ b/Ventas/CatClientes.aspx.vb @@ -44,32 +44,37 @@ Partial Class CatClientes End If End Sub - Public Sub CargaDatos(Optional Nombre As String = "-1", Optional RFC As String = "-1") + Public Sub CargaDatos() Dim ObjClientes As New ClsClientes + Dim Nombre, RFC As String + Nombre = "-1" + RFC = "-1" - If ObjClientes.GetClientes(-1, Nombre, "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PermiteCreditoFiltro:=If(ChkPermiteCredito.Checked, 1, -1)) Then + If TxtNombre.Text.Trim <> String.Empty Then Nombre = TxtNombre.Text.Trim - DTDatos = ObjClientes.DtResultados - ObjClientes.Dispose() + If TxtRFC.Text.Trim <> String.Empty Then RFC = TxtRFC.Text.Trim - 'ViewState("DTCliente") = DTDatos - If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 Then - DTDatos = DTDatos.FiltraParametros("CveCliente IN (10450, 10460, 10458)") - ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 Then - DTDatos = DTDatos.FiltraParametros("CveCliente IN (27448)") + If ObjClientes.GetClientes(-1, Nombre, "-1", "-1", RFC, "-1", "-1", DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Estatus:=DdlEstatus.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClasificaciones.SelectedValue.ToEntero, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PermiteCreditoFiltro:=If(ChkPermiteCredito.Checked, 1, -1)) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + DTDatos = ObjClientes.DtResultados + Else + DTDatos = Nothing + Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If - Else - Me.GvDatos.DataSource = Nothing End If + ObjClientes.Dispose() + If ViewState("Orden").ToString() <> String.Empty Then CargaGrid(ViewState("Orden").ToString()) Else CargaGrid("") End If + UPDatos.Update() + End Sub @@ -113,34 +118,7 @@ Partial Class CatClientes Protected Sub LbFiltrar_Click(sender As Object, e As EventArgs) Handles LbFiltrar.Click - Dim ObjClientes As New ClsClientes - Dim Nombre, RFC As String - Nombre = "-1" - RFC = "-1" - - If TxtNombre.Text.Trim <> String.Empty Then Nombre = TxtNombre.Text.Trim - - If TxtRFC.Text.Trim <> String.Empty Then RFC = TxtRFC.Text.Trim - - If ObjClientes.GetClientes(-1, Nombre, "-1", "-1", RFC, "-1", "-1", DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Estatus:=DdlEstatus.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClasificaciones.SelectedValue.ToEntero, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PermiteCreditoFiltro:=If(ChkPermiteCredito.Checked, 1, -1)) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - DTDatos = ObjClientes.DtResultados - Else - DTDatos = Nothing - Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) - End If - End If - - - ObjClientes.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - - UPDatos.Update() + CargaDatos() End Sub @@ -179,6 +157,10 @@ Partial Class CatClientes GvDatos.Columns(25).Visible = ChkCelular.Checked GvDatos.Columns(26).Visible = ChkCorreoCotizacion.Checked GvDatos.Columns(27).Visible = ChkOtroTelefono.Checked + GvDatos.Columns(28).Visible = chkFechaLimiteCredito.Checked + + + CargaDatos() @@ -256,6 +238,13 @@ Partial Class CatClientes e.Row.FCLiteral("LtlSucursal").Text = "" & e.Row.FCLiteral("LtlSucursal").Text & "" e.Row.FCLiteral("LtlTelefono").Text = "" & e.Row.FCLiteral("LtlTelefono").Text & "" + If e.Row.DataKey("FechaLimiteCredito").ToString.ToDate = MinFecha Then + e.Row.FCLiteral("LtlFechaLimiteCredito").Text = "" + Else + e.Row.FCLiteral("LtlFechaLimiteCredito").Text = e.Row.DataKey("FechaLimiteCredito").ToString.ToDate.ToString("dd/MM/yyyy") + End If + + End If End Sub #End Region @@ -317,39 +306,6 @@ Partial Class CatClientes - 'Protected Sub BtnCorporativo_Click(sender As Object, e As EventArgs) - - ' Dim ObjClientes As New ClsClientes - - ' If ObjClientes.AddCorporativo(-1, Nombre, "-1", "-1", RFC, "-1", "-1", DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Estatus:=DdlEstatus.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClasificaciones.SelectedValue.ToEntero, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero) Then - ' If ObjClientes.DtResultados.Rows.Count > 0 Then - ' DTDatos = ObjClientes.DtResultados - ' Else - ' DTDatos = Nothing - ' Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) - ' End If - ' End If - - - ' ObjClientes.Dispose() - - ' If ViewState("Orden").ToString() <> String.Empty Then - ' CargaGrid(ViewState("Orden").ToString()) - ' Else - ' CargaGrid("") - ' End If - - ' UPDatos.Update() - - 'End Sub - - 'Private Sub CargaCorporativo() - - ' DdlCorporativo.DataSource = GlobalDTCorporativo(UsuarioActual.CveEmpresa) - ' DdlCorporativo.DataBind() - ' DdlCorporativo.Items.Insert(0, New ListItem("Selecione", "-1")) - - 'End Sub diff --git a/Ventas/CatMesas.aspx b/Ventas/CatMesas.aspx deleted file mode 100644 index 0946e9ee4..000000000 --- a/Ventas/CatMesas.aspx +++ /dev/null @@ -1,148 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMesas.aspx.vb" Inherits="Ventas_CatMesas" %> - - - - - - - - - Catálogo de Mesas - - - - - -
    -
    -
    - Catalogo -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - Sucursal - - - - - Mesa - - - - - Estatus - - - - - Fecha - - - - - Usuario - - - Comandos
    - - - - - - - -     -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -   -
    -
    - - - -
    - - - - - -
    - - -
    -
    -
    -
    -
    -
    - - diff --git a/Ventas/CatMesas.aspx.vb b/Ventas/CatMesas.aspx.vb deleted file mode 100644 index e60baeaff..000000000 --- a/Ventas/CatMesas.aspx.vb +++ /dev/null @@ -1,213 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Linq -Imports Extensiones - -Partial Class Ventas_CatMesas - Inherits ClsPaginas - - Public Property PuedeEditar As Boolean - Get - Return CBool(ViewState("PuedeEditar")) - End Get - Set(value As Boolean) - ViewState("PuedeEditar") = value - End Set - End Property - - Public Property PuedeEliminar As Boolean - Get - Return CBool(ViewState("PuedeEditar")) - End Get - Set(value As Boolean) - ViewState("PuedeEditar") = value - End Set - End Property - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - ViewState("Orden") = "" - CargaSucursales() - CargaDatos() - - ''Permiso Registro - 'If PermisoRegistro Then - ' LbAgregar.Enabled = True - 'Else - ' LbAgregar.Enabled = False - 'End If - End If - End Sub - - Public Sub CargaSucursales() - ddlSucursal.DataSource = GlobalDTSubProyectos(UsuarioActual.CveEmpresa) - ddlSucursal.DataBind() - ddlSucursal.Items.Insert(0, New ListItem("Todas", "-1")) - End Sub - - Public Sub CargaDatos() - Dim ObjMesas As New ClsVentas - If ObjMesas.GetMesas() Then - ViewState("DTMesas") = ObjMesas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTMesas = ObjMesas.DtResultados - Else - Me.GvDatos.DataSource = Nothing - End If - - ObjMesas.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub ddlSucursal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlSucursal.SelectedIndexChanged - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - Dim ObjMesas As New ClsVentas - If ObjMesas.AddMesa(TxtMesa.Text.Trim, UsuarioActual.CveUsuario, ddlSucursal.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - TxtMesa.Text = "" - Alert("La nueva Mesa se guardó correctamente.", TipoMensaje.MsgInformacion) - UpTitulos.Update() - ViewState("DTMesas") = ObjMesas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTMesas = ObjMesas.DtResultados - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End If - ObjMesas.Dispose() - End Sub - -#Region "G V D A T O S" - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(150) - e.Row.Cells(1).Width = Unit.Pixel(250) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(100) - e.Row.Cells(5).Width = Unit.Pixel(100) - e.Row.Cells(6).Width = Unit.Pixel(61) - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("ddlSucursal").DataSource = GlobalDTSubProyectos(UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("ddlSucursal").DataBind() - e.Row.FCDropDownList("ddlSucursal").SelectedValue = e.Row.DBCampo("CveSucursal") - End If - End If - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjMesas As New ClsVentas - If ObjMesas.RemoveMesa(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvDatos.EditIndex = -1 - ViewState("DTMesas") = ObjMesas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTMesas = ObjMesas.DtResultados - Alert("La Mesa se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - - ObjMesas.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit - GvDatos.EditIndex = -1 - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating - Dim ObjMesas As New ClsVentas - Dim CveSucursal As Integer = GvDatos.Rows(e.RowIndex).FCDropDownList("ddlSucursal").SelectedValue.ToEntero - Dim Mesa As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtMesa"), TextBox).Text.Trim - Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked - Dim CveMesa As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero - - If ObjMesas.UpdateMesa(Mesa, Estatus, CveSucursal, CveMesa) Then - GvDatos.EditIndex = -1 - ViewState("DTMesas") = ObjMesas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTMesas = ObjMesas.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - End If - - ObjMesas.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing - GvDatos.EditIndex = e.NewEditIndex - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub -#End Region - -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) - - If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden) - End Sub - - Private Sub CargaGrid(Orden As String) - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTMesas"), DataTable), "", Orden, DataViewRowState.CurrentRows) - GvDatos.DataSource = DV.ToTable().FiltraParametros(String.Format("CveSucursal = {0} OR {0} = -1", ddlSucursal.SelectedValue)) - DV.Dispose() - Else - GvDatos.DataSource = CType(ViewState("DTMesas"), DataTable).FiltraParametros(String.Format("CveSucursal = {0} OR {0} = -1", ddlSucursal.SelectedValue)) - End If - GvDatos.DataBind() - UpDatos.Update() - End Sub -#End Region - -End Class diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 1726f0ca5..3f02fa021 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -2032,11 +2032,10 @@ - + -   - +   @@ -4502,7 +4501,7 @@ @@ -4513,7 +4512,7 @@ - + diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index f2ffa6650..1b8edf730 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1960,6 +1960,10 @@ Partial Class Clientes DtCxCActivas = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "Moneda, OrdenVencimiento, FechaVencimiento") GvCxC.DataSource = DtCxCActivas 'solo tomo los 10 ultimos mas el totalizador general + + + GvCxC.Columns(6).Visible = If(DtCxCActivas.FiltroPrimeroValor("LineaAdicional", "LEN(TRIM(LineaAdicional)) > 0", "LineaAdicional DESC").Trim.Length > 0, True, False) + Dim dt As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'") DtHistorialCxC = dt If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then @@ -2988,8 +2992,8 @@ Partial Class Clientes End If e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index c01610754..f1aa365e7 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -1890,7 +1890,7 @@ Partial Class Ventas_ClientesAbonar ObjFacturaDevolucion.FechaPago = Now ObjFacturaDevolucion.CveCorte = -1 - ObjFacturaDevolucion.CveMesa = -1 + 'ObjFacturaDevolucion.CveMesa = -1 ObjFacturaDevolucion.NumeroPersonas = 0 ObjFacturaDevolucion.CveContrato = -1 ObjFacturaDevolucion.DescripcionContrato = "" diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index c9c50c886..054a47a1d 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -3707,7 +3707,7 @@ Partial Class PV ObjFactura.FechaPago = TxtFechaPago.Text.ToDate ObjFactura.CveCorte = CveCorte - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.NumeroPersonas = 0 ObjFactura.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero diff --git a/Ventas/RepLineasAdicionales.aspx b/Ventas/RepLineasAdicionales.aspx index bfe5ef7aa..3b0946c5a 100644 --- a/Ventas/RepLineasAdicionales.aspx +++ b/Ventas/RepLineasAdicionales.aspx @@ -50,13 +50,21 @@
    Estatus:
    -
    +
    - + <%-- --%> +
    +
    Agrupador:
    +
    + + + + +
    @@ -72,63 +80,102 @@ -
    +
    -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    + + -
    -
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    - - +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    - +
    + + + AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> - - - + + + + + + + + + + + + + + + + + - <%----%> - + + - - - + + + - + -
    - - - - - - -
    -
    - +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    - - -
    -
    + +
    +
    + + + + + +
    diff --git a/Ventas/RepLineasAdicionales.aspx.cs b/Ventas/RepLineasAdicionales.aspx.cs index 7340a5449..f7ebb7858 100644 --- a/Ventas/RepLineasAdicionales.aspx.cs +++ b/Ventas/RepLineasAdicionales.aspx.cs @@ -70,10 +70,19 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas if (Request["OP"] != null && Request["OP"].ToString() == "PO") { DVProveedor1.Visible = true; - DVProveedor2.Visible = true; - GvLineasAdicionales.Columns[10].Visible = true; + DVProveedor2.Visible = true; TipoLinea = 2; LtlEncabezado.Text = "Reporte PO"; + GvLineasAdicionalesPO.Visible = true; + DvLineaPO.Visible = true; + DVAgrupador1.Visible = true; + DVAgrupador2.Visible = true; + + } + else + { + DvLinea.Visible = true; + GvLineasAdicionales.Visible = true; } //Carga Clientes @@ -97,8 +106,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas DdlClientes.SelectedText = "Todos"; DdlClientes.SelectedValue = "-1"; - //txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString(); - //txtFechaF.Text = DateTime.Now.AddMonths(3).ToString("dd/MM/yyyy"); + } @@ -117,24 +125,61 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1; - if(objVentas.GetLineasAdicionales(-1,DdlClientes.SelectedValue.ToEntero(),CveProveedor, TipoLinea, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)){ - GvLineasAdicionales.DataSource = objVentas.DtResultados; - - if( objVentas.DtResultados.Rows.Count > 0) + if(TipoLinea == 1) + { + if (objVentas.RepLineasAdicionales(-1,-1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 1, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)) { - DTDatosGvLineasAdicionales = objVentas.DtResultados; - LnkDescargaExcel.Visible = true; - UpAcciones.Update(); + GvLineasAdicionales.DataSource = objVentas.DtResultados; + + if (objVentas.DtResultados.Rows.Count > 0) + { + DTDatosGvLineasAdicionales = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); + } + } + else + { + GvLineasAdicionales.DataSource = null; } } else { - GvLineasAdicionales.DataSource = null; + + if (DdlAgrupador.SelectedValue.ToEntero()== 1){ + GvLineasAdicionalesPO.Columns[0].HeaderText = "Comercializador"; + } + else + { + GvLineasAdicionalesPO.Columns[0].HeaderText = "Cliente"; + } + + if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)) + { + GvLineasAdicionalesPO.DataSource = objVentas.DtResultados; + + if (objVentas.DtResultados.Rows.Count > 0) + { + DTDatosGvLineasAdicionales = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); + } + } + else + { + GvLineasAdicionalesPO.DataSource = null; + } + } + + + objVentas.Dispose(); GvLineasAdicionales.DataBind(); + GvLineasAdicionalesPO.DataBind(); + UpLineasAdicionales.Update(); } @@ -276,36 +321,60 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas protected void LnkDescargaExcel_Click(object sender, EventArgs e) { - GridView gvTemp = GvLineasAdicionales; - gvTemp.Columns[8].Visible = false; - gvTemp.ExportToExcelx( TipoLinea == 1 ? "RepLienasAdicionales":"RepPO"); + + if(TipoLinea == 1) + { + GridView gvTemp = GvLineasAdicionales; + gvTemp.ExportToExcelx("RepLienasAdicionales"); + } + else if(TipoLinea == 2) + { + GridView gvTemp = GvLineasAdicionalesPO; + gvTemp.Columns[9].Visible = false; + gvTemp.ExportToExcelx( "RepPO"); + } + + } - protected void GvLineasAdicionales_RowDataBound(object sender, GridViewRowEventArgs e) + + + protected void GvLineasAdicionalesPO_RowDataBound(object sender, GridViewRowEventArgs e) { - if(e.Row.RowType == DataControlRowType.DataRow) + if (e.Row.RowType == DataControlRowType.DataRow) { - if(e.Row.DataKey("CveVenta").ToEntero() > 0) + + LinkButton LnkCambiarEstatus = e.Row.FCLinkButton("LnkCambiarEstatus"); + LinkButton LnkCargarComprobante = e.Row.FCLinkButton("LnkCargarComprobante"); + LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante"); + + + if (e.Row.DataKey("CveLineaAdicional").ToEntero() == 0) { - e.Row.FCLinkButton("LnkCambiarEstatus").Visible = true; + e.Row.CssClass = "SubTotales"; + LnkCambiarEstatus.Visible = false; + LnkCargarComprobante.Visible = false; + LnkDescargaComprobante.Visible = false; } - - if (e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 2) + else { - e.Row.FCLinkButton("LnkCargarComprobante").Visible = false; - } - - if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0 ) - { - FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}"); - LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante"); - - if (fi.Exists) + if (e.Row.DataKey("CveVenta").ToEntero() > 0 && e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 1) { - LnkDescargaComprobante.Visible = true; - ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaComprobante); - } - } + LnkCambiarEstatus.Visible = true; + LnkCargarComprobante.Visible = true; + } + + if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0) + { + FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}"); + + if (fi.Exists) + { + LnkDescargaComprobante.Visible = true; + ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaComprobante); + } + } + } } } @@ -327,30 +396,28 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas } } - protected void GvLineasAdicionales_RowCommand(object sender, GridViewCommandEventArgs e) + protected void GvLineasAdicionalesPO_RowCommand(object sender, GridViewCommandEventArgs e) { - - GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; - int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); - int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); - - bool errorCambioEstatus = false; - int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus - - ClsVentas objVentas = new ClsVentas(); - - if (!objVentas.UpdateLineasAdicionales(CveLineaAdicionalActualzarEstatus, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, CveVenta: CveVenta, CveLineaAdicionalEstatus: cveestatus)) + if (e.CommandName == "Estatus") { - errorCambioEstatus = true; + GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; + int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); + int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); + + bool errorCambioEstatus = false; + //int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus + + ClsVentas objVentas = new ClsVentas(); + + if (!objVentas.UpdateLineasAdicionales(CveLineaAdicionalActualzarEstatus, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, CveVenta: CveVenta, CveLineaAdicionalEstatus: 2)) + { + errorCambioEstatus = true; + } + objVentas.Dispose(); + if (!errorCambioEstatus) + { + CargaDatos(); + } } - - - objVentas.Dispose(); - if (!errorCambioEstatus) - { - CargaDatos(); - } - - } } \ No newline at end of file diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index ae3516748..2ba4401d1 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5773,7 +5773,7 @@ Partial Class Ventas ObjVentas = New ClsVentas() End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) @@ -5915,7 +5915,7 @@ Partial Class Ventas 'cuando es refacturacion, la fecha de pago debe de ser la misma If UsuarioActual.Empresa.Funcionalidad(526) = "1" Then ' Dim ObjVenta As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TxtFechaPago.Text = ObjVentas.DtResultados(0)("FechaVencimiento").ToString().ToDate.ToShortDateString End If @@ -6784,7 +6784,7 @@ Partial Class Ventas Row("CveVenta") = DdlFacturaARelacionar.SelectedValue.ToEntero() Using ObjVentas As New ClsVentas - If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Row("SerieFolio") = ObjVentas.DtResultados(0)("SerieFolio").ToString() Row("FolioFiscal") = ObjVentas.DtResultados(0)("FolioFiscal").ToString() End If @@ -7547,7 +7547,7 @@ Partial Class Ventas If DdlNCFactura.Items.Count = 0 Then Dim ObjClientes As New ClsVentas() - If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then + If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then DTFacNC = ObjClientes.DtResultados Dim drvv As DataRow = DTFacNC.FiltroPrimero("") DTFacNC.Columns.Add("Factura", GetType(String), " Folio + ' - ' +' $' + Total + ' - ' + Fecha ") @@ -10229,7 +10229,7 @@ Partial Class Ventas ObjFacturaDevolucion.FechaPago = TxtFechaPago.Text.ToDate ObjFacturaDevolucion.CveCorte = CveCorte - ObjFacturaDevolucion.CveMesa = -1 + 'ObjFacturaDevolucion.CveMesa = -1 ObjFacturaDevolucion.NumeroPersonas = 0 ObjFacturaDevolucion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFacturaDevolucion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "") @@ -10519,7 +10519,7 @@ Partial Class Ventas ObjFacturaBonificacion.FechaPago = TxtFechaPago.Text.ToDate ObjFacturaBonificacion.CveCorte = CveCorte - ObjFacturaBonificacion.CveMesa = -1 + 'ObjFacturaBonificacion.CveMesa = -1 ObjFacturaBonificacion.NumeroPersonas = 0 ObjFacturaBonificacion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFacturaBonificacion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "") @@ -11011,7 +11011,7 @@ Partial Class Ventas ObjFactura.EsDiasCreditoFijo = EsDiasCreditoFijo ObjFactura.CveCorte = CveCorte - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.NumeroPersonas = 0 @@ -11717,7 +11717,7 @@ Partial Class Ventas ObjFacturaDevolucion.FechaPago = TxtFechaPago.Text.ToDate ObjFacturaDevolucion.CveCorte = CveCorte - ObjFacturaDevolucion.CveMesa = -1 + 'ObjFacturaDevolucion.CveMesa = -1 ObjFacturaDevolucion.NumeroPersonas = 0 ObjFacturaDevolucion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFacturaDevolucion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "") @@ -12669,7 +12669,7 @@ Partial Class Ventas factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, factura.Alfa1, factura.Alfa2, factura.Alfa3, factura.Num1, factura.Num2, factura.Num3, - factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, + factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, AtencionA:=factura.AtencionA, TelefonoGenerico:=TxtTelefonoGenerico.Text.Trim, CveContrato:=factura.CveContrato, CveVentaPadre:=If(AplicaDevolucion, CveVentaDevolucion, factura.CveVentaPadre), Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, Entrega:=TxtEntrega.Text, Vigencia:=If(DdlTipoComprobante.SelectedValue = "Cot", TxtFechaVencimientoCotizacion.Text.ToDate, MinFecha), CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero(), -1), CveOC:=CveOC, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=DdlFormaEntrega.SelectedValue.ToEntero(), @@ -22609,7 +22609,7 @@ Partial Class Ventas Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1) If CveVentaPadre > 0 Then Dim ObjVentas As New ClsVentas() - If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 AndAlso ObjVentas.DtResultados.Rows(0)("TipoDocto").ToString() = "Ing" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then ' Dim CveEstatusRefacturacion As Integer = ObjVentas.DtResultados.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero() @@ -22751,7 +22751,7 @@ Partial Class Ventas End Sub Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs) Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero() @@ -24716,7 +24716,7 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas() Dim ObjInventarios As New ClsInventarios - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) @@ -26145,7 +26145,7 @@ Partial Class Ventas ViewState("CveVenta") = IfNull(Request("CveVenta"), 0).ToString.ToEntero Dim Obj As New ClsVentas - If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then Dim DbRowVenta As DataRow = Obj.DtResultados.FiltroPrimero("") ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString() Total = DbRowVenta("Total").ToString.ToDecimal @@ -28178,7 +28178,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) Next End If @@ -28249,7 +28249,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) Next End If @@ -28381,7 +28381,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28474,7 +28474,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA, 0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28566,7 +28566,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If Next @@ -28660,7 +28660,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If Next @@ -28748,7 +28748,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA, 0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28835,7 +28835,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28871,7 +28871,7 @@ Partial Class Ventas Dim FechaFactura As DateTime = Now If AplicaNCMasiva OrElse AplicaNCUsado Then - If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString().ToDecimal @@ -28977,7 +28977,8 @@ Partial Class Ventas PorcentajeRetISR As Decimal, ImporteRetISR As Decimal, PorcentajeIEPS As Decimal, ImporteIEPS As Decimal, TipoDescuento As Integer, Descuento As Decimal, Total As Decimal, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String, SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer, - CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1) + CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1, + Optional CodigoObjetoImpuesto As String = "") Dim Row As DataRow = Nothing Row = TmpDT.NewRow() @@ -29039,6 +29040,8 @@ Partial Class Ventas Row("CveTamaño") = CveTamaño Row("CveVentaDetalleRNC") = CveVentaDetalleRNC + Row("CodigoObjetoImpuesto") = CodigoObjetoImpuesto + TmpDT.Rows.Add(Row) End Sub @@ -29155,7 +29158,7 @@ Partial Class Ventas Else ObjVentasAplicar = New ClsVentas End If - If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then + If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then Folio = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("SerieFolio").ToString() FolioFiscal = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("FolioFiscal").ToString() TC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambio").ToString().ToDecimal() @@ -29723,7 +29726,7 @@ Partial Class Ventas Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() @@ -29774,7 +29777,7 @@ Partial Class Ventas Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() @@ -32040,7 +32043,7 @@ Partial Class Ventas If TipoDoctoViejo = "PA" Then Dim RowVenta As DataRow = Nothing Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then RowVenta = ObjVentas.DtResultados.Rows(0) End If ObjVentas.Dispose() @@ -32075,7 +32078,7 @@ Partial Class Ventas Dim ErrorTrans As Boolean = False Dim FechaVencimientoAnterior As String = "" - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then FechaVencimientoAnterior = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDate.ToShortDateString Else @@ -33794,7 +33797,7 @@ Partial Class Ventas ObjFacturaProntoPago.FechaPago = Now ObjFacturaProntoPago.CveCorte = -1 - ObjFacturaProntoPago.CveMesa = -1 + 'ObjFacturaProntoPago.CveMesa = -1 ObjFacturaProntoPago.NumeroPersonas = 0 ObjFacturaProntoPago.CveContrato = -1 ObjFacturaProntoPago.DescripcionContrato = "" @@ -33981,7 +33984,7 @@ Partial Class Ventas TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) End If - If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Total = ObjVentas.DtResultados()(0)("Total").ToString.ToDecimal SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString.ToDecimal @@ -35334,16 +35337,26 @@ Partial Class Ventas Using ObjVentas As New ClsVentas If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") - Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal() - Me.CveCategoriaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveCategoria").ToString().ToEntero() - Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero() + Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) + If RowLinea IsNot Nothing Then + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + + 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL + If RowLinea("TipoLinea").ToString() = "2" Then + TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") + End If + + Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() + Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() + End If + End If End If End Using Else Me.SaldoLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 + TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") End If UpParametros.Update() diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 83e2f5311..1bdfcc8c2 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -1070,7 +1070,7 @@ Public Class WSApp ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1") ObjFactura.TipoDocto = "Rem" ObjFactura.RefDocto = "" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/asmx/WSSIGApp.asmx b/asmx/WSSIGApp.asmx index 4f0113534..dc6ef1427 100644 --- a/asmx/WSSIGApp.asmx +++ b/asmx/WSSIGApp.asmx @@ -1893,7 +1893,7 @@ Public Class WSSIGApp ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1") ObjFactura.TipoDocto = TipoDocto ObjFactura.RefDocto = "" - ObjFactura.CveMesa = -1 + 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = Now ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = Now diff --git a/asmx/WS_PuntoVenta.asmx b/asmx/WS_PuntoVenta.asmx index b79d8fac0..88a61b18a 100644 --- a/asmx/WS_PuntoVenta.asmx +++ b/asmx/WS_PuntoVenta.asmx @@ -1 +1,1743 @@ -<%@ WebService Language="VB" CodeBehind="~/App_Code/WS_PuntoVenta.vb" Class="WS_PuntoVenta" %> +<%@ WebService Language="VB" Class="WS_PuntoVenta" %> +Imports System.Data +Imports System.Web.Services +Imports Extensiones + +' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. +' _ + + + +Public Class WS_PuntoVenta + Inherits System.Web.Services.WebService + + Partial Public Class RespuestaWS + Public Property Respuesta As Integer + Public Property Descripcion As String + Public Property HuboError As Boolean = True + Public Property Datos As New DataTable("Resultados") + Public Property Datos2 As New DataTable("Resultados") + End Class + + Partial Public Class Envio + Public Property Empresa As Empresa + Public Property Correo As String + Public Property Correos As String() + Public Property Asunto As String + Public Property Contenido As String + End Class + + Partial Public Class ClsProductosServiciosWS + Public Property CvePS As Integer + Public Property CveClasificacion As Integer + Public Property CveUnidadMedida As Integer + Public Property Codigo As String + Public Property PS As String + Public Property Precio As Double + Public Property Oferta As Double + Public Property IVA As Double + Public Property RetIVA As Double + Public Property MargenGanancia As Double + Public Property IdCtaContVentas As Integer + Public Property IdCtaContCompras As Integer + Public Property IdCtaContInventarios As Integer + Public Property AsientoContableVentas As Integer + Public Property AsientoContableCompras As Integer + Public Property AplicaParaConcepto As Boolean + Public Property Estado As Boolean + Public Property Fecha As Date + Public Property Usuario As String + Public Property CveEmpresa As Integer + End Class + + Partial Public Class ClsClasificacionesWS + Public Property CveClasificacion As Integer + Public Property Clasificacion As Integer + Public Property CveEmpresa As Integer + End Class + + Partial Public Class ClsMovimientosCajaWS + Public Property CveMovimiento As Integer + Public Property CveCorte As Integer + Public Property Importe As Double + Public Property Descripcion As String + Public Property TipoMovimiento As String + + Public Sub New() + + End Sub + + Public Sub New(CveMovimiento As Integer, CveCorte As Integer, Importe As Double, Descripcion As String, TipoMovimiento As String) + Me.CveMovimiento = CveMovimiento + Me.CveCorte = CveCorte + Me.Importe = Importe + Me.Descripcion = Descripcion + Me.TipoMovimiento = TipoMovimiento + End Sub + End Class + + Partial Public Class ClsMetodosPagoWS + Public Property CveMetodoPago As Integer + Public Property MetodoPago As String + Public Property Importe As Double + + Public Sub New() + + End Sub + + Public Sub New(CveMetodoPago As Integer, MetodoPago As String) + Me.CveMetodoPago = CveMetodoPago + Me.MetodoPago = MetodoPago + End Sub + End Class + + Partial Public Class ClsVta_BitacoraWS + Public Property CveBitacora As Integer + Public Property CveVenta As Integer + Public Property Fecha As DateTime + Public Property Observacion As String + Public Property CveUsuario As Integer + + Public Sub New() + + End Sub + + Public Sub New(CveBitacora As Integer, CveVenta As Integer, Fecha As DateTime, Observacion As String, CveUsuario As Integer) + Me.CveVenta = CveVenta + Me.Fecha = Fecha + Me.Observacion = Observacion + Me.CveUsuario = CveUsuario + End Sub + End Class + + Partial Public Class ClsVtaCortesWS + Public Property CveCorte As Integer + Public Property FechaInicial As DateTime + Public Property FechaFinal As DateTime + Public Property ImporteInicial As Double + Public Property ImporteFinal As Double + Public Property Diferencia As Double + Public Property Descripcion As String + Public Property Estatus As String + Public Property Usuario As String + Public Property UsuarioNombre As String + Public Property Vendido As Double + Public Property VendidoEfectivo As Double + Public Property Retirado As Double + Public Property Ingresado As Double + Public Property CveEmpresa As Integer + Public Property CortesDetalles As List(Of ClsVtaCortesDetallesWS) + + Partial Public Class ClsVtaCortesDetallesWS + Public Property CveCorte As Integer + Public Property CveMetodoPago As Integer + Public Property Importe As Double + + Public Sub New() + + End Sub + + Public Sub New(CveCorte As Integer, CveMetodoPago As Integer, Importe As Double) + Me.CveCorte = CveCorte + Me.CveMetodoPago = CveMetodoPago + Me.Importe = Importe + End Sub + End Class + + Public Sub New() + + End Sub + + Public Sub New(CveCorte As Integer, FechaInicial As DateTime, FechaFinal As DateTime, ImporteInicial As Double, ImporteFinal As Double, Descripcion As String, Estatus As String, Usuario As String, UsuarioNombre As String, Vendido As Double, VendidoEfectivo As Double, Retirado As Double, Ingresado As Double) + Me.CveCorte = CveCorte + Me.FechaInicial = FechaInicial + Me.FechaFinal = FechaFinal + Me.ImporteInicial = ImporteInicial + Me.ImporteFinal = ImporteFinal + Me.Descripcion = Descripcion + Me.Estatus = Estatus + Me.Usuario = Usuario + Me.UsuarioNombre = UsuarioNombre + Me.Vendido = Vendido + Me.VendidoEfectivo = VendidoEfectivo + Me.Retirado = Retirado + Me.Ingresado = Ingresado + End Sub + End Class + + Partial Public Class ClsVtaVentasPagoWS + Public Property CveCorte As Integer + Public Property MetodoPago As String + Public Property Importe As Double + + Public Sub New() + + End Sub + + Public Sub New(CveCorte As Integer, MetodoPago As String, Importe As Double) + Me.CveCorte = CveCorte + Me.MetodoPago = MetodoPago + Me.Importe = Importe + End Sub + End Class + + Partial Public Class UsuarioWS + Public Property CveUsuario As Integer + Public Property Usuario As String + Public Property Contraseña As String + Public Property Nombre As String + Public Property CveRol As Integer + Public Property Rol As String + Public Property NombreEmpresa As String + Public Property CveEmpresa As Integer + Public Property Liga As String + Public Property Portal As Boolean = False + 'Public Property Modulos As HybridDictionary + 'Public Property Procesos As HybridDictionary + Public Property SeleccionoEmpresa As Boolean + Public Property CveSucursal As Integer + Public Property CveProveedor As Integer + Public Property CveCliente As Integer + Public Property CveSupervisor As Integer + Public Property CveCoordinador As Integer + Public Property CveProspecto As Integer + Public Property CveVendedor As Integer + Public Property EsRestaurant As Boolean + Public Property Referencia As String + Public Property EsSupervisorRH As Boolean + Public Property Empresa As Empresa = Nothing + Public Property ModoSimulacion As Boolean = False + Public Property NombreAbreviatura As String + End Class + + ' Public Class Empresa + + ' Public CveEmpresa As Integer + ' Public Empresa As String + ' Public Direccion As String + ' Public NoExt As String + ' Public NoInt As String + ' Public Colonia As String + ' Public Ciudad As String + ' Public Estado As String + ' Public CP As Integer + ' Public RFC As String + ' Public RegistroPatronal As String + ' Public Telefono As String + ' Public Contacto As String + ' Public Mail As String + ' Public TipoFacturacion As String + ' Public ContraseñaKey As String + ' Public ArchivoKey As String + ' Public ArchivoCer As String + ' Public ArchivoPfx As String + ' Public BIUsuario As String + ' Public BIContraseña As String + ' Public Banner As String + ' Public FacturaProduccion As Boolean + ' Public FechaIng As Date + ' Public CveUsuario As Integer + ' Public SendMail As String + ' Public SendMailPassword As String + ' Public SendMailServer As String + ' Public SendMailPuerto As Integer + ' Public SendMailSSL As Boolean + ' Public Usuario As String + ' Public MostrarRetIVA As Boolean + ' Public EjercicioActual As Integer + ' Public PeriodoActual As Integer + ' Public GralSoloProyecto As Boolean + ' Public MetodoOC As Integer + ' Public RequiereCentroCostos As Boolean + ' Public Tipo_CentroCosto As Integer + ' Public Property MostrarRetISR As Boolean + ' Public Property Regimen As String + ' Public Property EstatusFacturacion As Boolean + ' Public Property Estatus As Boolean + ' Public Property UsaContabilidad As Boolean + ' Public Property UsaBancos As Boolean + ' Public Property UsaVentas As Boolean + ' Public Property UsaCompras As Boolean + ' Public Property UsaCxC As Boolean + ' Public Property UsaInventarios As Boolean + ' Public Property UsaRH As Boolean + ' Public Property UsaNomina As Boolean + ' Public Property UsaOS As Boolean + ' Public Property UsaAC As Boolean + ' Public Property BDContPAQi As String + ' Public Property ServerContPAQi As String + ' Public Property UsrContPAQi As String + ' Public Property PwdContPAQi As String + ' Public Property Buzon_Mail As String + ' Public Property Buzon_Server As String + ' Public Property Buzon_Puerto As Integer + ' Public Property Buzon_SSL As Boolean + ' Public Property Buzon_USR As String + ' Public Property Buzon_PWD As String + ' Public Property Timbres As Integer + ' Public Property Ruta As String + ' Public Property IdCuentaIVAxTrasladar As Integer + ' Public Property IdCuentaIVATrasladado As Integer + ' Public Property IdCuentaPerdidaCambiaria As Integer + ' Public Property IdCuentaGananciaCambiaria As Integer + ' Public Property ContaContabilizacionNC As Integer + ' Public Property PV_TerminalTipo As Integer + + ' 'Public Property Funcionalidades As HybridDictionary + + ' ' Public Function ValorFuncionalidad(CveFuncionalidad As Integer) As string + ' ' Return if(Funcionalidades IsNot Nothing AndAlso Funcionalidades.Item(CveFuncionalidad) IsNot Nothing, Funcionalidades.Item(CveFuncionalidad).ToString,"") + ' 'End Function + + 'End Class + + + Partial Public Class ClsVentaWS + Public CveVenta As Integer + Public CveVentaTerminal As Integer + Public TipoDocto As String + Public FolioFact As Integer + Public CveCliente As Integer + Public CveClienteSucursal As Integer + Public SubTotal As Double + Public Descuento As Double + Public Amortizacion As Double + Public IVA As Double + Public RetIVA As Double + Public RetISR As Double + Public Total As Double + Public CveMoneda As Integer + Public TipoCambio As Double + Public CveMetodoPago As Integer + Public CondicionesPago As Integer + Public FormaPago As Integer + Public FechaPago As DateTime + Public Fecha As DateTime + Public MotivoDescuento As String + Public Observaciones As String + Public FechaEjecucion As DateTime + Public CveVendedor As Integer + Public CveSucursalEjecucion As Integer + Public Alfa1 As String + Public Alfa2 As String + Public Alfa3 As String + Public Num1 As Double + Public Num2 As Double + Public Num3 As Double + Public Fech1 As String + Public Fech2 As String + Public Fech3 As String + Public CveUsuario As Integer + Public CveCorte As Integer + 'Public CveMesa As Integer + Public NumeroPersonas As Integer + Public CveSubProyecto As Integer + Public CveEmpresa As Integer + Public Propina As Double + + Public Detalle As List(Of ClsVentaDetalleWS) + Public MetodoPago As List(Of ClsMetodosPagoWS) + Public Bitacora As List(Of ClsVta_BitacoraWS) + + Public Class ClsVentaDetalleWS + Public CveVenta As Integer + Public CvePS As Integer + Public Cantidad As Double + Public CveUnidadMedida As Integer + Public PU As Double + Public IVA As Double + Public TotalIVA As Double + Public Total As Double + Public Observaciones As String + Public Oferta As Double + Public PrecioFinal As Double + Public Descuento As Double + Public TipoDescuento As Integer + Public CveSubProyecto As Integer + Public EsPaquete As Boolean + + Public PS As String + Public Codigo As String + + Public Caracteristicas As List(Of ClsVentaDetalleCaracteristicaWS) + End Class + + Public Class ClsVentaDetalleCaracteristicaWS + Public CveVentaDetalle As Integer + Public CvePS As Integer + Public CveOpcion As Integer + End Class + End Class + + Partial Public Class ClsPrePolizaWS + Public CvePrepoliza As Integer + Public CvePrepolizaTerminal As Integer + Public Modulo As String + Public CveTipoPoliza As Integer + Public Cargos As Double + Public Abonos As Double + Public CveMoneda As Integer + Public Fecha As Date + Public NumeroPoliza As String + Public FechaConta As DateTime + Public IdPoliza As Integer + Public Estatus As Boolean + Public FechaIng As DateTime + Public CveUsuario As Integer + Public CveEmpresa As Integer + + Public Detalle As List(Of ClsPrePolizaDetalleWS) + + Public Class ClsPrePolizaDetalleWS + Public CvePrePolizaDetalle As Integer + Public CvePrePoliza As Integer + Public TipoMovto As Boolean + Public Importe As Double + Public Referencia As String + Public CveConceptoContable As Integer + Public Concepto As String + Public FechaVencimiento As DateTime + Public IdCtaContable As Integer + Public IdSegmentoNegocio As Integer + Public CveIE As Integer + Public CveVenta As Integer + Public CveCompra As Integer + Public CveSubProyecto As Integer + Public CveCliente As Integer + Public CveProveedor As Integer + Public CvePersonal As Integer + Public CveMovimientoAlmacen As Integer + Public CveActivoFijo As Integer + End Class + End Class +#Region "Empresas, Sucursales, Clientes, Monedas, UnidadesMedida, Vta_Promociones, Vta_PromocionesDetalle" + + Public Function GetEmpresa(CveEmpresa As Integer) As RespuestaWS + Dim objEmpresa As New ClsSisEmpresas + Dim Respuesta As New RespuestaWS + + If objEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then + Respuesta.Datos = objEmpresa.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objEmpresa.Dispose() + Return Respuesta + End Function + + + Public Function GetSubProyectos(CveEmpresa As Integer) As RespuestaWS + Dim objProyecto As New ClsSubProyectos + Dim Respuesta As New RespuestaWS + + If objProyecto.GetSubProyectos(CveEmpresa) Then + Respuesta.Datos = objProyecto.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objProyecto.Dispose() + Return Respuesta + End Function + + + Public Function GetClientes(CveEmpresa As Integer) As RespuestaWS + Dim objClientes As New ClsClientes + Dim Respuesta As New RespuestaWS + + If objClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then + Respuesta.Datos = objClientes.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objClientes.Dispose() + Return Respuesta + End Function + + Public Function GetGral_Folios(CveEmpresa As Integer) As RespuestaWS + Dim objFolios As New ClsGralFolios + Dim Respuesta As New RespuestaWS + + If objFolios.GetFolios() Then + Respuesta.Datos = objFolios.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objFolios.Dispose() + Return Respuesta + End Function + 'Candiddato a borrar + 'COMENTADO IPP: CAMBIO LA FORMA DE USAR LAS PROMOCIONES | 2 NOVIEMBRE 2016 + ' + 'Public Function GetVta_PromocionesDetalle(CvePS As Integer, Fecha As String, CveSucursal As Integer, CveEmpresa As Integer) As RespuestaWS + ' Dim objPromocionesDetalle As New ClsVentas + ' Dim Respuesta As New RespuestaWS + + ' If objPromocionesDetalle.GetPromocionesDetalle(-1, CvePS, Fecha, CveSucursal, CveEmpresa) Then + ' Respuesta.Datos = objPromocionesDetalle.DtResultados + ' Respuesta.Datos.TableName = "Resultados" + ' Respuesta.HuboError = False + ' Else + ' Respuesta.Descripcion = "HUBO UN ERROR" + ' End If + + ' objPromocionesDetalle.Dispose() + ' Return Respuesta + 'End Function + + + Public Function GetVta_Promociones(Fecha As String, CveSubProyecto As Integer, CveEmpresa As Integer) As RespuestaWS + Dim objPromociones As New ClsVentas + Dim Respuesta As New RespuestaWS + + If objPromociones.GetPromociones(-1, Fecha, -1, -1, 1, CveEmpresa, CveSubProyecto) Then + Respuesta.Datos = objPromociones.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPromociones.Dispose() + Return Respuesta + End Function + + + Public Function GetUnidadesMedida(CveEmpresa As Integer) As RespuestaWS + Dim objUnidadesMedida As New ClsUnidadesMedida + Dim Respuesta As New RespuestaWS + + If objUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then + Respuesta.Datos = objUnidadesMedida.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objUnidadesMedida.Dispose() + Return Respuesta + End Function + + + Public Function GetMonedas(CveEmpresa As Integer) As RespuestaWS + Dim objMonedas As New ClsMonedas + Dim Respuesta As New RespuestaWS + + If objMonedas.GetMonedas() Then + Respuesta.Datos = objMonedas.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objMonedas.Dispose() + Return Respuesta + End Function +#End Region + +#Region "ProductosServicios" + + Public Function GetProductosServicios(CvePS As Integer, CveClasificacion As Integer, Codigo As String, PS As String, CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS + Dim objPS As New ClsProductosServicios + Dim Respuesta As New RespuestaWS + + If objPS.GetPS(CvePS, CveClasificacion, CveEmpresa, Codigo, PS, CveSubProyecto:=CveSubProyecto, pAplicaParaVenta:=1, pEstado:=1) Then + Respuesta.Datos = objPS.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPS.Dispose() + Return Respuesta + End Function + + + Public Function GetClasificaciones(CveEmpresa As Integer) As RespuestaWS + Dim objClasificaciones As New ClsClasificaciones + Dim Respuesta As New RespuestaWS + + If objClasificaciones.GetClasificaciones() Then + Respuesta.Datos = objClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " + CveEmpresa.ToString) + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objClasificaciones.Dispose() + Return Respuesta + End Function + + + Public Function GetCategorias(CveEmpresa As Integer) As RespuestaWS + Dim objCategorias As New ClsGenerales + Dim Respuesta As New RespuestaWS + + If objCategorias.GetCategorias() Then + Respuesta.Datos = objCategorias.DtResultados.FiltraParametros("CveEmpresa = " + CveEmpresa.ToString) + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objCategorias.Dispose() + Return Respuesta + End Function + + + Public Function GetProductosServiciosEquivalencias(CvePS As Integer, CveEmpresa As Integer) As RespuestaWS + Dim objPS As New ClsProductosServicios + Dim Respuesta As New RespuestaWS + + If objPS.GetPSEquivalencias(CvePS, CveEmpresa) Then + Respuesta.Datos = objPS.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPS.Dispose() + Return Respuesta + End Function + + + Public Function GetProductosServiciosCaracteristicas(CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS + Dim objPSCaracteristicas As New ClsGralProductosServiciosCaracteristicas + Dim Respuesta As New RespuestaWS + + If objPSCaracteristicas.GetProductosServiciosCaracteristicas(CveEmpresa, CveSubProyecto) Then + Respuesta.Datos = objPSCaracteristicas.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPSCaracteristicas.Dispose() + Return Respuesta + End Function + + + Public Function GetProductosServiciosCaracteristicasOpciones(CveEmpresa As Integer, CveSubProyecto As Integer) As RespuestaWS + Dim objPSCaracteristicas As New ClsGralProductosServiciosCaracteristicas + Dim Respuesta As New RespuestaWS + + If objPSCaracteristicas.GetProductosServiciosCaracteristicasOpciones(CveEmpresa, CveSubProyecto) Then + Respuesta.Datos = objPSCaracteristicas.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPSCaracteristicas.Dispose() + Return Respuesta + End Function + + + Public Function GetProductosServiciosPaquetes(CveEmpresa As Integer) As RespuestaWS + Dim objPSPaquetes As New ClsProductosServicios + Dim Respuesta As New RespuestaWS + + If objPSPaquetes.GetPaqueteDetalle(-1, CveEmpresa) Then + Respuesta.Datos = objPSPaquetes.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objPSPaquetes.Dispose() + Return Respuesta + End Function +#End Region + +#Region "Usuarios" + + Public Function GetUsuariosDetalle(CveUsuario As Integer) As UsuarioWS + Dim objUsuario As New ClsSisUsuarios + Dim objEmpresa As New ClsSisEmpresas + + Dim Usuario As New UsuarioWS + + If objUsuario.GetUsuariosDetalle(CveUsuario, -1) Then + With Usuario + .CveUsuario = objUsuario.CveUsuario + .Usuario = objUsuario.Usuario + .Contraseña = objUsuario.Contraseña + .Nombre = objUsuario.Nombre + .CveRol = objUsuario.CveRol + '.Rol = + '.NombreEmpresa = objUsuario.no + .CveEmpresa = objUsuario.CveEmpresa + '.Liga = + '.Portal = + '.Modulos As HybridDictionary + '.Procesos As HybridDictionary + '.SeleccionoEmpresa As Boolean + '.CveSucursal = + '.CveProveedor = + '.CveCliente = + '.CveSupervisor As Integer + '.CveCoordinador As Integer + '.CveProspecto As Integer + '.CveVendedor As Integer + '.Referencia As String + '.EsSupervisorRH As Boolean + '.Empresa As Empresa = Nothing + '.ModoSimulacion As Boolean = False + '.NombreAbreviatura As String + + If objEmpresa.GetEmpresas(.CveEmpresa, "-1", "-1", "-1", "-1") Then + .Empresa = objEmpresa.Empresa + End If + End With + End If + + objUsuario.Dispose() + objEmpresa.Dispose() + + Return Usuario + End Function + + + Public Function GetUsuariosRolesProcesos(Usuario As String, Contraseña As String, CveProceso As Integer) As Integer + Dim CveUsuario As Integer = -1 + Dim objUsuarios As New ClsSisUsuarios + Dim objUsuario As New Usuario + + objUsuario = objUsuarios.ValidaUsuario(Usuario, Encripta(Contraseña), IMEI) + If objUsuario IsNot Nothing AndAlso objUsuario.TienePermisoProceso(CveProceso) Then + CveUsuario = objUsuario.CveUsuario + End If + + objUsuarios.Dispose() + + Return CveUsuario + End Function + + + Public Function GetUsuarios(CveEmpresa As Integer) As RespuestaWS + Dim Respuesta As New RespuestaWS + Respuesta.HuboError = False + + Using objUsuarios As New ClsSisUsuarios + + If objUsuarios.GetUsuarios(-1) Then + Respuesta.Datos = objUsuarios.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0} AND Estatus = 1 ", CveEmpresa)) + Respuesta.Datos.TableName = "Resultados" + Else + Respuesta.HuboError = True + Respuesta.Descripcion = "HUBO UN ERROR" + End If + End Using + Using objsubproy As New ClsSubProyectos + If objsubproy.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then + + Respuesta.Datos2 = objsubproy.DtResultados + Respuesta.Datos2.TableName = "Resultados" + End If + + End Using + + Return Respuesta + End Function + + + Public Function GetProcesos() As RespuestaWS + Dim objProcesos As New ClsSisProcesos + Dim Respuesta As New RespuestaWS + + If objProcesos.GetProcesos(-1) Then + Respuesta.Datos = objProcesos.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objProcesos.Dispose() + Return Respuesta + End Function + + Public Function GetUsuariosProcesos(CveUsuario As Integer) As RespuestaWS + Dim objUsuariosProcesos As New ClsSisUsuarios + Dim Respuesta As New RespuestaWS + + If objUsuariosProcesos.GetUsuariosProcesos(CveUsuario) Then + Respuesta.Datos = objUsuariosProcesos.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + Else + Respuesta.Descripcion = "HUBO UN ERROR" + End If + + objUsuariosProcesos.Dispose() + Return Respuesta + End Function +#End Region + +#Region "MetodosPago" + + Public Function GetMetodosPagos() As RespuestaWS + Dim objMetodoPago As New ClsMetodosPagos + Dim Respuesta As New RespuestaWS + + If objMetodoPago.GetMetodosPago() Then + Respuesta.Datos = objMetodoPago.DtResultados + Respuesta.Datos.TableName = "Resultados" + Respuesta.HuboError = False + End If + + objMetodoPago.Dispose() + Return Respuesta + End Function +#End Region + + +#Region "Ventas" + + Public Function AddVenta(ArregloVentas As ClsVentaWS()) As List(Of ListItem) + Dim MM As String = "AddVenta -- INFORMACION, ENTRO A AddVenta de WS_PuntoVenta" + MM.GuardaLog() + + Dim Errores As Boolean = False + Dim CveVentas As New List(Of ListItem) + Dim TotalPagado As Double = 0 + + + For Each objVenta As ClsVentaWS In ArregloVentas + Dim Fech1, Fech2, Fech3 As Date + If objVenta.Fech1 IsNot Nothing AndAlso objVenta.Fech1.Trim.Length > 0 AndAlso IsDate(objVenta.Fech1) Then Fech1 = objVenta.Fech1.Trim.ToDate + If objVenta.Fech2 IsNot Nothing AndAlso objVenta.Fech2.Trim.Length > 0 AndAlso IsDate(objVenta.Fech2) Then Fech2 = objVenta.Fech2.Trim.ToDate + If objVenta.Fech3 IsNot Nothing AndAlso objVenta.Fech3.Trim.Length > 0 AndAlso IsDate(objVenta.Fech3) Then Fech3 = objVenta.Fech3.Trim.ToDate + + Dim objVentas As New ClsVentas() + Dim ObjConta As New ClsContabilidad(objVentas.IniciaTransacSQL()) + Dim ObjPs As New ClsProductosServicios() + + Dim ErrorDetalles As Boolean = False + Dim ErrorMovtosVentas As Boolean = False + Dim ErrorMovtosDSV As Boolean = False + Dim ErrorMovtosCxC As Boolean = False + Dim ErrorMovtosTrasladoIVA As Boolean = False + Dim CvePrePoliza As Integer = 0 + + Try + + If objVenta.CveVenta = 0 Then + objVenta.Amortizacion = 0 + + + + If objVentas.GetVentaTerminal(objVenta.CveVentaTerminal, objVenta.Fecha, objVenta.CveSubProyecto, objVenta.CveEmpresa) Then + + CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "Punto de Venta addVenta", objVenta.CveUsuario, objVenta.CveEmpresa) + + If objVentas.DtResultados.Rows.Count = 0 Then + If objVentas.AddVenta(objVenta.TipoDocto, objVenta.FolioFact, objVenta.CveCliente, objVenta.CveClienteSucursal, + objVenta.SubTotal, objVenta.Descuento, objVenta.Amortizacion, objVenta.IVA, objVenta.RetIVA, objVenta.RetISR, + objVenta.Total, objVenta.CveMoneda, objVenta.TipoCambio, objVenta.CveMetodoPago, objVenta.CondicionesPago, + objVenta.FormaPago, Now, objVenta.Fecha, objVenta.MotivoDescuento, objVenta.Observaciones, objVenta.FechaEjecucion, + objVenta.CveVendedor, If(objVenta.Alfa1 IsNot Nothing, objVenta.Alfa1, ""), If(objVenta.Alfa2 IsNot Nothing, objVenta.Alfa2, ""), If(objVenta.Alfa3 IsNot Nothing, objVenta.Alfa3, ""), objVenta.Num1, + objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal, CveSubProyecto:=objVenta.CveSubProyecto, CveSubProyectoEjecucion:=objVenta.CveSubProyecto) Then + objVenta.CveVenta = objVentas.CveVenta + 'Ingresar los detalles + For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle + If objVentas.AddVentaDetalle(objVentas.CveVenta, Detalle.CvePS, Detalle.Cantidad, Detalle.CveUnidadMedida, Detalle.PU, Detalle.IVA, Detalle.Total, Detalle.Observaciones, Detalle.Descuento, Detalle.TipoDescuento, Detalle.CveSubProyecto, -1) Then + 'Ingresar las caracteristicas del detalle de la venta + For Each Caracteristica As ClsVentaWS.ClsVentaDetalleCaracteristicaWS In Detalle.Caracteristicas + If objVentas.AddVentaDetalleCaracteristica(objVentas.CveVentaDetalle, Caracteristica.CvePS, Caracteristica.CveOpcion) = False Then + 'Error al ingresar las caracteristicas del detalle de la venta + Errores = True + Exit For + End If + Next + Else + 'Error al ingresar el detalle de la venta + ErrorDetalles = True + Exit For + End If + Next + + 'Ingresar Inventario Modificado por Charlie + 'Dim ObjInv As New ClsInventarios(objVentas.IniciaTransacSQL) + + 'Dim CveInvMovimiento As Integer = ObjInv.AddMovimiento(6, 3, objVenta.CveMoneda, objVenta.Fecha, -1, objVenta.CveUsuario, objVenta.CveEmpresa, -1, objVenta.CveVenta, -1, -1) + + 'If CveInvMovimiento > 0 Then + ' For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle + ' If (Detalle.EsPaquete) Then + ' If ObjPs.GetPaqueteDetalle(Detalle.CvePS) Then + ' Dim contador As Integer = 0 'Declaramos el contador para manejar las filas + ' For Each Row As DataRow In ObjPs.DtResultados.Rows + ' If Not ObjInv.AddMovimientoDetalle(CveInvMovimiento, ObjPs.DtResultados.Rows(contador)("Cantidad").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("CveUnidadMedida").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("CvePS").ToString.ToEntero, ObjPs.DtResultados.Rows(contador)("Precio").ToString.ToDouble, -1) Then + ' ErrorDetalles = True + ' End If + ' contador += 1 + ' Next + ' Else + ' ErrorDetalles = True + ' End If + ' Else + ' If Not ObjInv.AddMovimientoDetalle(CveInvMovimiento, Detalle.Cantidad, Detalle.CveUnidadMedida, Detalle.CvePS, Detalle.PU, -1) Then + ' ErrorDetalles = True + ' End If + ' End If + + ' Next + + 'Else + ' Errores = True + 'End If + + If Errores = False And ErrorDetalles = False Then + 'Ingresar los metodos de pago + 'si el registro va correcto y no hay errores + For Each MetodoPago As ClsMetodosPagoWS In objVenta.MetodoPago + If MetodoPago.Importe > 0 Then + TotalPagado = TotalPagado + MetodoPago.Importe + If objVentas.AddVta_VentaPago(objVenta.CveVenta, MetodoPago.CveMetodoPago, MetodoPago.Importe) = False Then + 'Error al ingresar el detalle de la venta + Errores = True + Exit For + End If + End If + Next + End If + + If Errores = False And ErrorDetalles = False Then + 'Ingresar los registros de bitacora + If objVenta.Bitacora.Count > 0 Then + For Each Bitacora As ClsVta_BitacoraWS In objVenta.Bitacora + If objVentas.AddVta_Bitacora(objVenta.CveVenta, Bitacora.Fecha, Bitacora.Observacion, Bitacora.CveUsuario) = False Then + 'Error al ingresar el detalle de la venta + Errores = True + Exit For + End If + Next + End If + End If + + 'Ingresar PrePoliza si no esta pagada + If Errores = False And ErrorDetalles = False And TotalPagado < objVenta.Total Then + Dim CveIE As Integer = -1 + + Dim IdCtaContClientes As Integer + Dim CveConceptoAfectacion As Integer = 1 'Cliente + Dim CveConceptoAntCli As Integer = 3 'Anticipo Cliente + Dim CveConceptoVenta As Integer = 4 'Venta + Dim CveConceptoCanAnt As Integer = 11 'Cancelacion Anticipos + Dim CveConceptoDSV As Integer = 12 ' DSV + Dim CveConceptoIVA As Integer = 13 'IVA Trasladado + Dim CveConceptoRetIVA As Integer = 8 'Ret IVA + Dim CveConceptoRetISR As Integer = 9 'Ret ISR + Dim IdCtaContDSV As Integer + + Dim ObjFisConfiguracion As New ClsFISConfiguracion + If ObjFisConfiguracion.GetConfiguracion(objVenta.CveEmpresa) Then + IdCtaContDSV = ObjFisConfiguracion.ERDSV + Else + IdCtaContDSV = 0 + End If + ObjFisConfiguracion.Dispose() + + Dim ObjCliente As New ClsClientes() + If ObjCliente.GetClientes(objVenta.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, objVenta.CveEmpresa) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + IdCtaContClientes = ObjCliente.IdCtaContClientes + End If + End If + ObjCliente.Dispose() + + + If CvePrePoliza > 0 Then + Dim TipoMovimientoVenta As Boolean = True + Dim TipoMovimientoImpuestos As Boolean = False + Dim ImporteMov As Double + + 'Se agregan los movimientos de la Venta + 'If DT.Rows.Count > 0 Then + 'Se agrega movimiento separado por la cuenta de ventas (ER) + ' For Each Row As DataRow In DT.Rows + ImporteMov = objVenta.SubTotal ' TmpDT.SUM("Total", "IdCtaContVentas = '" & Row("IdCtaContVentas").ToString & "'") + Dim CveClasificacion_04 = -1 + If ImporteMov <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, CveSubProyecto:=objVenta.CveSubProyecto, CveClasificacion:=CveClasificacion_04) Then + ErrorMovtosVentas = True + End If + End If + ' Next + + 'Se agregan los DSV DESCUENTOS + ImporteMov = objVenta.Descuento + If ImporteMov <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then + ErrorMovtosDSV = True + End If + End If + 'End If + + 'Se agregan las CxC + ImporteMov = objVenta.Total - TotalPagado + If ImporteMov <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then + ErrorMovtosCxC = True + End If + End If + + 'Si hubo un pago agregarlo + ImporteMov = TotalPagado + If ImporteMov <> 0 Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then + ErrorMovtosCxC = True + End If + End If + + 'Se agregan el Traslado de IVA + ImporteMov = objVenta.IVA + If ImporteMov <> 0 Then + Dim PorcentajeImpuesto = 0 + If objVenta.SubTotal > 0 Then + PorcentajeImpuesto = (objVenta.IVA / objVenta.SubTotal) + End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, PorcentajeImpuesto:=PorcentajeImpuesto) Then + ErrorMovtosTrasladoIVA = True + End If + End If + End If + End If + Else + Errores = True + End If + Else + objVentas.CveVenta = objVentas.DtResultados.Rows(0)("CveVenta").ToString.ToEntero + MM = "AddVenta -- INFORMACION, LA VENTA YA EXISTE EN LA BASE DE DATOS" + MM.GuardaLog() + End If + Else + Errores = True + End If + + + + Else + objVentas.CveVenta = objVenta.CveVenta + 'Ingresar los metodos de pago + 'si el registro va correcto y no hay errores + objVentas.RemoveVta_VentaPago(objVenta.CveVenta, -1) + + For Each MetodoPago As ClsMetodosPagoWS In objVenta.MetodoPago + If MetodoPago.Importe > 0 Then + If objVentas.AddVta_VentaPago(objVenta.CveVenta, MetodoPago.CveMetodoPago, MetodoPago.Importe) = False Then + 'Error al ingresar el detalle de la venta + Errores = True + Exit For + End If + End If + Next + End If + + Catch ex As Exception + Errores = True + End Try + + If Errores OrElse ErrorDetalles OrElse ErrorMovtosVentas OrElse ErrorMovtosDSV OrElse ErrorMovtosCxC OrElse ErrorMovtosTrasladoIVA Then + objVentas.RollBack() + CveVentas.Add(New ListItem(objVenta.CveVentaTerminal.ToString, "-1")) + Else + objVentas.Commit() + CveVentas.Add(New ListItem(objVenta.CveVentaTerminal.ToString, objVentas.CveVenta.ToString)) + End If + objVentas.Dispose() + ObjConta.Dispose() + Next + + + + Return CveVentas + End Function + +#End Region + + +#Region "Cortes" + + Public Function GetVtaCortes(FechaI As String, FechaF As String, CveUsuario As Integer, CveEmpresa As Integer, Finalizado As Integer) As List(Of ClsVtaCortesWS) + Dim objPV As New ClsPuntoVenta + Dim objVtaCortes As New List(Of ClsVtaCortesWS) + + If (objPV.GetVta_Cortes(FechaI, FechaF, CveUsuario, -1, CveEmpresa, Finalizado) = True) Then + For Each Row As DataRow In objPV.DtResultados.Rows + objVtaCortes.Add(New ClsVtaCortesWS(Row("CveCorte").ToString.ToEntero, Row("FechaInicial").ToString.ToDateTime, If(IsDate(Row("FechaFinal")), Row("FechaFinal").ToString.ToDateTime, New DateTime), Row("ImporteInicial").ToString.ToDouble, If(Not IsDBNull(Row("ImporteFinal")), Row("ImporteFinal").ToString.ToDouble, 0), Row("Descripcion").ToString(), Row("Estatus").ToString, Row("Usuario").ToString, Row("UsuarioNombre").ToString, Row("Vendido").ToString.ToDouble, Row("VendidoEfectivo").ToString.ToDouble, Row("Retirado").ToString.ToDouble, Row("Ingresado").ToString.ToDouble)) + Next + End If + objPV.Dispose() + + Return objVtaCortes + End Function + + + Public Function GetVta_MovimientosCajas(CveCorte As Integer, TipoMovimiento As Integer) As List(Of ClsMovimientosCajaWS) + Dim objPV As New ClsPuntoVenta() + Dim objMovimientosCaja As New List(Of ClsMovimientosCajaWS) + + If objPV.GetVta_MovimientosCajas(CveCorte, TipoMovimiento) Then + For Each Row As DataRow In objPV.DtResultados.Rows + objMovimientosCaja.Add(New ClsMovimientosCajaWS(Row("CveMovimiento").ToString.ToEntero, Row("CveCorte").ToString.ToEntero, Row("Importe").ToString.ToEntero, Row("Descripcion").ToString, Row("TipoMovimiento").ToString)) + Next + End If + + objPV.Dispose() + + Return objMovimientosCaja + End Function + + + Public Function AddVta_MovimientosCajas(CveCorte As Integer, CveUsuario As Integer, Importe As Double, Descripcion As String, TipoMovimiento As Integer, Fecha As DateTime) As Integer + Dim objPV As New ClsPuntoVenta() + Dim CveMovimiento As Integer + + If objPV.AddVta_MovimientosCajas(CveCorte, CveUsuario, Importe, Descripcion, TipoMovimiento, Fecha) Then + CveMovimiento = objPV.CveMovimiento + End If + + objPV.Dispose() + + Return CveMovimiento + End Function + + + Public Function AddVtaCortes(FechaInicial As DateTime, ImporteInicial As Decimal, CveUsuario As Integer, Descripcion As String, CveEmpresa As Integer) As Integer + Dim objPV As New ClsPuntoVenta() + Dim CveCorte As Integer + + If objPV.AddVtaCortes(FechaInicial, ImporteInicial, CveUsuario, Descripcion, CveEmpresa) Then + CveCorte = objPV.CveCorte + End If + + objPV.Dispose() + + Return CveCorte + End Function + + + Public Function AddVtaCortesDetalles(CveCorte As Integer, CveMetodoPago As Integer, Importe As Double) As Boolean + Dim Retorno As Boolean = False + Dim objPV As New ClsPuntoVenta() + + If objPV.AddVtaCortesDetalles(CveCorte, CveMetodoPago, Importe) Then + Retorno = True + End If + + objPV.Dispose() + + Return Retorno + End Function + + + Public Function PruebaMail() As Boolean + EnviarCorreo(3246, 61) + Return True + End Function + + + Public Function UpdateVtaCortes(VtaCorte As ClsVtaCortesWS) As Boolean + Dim objPV As New ClsPuntoVenta() + Dim Respuesta As Boolean = False + + objPV.IniciaTransacSQL() + + If objPV.UpdateFinalizadoVtaCortes(VtaCorte.CveCorte, VtaCorte.ImporteFinal, VtaCorte.Diferencia, VtaCorte.FechaFinal, VtaCorte.CveEmpresa) Then + Respuesta = True + End If + + If Respuesta = True Then + For Each CorteDetalle As ClsVtaCortesWS.ClsVtaCortesDetallesWS In VtaCorte.CortesDetalles + If Not objPV.AddVtaCortesDetalles(CorteDetalle.CveCorte, CorteDetalle.CveMetodoPago, CorteDetalle.Importe) Then + Respuesta = False + Exit For + End If + Next + End If + + If Respuesta = True Then + objPV.Commit() + + 'Enviar correo de corte de turno + EnviarCorreo(VtaCorte.CveCorte, VtaCorte.CveEmpresa) + + ' Dim cuenta As Integer = GetCuenta(2090) + Else + objPV.RollBack() + End If + + objPV.Dispose() + + Return Respuesta + End Function + + + Public Function GetVentasPagoGet(CveCorte As Integer, CveEmpresa As Integer) As List(Of ClsVtaVentasPagoWS) + Dim objPV As New ClsPuntoVenta + Dim objVentasPago As New List(Of ClsVtaVentasPagoWS) + + ' Dim Respuesta As String + + If objPV.GetVta_VentasPago(CveCorte, CveEmpresa) Then + For Each Row As DataRow In objPV.DtResultados.Rows + objVentasPago.Add(New ClsVtaVentasPagoWS(CveCorte, Row("MetodoPago").ToString, Row("Importe").ToString.ToDouble)) + Next + End If + objPV.Dispose() + + Return objVentasPago + End Function + + ' + 'Public Function GetCuenta(CveSucursal As Integer) As Integer + ' Dim objSU As New ClsSucursales + ' Dim Cuenta As Integer + + ' 'Cuenta = objSU.GetCuenta(CveSucursal) + ' objSU.Dispose() + + ' Return Cuenta + 'End Function + + + Public Function AddBancosIE(Importe As Double, Moneda As Integer, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, Cuenta As Integer, Comprobante As String, Opcion As String) As Boolean + Dim ObjIE As New ClsBancos() + Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) + Dim Folio As Long + Dim Banco As New ClsBancos + + Dim Respuesta As Boolean = False + Dim CveIE As Integer + Dim MsgError As String = "" + Dim CveConceptoContable As Integer = 4 + Dim CveConceptoCompra As Integer = 30 + Dim CIF As Double = 0 + Dim CvePlantillaPoliza As Integer = 4 + Dim CveTipoPoliza As Integer = 1 + Dim CvePrePoliza As Integer = 0 + Dim CveTipoTransaccion As Integer = 4 + + Try + + CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "Punto de venta IE", CveUsuario, CveEmpresa) + + 'valida prepoliza + If CvePrePoliza > 0 Then + + Folio = Banco.GetNextFolio(Cuenta, CveTipoTransaccion) + Banco.Dispose() + + CveIE = ObjIE.AddBancos_IE(Cuenta, CveTipoTransaccion, Fecha, Folio, "", Importe, Moneda, + 0, Opcion, "", False, False, -1, CvePrePoliza, "pdf", CveUsuario, CveEmpresa) + + + If CveIE > 0 Then + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE, ImporteMX:=Importe) Then + Dim IVA As Double = 0 + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE, ImporteMX:=Importe - IVA - CIF) Then + + Else + MsgError = "no se pudo insertar el detalle de la póliza2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + + End If + + End If + + ObjIE.Commit() + Respuesta = True + + Catch ex As Exception + Respuesta = False + ObjIE.RollBack() + End Try + + ObjMov.Dispose() + ObjIE.Dispose() + + Return Respuesta + End Function +#End Region + + +#Region "Vendedores" + + Public Function GetVendedores(CveEmpresa As Integer) As RespuestaWS + Dim objVend As New ClsVtaVendedores + Dim Respuesta As New RespuestaWS + + If objVend.GetVendedores(CveEmpresa) Then + Respuesta.Datos = objVend.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) + Respuesta.Datos.TableName = "Vendedores" + Respuesta.HuboError = False + + End If + + objVend.Dispose() + Return Respuesta + End Function +#End Region + + +#Region "Mesas" + ' + 'Public Function GetMesas(CveEmpresa As Integer) As RespuestaWS + ' Dim objVent As New ClsVentas + ' Dim Respuesta As New RespuestaWS + + ' If objVent.GetMesas(CveEmpresa) Then + ' Respuesta.Datos = objVent.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) + ' Respuesta.Datos.TableName = "Mesas" + ' Respuesta.HuboError = False + + ' End If + + ' objVent.Dispose() + ' Return Respuesta + 'End Function +#End Region + +#Region "Inventario" + + Public Function GetInv_Almacenes(CveEmpresa As Integer) As RespuestaWS + Dim objInventario As New ClsInventarios + Dim Respuesta As New RespuestaWS + + If objInventario.GetAlmacenes(-1, -1, CveEmpresa, -1) Then + Respuesta.Datos = objInventario.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) + Respuesta.Datos.TableName = "Almacenes" + Respuesta.HuboError = False + End If + + objInventario.Dispose() + Return Respuesta + End Function + + + Public Function GetInv_Conceptos() As RespuestaWS + Dim objInventario As New ClsInventarios + Dim Respuesta As New RespuestaWS + + If objInventario.GetConceptos() Then + Respuesta.Datos = objInventario.DtResultados '.FiltraParametros(String.Format("CveVendedor={0}", CveEmpresa)) + Respuesta.Datos.TableName = "Inv_Conceptos" + Respuesta.HuboError = False + End If + + objInventario.Dispose() + Return Respuesta + End Function + + + Public Function GetInv_SeccionesAlmacenes(CveEmpresa As Integer) As RespuestaWS + Dim objInventario As New ClsInventarios + Dim Respuesta As New RespuestaWS + + If objInventario.GetSeccionesAlmacenes(CveEmpresa, -1) Then + Respuesta.Datos = objInventario.DtResultados '.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) + Respuesta.Datos.TableName = "Inv_SeccionesAlmacenes" + Respuesta.HuboError = False + End If + + objInventario.Dispose() + Return Respuesta + End Function + + Public Function GetInv_TiposAlmacenes(CveEmpresa As Integer) As RespuestaWS + Dim objInventario As New ClsInventarios + Dim Respuesta As New RespuestaWS + + If objInventario.GetTiposAlmacenes() Then + Respuesta.Datos = objInventario.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) + Respuesta.Datos.TableName = "Inv_TiposAlmacenes" + Respuesta.HuboError = False + End If + + objInventario.Dispose() + Return Respuesta + End Function + + Public Function GetInv_Movimientos(CveEmpresa As Integer) As RespuestaWS + Dim objInventario As New ClsInventarios + Dim Respuesta As New RespuestaWS + + If objInventario.GetMovimientos(-1, -1, -1, CveEmpresa) Then + Respuesta.Datos = objInventario.DtResultados.FiltraParametros("CveMovimientoTerminal IS NULL") + Respuesta.Datos.TableName = "Inv_Movimientos" + + For Each Row As DataRow In Respuesta.Datos.Rows + If objInventario.GetMovimientosDetalle(Row("CveMovimiento").ToString.ToEntero, CveEmpresa) Then + If objInventario.DtResultados.Rows.Count > 0 Then + Respuesta.Datos2.Merge(objInventario.DtResultados) + End If + End If + Next + + Respuesta.HuboError = False + End If + + objInventario.Dispose() + Return Respuesta + End Function +#End Region + + +#Region "Contabilidad" + ' _ + 'Public Function GetConta_ConceptosContables() As RespuestaWS + ' Dim objConta As New ClsContabilidad + ' Dim Respuesta As New RespuestaWS + + ' If objConta.GetConta_ConceptosContables() Then + ' Respuesta.Datos = objConta.DtResultados + ' Respuesta.Datos.TableName = "Conta_ConceptosContables" + ' Respuesta.HuboError = False + ' End If + + ' objConta.Dispose() + ' Return Respuesta + 'End Function + + ' _ + 'Public Function AddPrePolizas(ArregloPrePolizas As ClsPrePolizaWS()) As List(Of ListItem) + ' Dim Errores As Boolean = False + ' Dim CvePrePolizas As New List(Of ListItem) + ' Dim CvePrePoliza As Integer + + ' Dim objConta As New ClsContabilidad + + ' For Each objPrepoliza As ClsPrePolizaWS In ArregloPrePolizas + ' objConta.IniciaTransacSQL() + + ' CvePrePoliza = objConta.AddPrePolizas(objPrepoliza.Modulo, objPrepoliza.CveTipoPoliza, objPrepoliza.Cargos, objPrepoliza.Abonos, objPrepoliza.CveMoneda, objPrepoliza.Fecha, objPrepoliza.CveUsuario, objPrepoliza.CveEmpresa) + ' If CvePrePoliza > 0 Then + ' 'Ingresar los detalles + ' For Each Detalle As ClsPrePolizaWS.ClsPrePolizaDetalleWS In objPrepoliza.Detalle + ' If objConta.AddPrePolizasDetalle(objPrepoliza.CvePrepoliza, Detalle.TipoMovto, Detalle.Importe, Detalle.Referencia, Detalle.CveConceptoContable, Detalle.Concepto, Detalle.FechaVencimiento, Detalle.IdCtaContable, Detalle.IdSegmentoNegocio, Detalle.CveIE, Detalle.CveVenta, Detalle.CveCompra, Detalle.CveSubProyecto, Detalle.CveCliente, Detalle.CveProveedor, Detalle.CvePersonal, Detalle.CveMovimientoAlmacen, Detalle.CveActivoFijo) = False Then + ' 'Error al ingresar el detalle de la venta + ' Errores = True + ' Exit For + ' End If + ' Next + ' End If + + ' If Errores = False Then + ' objConta.Commit() + ' CvePrePolizas.Add(New ListItem(objPrepoliza.CvePrepolizaTerminal.ToString, CvePrePoliza.ToString)) + ' Else + ' objConta.RollBack() + ' CvePrePolizas.Add(New ListItem(objPrepoliza.CvePrepolizaTerminal.ToString, "-1")) + ' End If + ' Next + + ' objConta.Dispose() + ' Return CvePrePolizas + 'End Function + + +#End Region + +#Region "ENVIO CORREO" + Protected Sub EnviarCorreo(CveCorte As Integer, CveEmpresa As Integer) + Dim Body As String ''GlobalDTUsuarios(CveUsuario)(0)("correo").ToString + + Dim Correo As String = If(CveEmpresa = 61, "ariel@grupoabt.mx", "rene.molina@gmail.com") + Dim Correos() As String = If(CveEmpresa = 61, {"roberto@grupoabt.mx", "isaac@grupoabt.mx", "grisey@grupoabt.mx"}, {"julian@adsistemas.mx", "jonaslopez@gmail.com"}) + 'Dim Correo As String = If(CveEmpresa = 61, "charlie.cuchm@gmail.com", "charlie.cuchm@gmail.com") + 'Dim Correos() As String = If(CveEmpresa = 61, {"charlie.cuchm@gmail.com"}, {"charlie.cuchm@gmail.com", "charlie.cuchm@gmail.com"}) + Dim Sucursal As String = "" + + Try + Body = GeneraCorreo(CveCorte, CveEmpresa, Sucursal, "") + + Dim Empresa As Empresa = Nothing + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then + Empresa = ObjEmpresa.Empresa + 'Empresa.Ruta = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa) + End If + ObjEmpresa.Dispose() + + Dim Asunto As String = String.Format("SIG. Corte de Turno de: {0}", Sucursal) + Dim Hilo As New System.Threading.Thread(AddressOf MandaCorreo) + + Dim Parametros(3) As Object + Parametros(0) = Empresa + Parametros(1) = Correo + Parametros(2) = Asunto + Parametros(3) = Body + + Dim Env As New Envio + Env.Empresa = Empresa + Env.Correos = Correos + Env.Correo = Correo + Env.Asunto = Asunto + Env.Contenido = Body + + Hilo.Start(Env) + ' Alert("Se enviara correo por cambio Modificacion") + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + Private Sub MandaCorreo(Data As Object) + Dim Env As Envio = CType(Data, Envio) + Dim Empresa As Empresa = Env.Empresa + Dim Correo As String = Env.Correo + Dim Asunto As String = Env.Asunto + Dim Body As String = Env.Contenido + Dim Correos() As String = Env.Correos + + Dim Mail As New ClsSisMail() + Mail.SendMail(Empresa, Correo, Asunto, Body) + End Sub + + Private Function GeneraCorreo(CveCorte As Integer, CveEmpresa As Integer, ByRef Sucursal As String, Opciones As String) As String + Dim strBody As New StringBuilder + 'Obtener datos del corte de turno + Dim objPV As New ClsPuntoVenta + Dim strDetalle As New StringBuilder + Dim strProductos As New StringBuilder + Dim VendidoEfectivo As Double = 0 + + If objPV.GetVta_Cortes("-1", "-1", -1, CveCorte, CveEmpresa, -1) Then + If objPV.CveCorte > 0 Then + Sucursal = objPV.Sucursal + If objPV.GetVta_CortesDetalles(CveCorte) Then + For Each dr As DataRow In objPV.DtResultados.Rows + If dr("CveMetodoPago").ToString.ToEntero = 1 Then + VendidoEfectivo = dr("Importe").ToString.ToDouble + strDetalle.AppendFormat(" {0} ${1} ", + dr("MetodoPago"), (dr("Importe").ToString.ToDouble - objPV.Propina).FormatoNumero) + Else + strDetalle.AppendFormat(" {0} ${1} ", + dr("MetodoPago").ToString, dr("Importe").ToString.FormatoNumero) + End If + Next + End If + + Dim ObjVentas As New ClsPV() + If ObjVentas.GetRepPVVentas("-1", "-1", "-1", "-1", -1, -1, -1, "-1", -1, -1, "-1", CveEmpresa, 6, CveCorte) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + For Each Col As DataColumn In ObjVentas.DtResultados.Columns + If Col.ColumnName.Split("_"c).Length = 3 AndAlso Col.ColumnName.Split("_"c)(1).ToUpper = "TOTAL" Then + strProductos.AppendFormat(" {0} ${1} ", + Col.ColumnName.Split("_"c)(2).ToUpper, ObjVentas.DtResultados.Rows(0)(Col.ColumnName).ToString.FormatoNumero) + End If + Next + End If + End If + ObjVentas.Dispose() + + + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Empresa") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Sucursal) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Empresa) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Direccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Colonia) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Ciudad, objPV.Estado, "83333") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.RFC) + strBody.AppendFormat(" ") + strBody.AppendFormat("
    {0}
    {0}
    {0}
    Col. {0}
    {0}, {1}, C.P.{2}
    RFC {0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Corte de Turno") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Descripcion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.FechaInicial.ToString("dd/MM/yyyy HH:mm")) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.UsuarioNombre) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.FechaFinal.ToString("dd/MM/yyyy HH:mm")) + strBody.AppendFormat(" ") + strBody.AppendFormat("
    Descripcion:{0}Inicio:{0}
    Usuario:{0}Termino:{0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Movimiento de Efectivo") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.ImporteInicial.FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", VendidoEfectivo.FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Ingresado.FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Retirado.FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objPV.Propina.FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", (objPV.ImporteInicial + VendidoEfectivo + objPV.Ingresado - objPV.Retirado - objPV.Propina).FormatoNumero) + strBody.AppendFormat(" ") + strBody.AppendFormat("
    MetodoImporte
    Importe Inicial:${0}
    Ventas Efectivo:${0}
    Entradas:${0}
    Salidas:${0}
    Propinas:${0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    NETO DE EFECTIVO${0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Detalles de Pagos") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + 'POngo el detalle + strBody.AppendFormat("{0}", strDetalle.ToString) + + strBody.AppendFormat("
    MetodoImporte
    ") + strBody.AppendFormat("
    ") + + + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Ventas por Categoria de Producto") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + 'Pongo el detalle por productos + strBody.AppendFormat("{0}", strProductos.ToString) + + strBody.AppendFormat("
    CategoriaImporte
    ") + strBody.AppendFormat("
    ") + + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.Append("") + End If + End If + + objPV.Dispose() + Return strBody.ToString + End Function +#End Region + +End Class \ No newline at end of file