Merge branch 'master' of http://oirigoyen@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -4,13 +4,6 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Catálogo de Choferes
|
||||
@@ -212,12 +205,11 @@
|
||||
<%--<asp:TextBox ID="TxtResidenciaFiscalOperador" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="50"></asp:TextBox>--%>
|
||||
|
||||
<asp:DropDownList runat="server" ID="DdlResidenciaFiscalOperador" CssClass="form-control select2me" Width="100%" >
|
||||
<asp:ListItem Value="-1">Seleccione una</asp:ListItem>
|
||||
<asp:ListItem Value="">-</asp:ListItem>
|
||||
<asp:ListItem Value="MEX">MEX</asp:ListItem>
|
||||
<asp:ListItem Value="USA">USA</asp:ListItem>
|
||||
<asp:ListItem Value="CAN">CAN</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RfvDdlResidenciaFiscalOperador" InitialValue="-1" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlResidenciaFiscalOperador" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Residencia Fiscal Operador''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
|
||||
<label for="<%= DdlResidenciaFiscalOperador.ClientID.ToString()%>">Residencia Fiscal Operador:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="BtnAgregarFolioGarantia" data-toggle="tooltip" data-placement="left" title="Agregar un Folio de Garantía" Text="<i class='fa fa-plus'></i> Agregar Folio "></asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
@@ -71,12 +70,12 @@
|
||||
<ContentTemplate>
|
||||
<asp:Panel ID="Panel1" runat="server" DefaultButton="BtnConsultar">
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px;">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button Text="Consultar" ID="BtnConsultar" CssClass="btn btn-primary" OnClick="BtnConsultar_Click" runat="server" />
|
||||
</div>
|
||||
<div class="titlefiltros caption ">
|
||||
<div class="row" style="padding-top: 10px;">
|
||||
<div class="row" style="padding-top: 0px;">
|
||||
<label class="col-md-1 truncate">Tipo Folio:</label>
|
||||
<div class="col-md-2 ">
|
||||
<%-- <asp:DropDownList ID="DdlSucursal" runat="server" CssClass="select2me" DataTextField="Sucursal" DataValueField="CveSucursal" Width="200px" ValidationGroup="GrpGuardar"></asp:DropDownList>--%>
|
||||
@@ -108,12 +107,12 @@
|
||||
</asp:Panel>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<br />
|
||||
|
||||
<asp:UpdatePanel ID="UpGral" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row">
|
||||
<div class="Widthall" style="text-align: right!important; margin-top: 20px!important; margin-bottom: 2px!important">
|
||||
<div class="Widthall" style="text-align: right!important; margin-top: 2px!important; margin-bottom: 2px!important">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvFolioGarantia.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvFolioGarantia.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
|
||||
@@ -1285,7 +1285,7 @@ Public Class ClsInventarios
|
||||
Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha,
|
||||
Optional Observaciones As String = "", Optional CveMovimientoDetalleEntrada As Integer = -1, Optional PUTC As Decimal = -1,
|
||||
Optional CostoIndirecto As Decimal = 0, Optional CveCompraDetalle As Integer = -1, Optional CveOrdenCompraDetalle As Integer = -1, Optional CveVentaDetalle As Integer = -1,
|
||||
Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1, Optional CveVentaDetallePadre As Integer = -1) As Boolean
|
||||
Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1, Optional CveVentaDetalleRemision As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Inv_MovimientosDetalleAdd")
|
||||
@@ -1311,7 +1311,7 @@ Public Class ClsInventarios
|
||||
.Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
|
||||
.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
|
||||
.Add("@EsInterno", SqlDbType.Int).Value = EsInterno
|
||||
.Add("@CveVentaDetallePadre", SqlDbType.Int).Value = CveVentaDetallePadre
|
||||
.Add("@CveVentaDetalleRemision", SqlDbType.Int).Value = CveVentaDetalleRemision
|
||||
|
||||
.Add("@CveMovimientoDetalle", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
End With
|
||||
|
||||
@@ -379,6 +379,67 @@ Public Class ClsMovimientos
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddNotificacionEdoCuentaCliente(CveCliente As Integer, Fecha As DateTime) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_NotificacionesEdoCuentaClienteAdd")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un error al agregar notificaciones del estado de cuenta del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetNotificacionEdoCuentaCliente(CveEmpresa As Integer, CveCliente As Integer, Fecha As DateTime) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_NotificacionesEdoCuentaClienteGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un error al obtener notificaciones del estado de cuenta del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateNotificacionEdoCuentaCliente(CveNotificacionBitacora As Integer, Notifico As Boolean) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_NotificacionesEdoCuentaClienteUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveNotificacionBitacora", SqlDbType.Int).Value = CveNotificacionBitacora
|
||||
.Add("@Notifico", SqlDbType.Bit).Value = Notifico
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un error al actualizar notificaciones del estado de cuenta del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetClienteAbonos(CveCliente As Integer, Optional CveMoneda As Integer = -1, Optional FechaVencimientoInicio As String = "-1", Optional FechaVencimientoFin As String = "-1", Optional CveUsuarioProgramo As Integer = -1, Optional Serie As String = "", Optional SelectTop As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_ClienteBancos")
|
||||
|
||||
@@ -3989,12 +3989,17 @@ Namespace Modelos
|
||||
'COMIENZA: VENTADETALLE
|
||||
'CUANDO SEA SALIDA VA POR LA VENTA DETALLE DE LA FACTURA DE LA REMISION - OJO!! SOLO FUNCIONA HASTA ORITA QUE SE HACE SALIDA SOLO CUANDO SE FACTURA LA REMISION
|
||||
Dim CveVentaDetalle = If(ConceptoEntrada.Contiene(3, 40), DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero, MovDet("CveVentaDetalle").ToString.ToEntero)
|
||||
|
||||
Dim CveVentaDetalleRemision As Integer = -1
|
||||
If ConceptoEntrada = 40 AndAlso MovDet("CveVentaDetalle").ToString().ToEntero() > 0 Then
|
||||
CveVentaDetalleRemision = MovDet("CveVentaDetalle").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
'CUANDO LA VENTADETALLE NO TENGA VALOR DEBE MARCAR ERROR, NUEVA RESTRICCION DE ALMACEN
|
||||
If CveVentaDetalle < 0 Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
'TERMINA: VENTADETALLE
|
||||
|
||||
If Cantidad < 0 Then
|
||||
ErrorList.Add("Ocurrió un Error al generar los movimientos de almacén. Por favor comuniquese con atención SIG.")
|
||||
@@ -4002,7 +4007,7 @@ Namespace Modelos
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then
|
||||
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle, CveVentaDetalleRemision:=CveVentaDetalleRemision) Then
|
||||
ContadorMovtosDetalles += 1
|
||||
Else
|
||||
OcurrioError = True
|
||||
@@ -5128,7 +5133,12 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, FechaCaducidad:=FechaCaducidad) Then
|
||||
Dim CveVentaDetalleRemision As Integer = -1
|
||||
If CveConceptoMovimiento = 41 Then
|
||||
CveVentaDetalleRemision = Dr("CveVentaDetalleRemision").ToString.ToEntero()
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, FechaCaducidad:=FechaCaducidad, CveVentaDetalleRemision:=CveVentaDetalleRemision) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -7191,25 +7201,34 @@ Namespace Modelos
|
||||
HttpContext.Current.Application("GlobalDTEmpresas") = value
|
||||
End Set
|
||||
End Property
|
||||
Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1) As DataTable
|
||||
Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable
|
||||
Get
|
||||
Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If HttpContext.Current.Application(AppNombre) Is Nothing Then
|
||||
Dim ObjClasificaciones As New ClsClasificaciones
|
||||
If ObjClasificaciones.GetClasificaciones(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjClasificaciones.DtResultados
|
||||
ObjClasificaciones.Dispose()
|
||||
End If
|
||||
If CveEmpresa <> -1 Then
|
||||
Dim Str As New StringBuilder
|
||||
Str.AppendFormat("CveEmpresa = {0}", CveEmpresa)
|
||||
If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria)
|
||||
If UsoClasificacion <> -1 Then Str.AppendFormat(" AND UsoClasificacion IN ({0},3) ", UsoClasificacion)
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows)
|
||||
If CveClasificacion <> -1 Then Str.AppendFormat(" AND CveClasificacion = {0}", CveClasificacion)
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows)
|
||||
GlobalDTClasificaciones = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
Else
|
||||
GlobalDTClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones"), DataTable)
|
||||
GlobalDTClasificaciones = DirectCast(HttpContext.Current.Application(AppNombre), DataTable)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
HttpContext.Current.Application("GlobalDTClasificaciones") = value
|
||||
Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa)
|
||||
HttpContext.Current.Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
Property GlobalDTClasificaciones2(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable
|
||||
|
||||
@@ -9,9 +9,59 @@ Imports Extensiones
|
||||
Imports System.IO
|
||||
Imports CrystalDecisions.CrystalReports.Engine
|
||||
Imports CrystalDecisions.Shared
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
|
||||
Private ReadOnly Property GlobalDTUsuariosE140(Optional CveUsuario As Integer = -1, Optional CveCliente As Integer = -1, Optional CveProveedor As Integer = -1) As DataTable
|
||||
Get
|
||||
Dim CveEmpresa As Integer = 140
|
||||
Dim Str As New StringBuilder
|
||||
If CveUsuario <> -1 Then Str.AppendFormat("CveUsuario = {0}", CveUsuario)
|
||||
If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa)
|
||||
If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente)
|
||||
If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor)
|
||||
|
||||
If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
||||
GlobalDTUsuariosE140 = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
Else
|
||||
GlobalDTUsuariosE140 = DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Shared ReadOnly Property GlobalDTSubProyectosE140(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional Estatus As Integer = 1) As DataTable
|
||||
Get
|
||||
Dim CveEmpresa As Integer = 140
|
||||
Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then
|
||||
Dim P As New ClsSubProyectos
|
||||
If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = P.DtResultados
|
||||
P.Dispose()
|
||||
End If
|
||||
|
||||
If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then
|
||||
Dim StrSQL As New StringBuilder
|
||||
If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto)
|
||||
If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto)
|
||||
If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus)
|
||||
If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa)
|
||||
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows)
|
||||
GlobalDTSubProyectosE140 = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
|
||||
Else
|
||||
GlobalDTSubProyectosE140 = DirectCast(HttpContext.Current.Application(AppNombre), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private currentcontext As HttpContext
|
||||
Private URLParametros As New Hashtable
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
@@ -20,6 +70,8 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
Dim retorno As String = "no se encontro la variable"
|
||||
Try
|
||||
Dim metodo As String = ""
|
||||
Dim FechaActual As DateTime = Now
|
||||
Dim FechaEnvio As DateTime = FechaActual
|
||||
|
||||
If context.Request("var") IsNot Nothing Then
|
||||
URLParametros = Parametros(context.Request("var"))
|
||||
@@ -36,6 +88,9 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End Using
|
||||
ElseIf context.Request("metodo") IsNot Nothing Then
|
||||
metodo = context.Request("metodo").ToString()
|
||||
If context.Request("FechaEnvio") IsNot Nothing Then
|
||||
FechaEnvio = context.Request("FechaEnvio").ToString().ToDateTime()
|
||||
End If
|
||||
End If
|
||||
|
||||
Select Case metodo
|
||||
@@ -46,7 +101,10 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
context.Response.Write(retorno)
|
||||
Case "EstadosCuenta"
|
||||
'CargaEstadosCuenta(context, 119, 227774)
|
||||
CargaEstadosCuenta(context, 119, -1)
|
||||
CargaEstadosCuenta(context, 119, -1, FechaEnvio, FechaActual)
|
||||
|
||||
Case "ScoreCard"
|
||||
CargaScoreCard(context, 140, FechaEnvio)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ex.GuardaLog(ex.ToString())
|
||||
@@ -270,7 +328,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
|
||||
#Region "E S T A D O S D E C U E N T A"
|
||||
Private Sub CargaEstadosCuenta(ByVal context As HttpContext, pCveEmpresa As Integer, pCveCliente As Integer)
|
||||
Private Sub CargaEstadosCuenta(ByVal context As HttpContext, pCveEmpresa As Integer, pCveCliente As Integer, FechaEnvio As DateTime, FechaActual As DateTime)
|
||||
Dim Retorno As New JArray()
|
||||
Dim DtEmpresas As DataTable = Nothing
|
||||
Using ObjEmpresas As New ClsSisEmpresas()
|
||||
@@ -282,7 +340,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
If DtEmpresas IsNot Nothing Then
|
||||
For Each Row As DataRow In DtEmpresas.Rows
|
||||
Dim Usuario = ValidaUsuarioSistema(Row("CveEmpresa").ToString().ToEntero())
|
||||
Dim obj = EjecutarEnvioEstadoCuenta(Usuario, pCveCliente:=pCveCliente)
|
||||
Dim obj = EjecutarEnvioEstadoCuenta(Usuario, FechaEnvio, FechaActual, pCveCliente:=pCveCliente)
|
||||
|
||||
Retorno.Add(obj)
|
||||
Next
|
||||
@@ -331,7 +389,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function EjecutarEnvioEstadoCuenta(UsuarioActual As Usuario, Optional pCveCliente As Integer = -1) As JObject
|
||||
Private Function EjecutarEnvioEstadoCuenta(UsuarioActual As Usuario, FechaEnvio As DateTime, FechaActual As DateTime, Optional pCveCliente As Integer = -1) As JObject
|
||||
Dim ClientesSinEnviar As New JArray()
|
||||
Dim ClientesEdoEnviado As New JArray()
|
||||
|
||||
@@ -341,15 +399,13 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
New JProperty("Fecha", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))
|
||||
)
|
||||
Dim DTClientes As DataTable = Nothing
|
||||
Dim EnviarPendientes As Boolean = False
|
||||
|
||||
'Using ObjCliente As New ClsClientes
|
||||
' If ObjCliente.GetClientes(pCveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, TipoCliente:=-1, Estatus:=1) Then
|
||||
' If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
' DTClientes = ObjCliente.DtResultados.Copy()
|
||||
' End If
|
||||
' End If
|
||||
'End Using
|
||||
If FechaActual <> FechaEnvio Then
|
||||
EnviarPendientes = True
|
||||
End If
|
||||
|
||||
If Not EnviarPendientes Then
|
||||
Using ObjMov As New ClsMovimientos
|
||||
Dim FechaI As String = "-1"
|
||||
Dim FechaF As String = "-1"
|
||||
@@ -375,18 +431,63 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
|
||||
End Using
|
||||
End If
|
||||
|
||||
If DTClientes IsNot Nothing Then
|
||||
|
||||
If DTClientes IsNot Nothing OrElse EnviarPendientes Then
|
||||
|
||||
'DTClientes = DTClientes.FiltraParametros("CveCliente IN (227289,227429,227733,227838,228181,228544,229176,229481,230029,230432,230860,230911,230918,231197,231576,232173,232185,233055,233295,233357,233588,236379,236460,237161,237635,238285,238530,238622,238724,239033,239099,239865,239895,239903,240202,240235,240236,240238,240303,240340,262404,262517,264765,264806,264825,264848,264930,265063,265180,265213,265214,265236,265344,265492,265555,265669,265797,265952,265963,266156,266182,268346,268396,268488,268535,268539,268558,268562,268706,268726,268787,268868,268889,268910,268925,269023,269081,269089,272066,272070,272657,273080,273084,275627,276259,276587,281115,283110,284664,285392,287653,288711,291374,292444,295578,296375,296598,302728,303936,306897,307183,311007,320060,320685,320800,323520,323772,325237,326996,327801,330630,331741,332118,337105,340502,341796,342807,343858,355862,358123,365794,371524,375391,377122,377948,378267,380167,381210,381878,383098,383250,383339,383650,384472,385321,385585,386630,387114,388987,396341,396405,396541,401995,404175,408306,416386,416819,420275,438732,447566,447636,450284,464150,464376,468051,475172,475932,476984,477997,478426)")
|
||||
Dim DtNotificaciones As DataTable = Nothing
|
||||
|
||||
Dim TieneErrorRegistro As Boolean = False
|
||||
|
||||
Dim ObjMovimientos As New ClsMovimientos
|
||||
ObjMovimientos.IniciaTransacSQL()
|
||||
|
||||
If Not EnviarPendientes Then
|
||||
Try
|
||||
For Each RowCliente As DataRow In DTClientes.Rows
|
||||
If Not ObjMovimientos.AddNotificacionEdoCuentaCliente(RowCliente("CveCliente").ToString().ToEntero(), FechaEnvio) Then
|
||||
GuardaLog("Ocurrio un error al agregar las notificaciones de edo cuenta. CveCliente: " + RowCliente("CveCliente").ToString())
|
||||
TieneErrorRegistro = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
GuardaLog("Ocurrio un error al agregar las notificaciones de edo cuenta" + ex.ToString())
|
||||
TieneErrorRegistro = True
|
||||
End Try
|
||||
End If
|
||||
|
||||
Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero()
|
||||
If Not TieneErrorRegistro Then
|
||||
If ObjMovimientos.GetNotificacionEdoCuentaCliente(UsuarioActual.CveEmpresa, -1, FechaEnvio) Then
|
||||
DtNotificaciones = ObjMovimientos.DtResultados.Copy()
|
||||
Else
|
||||
TieneErrorRegistro = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If Not TieneErrorRegistro Then
|
||||
ObjMovimientos.Commit()
|
||||
Else
|
||||
ObjMovimientos.RollBack()
|
||||
If DtNotificaciones IsNot Nothing Then
|
||||
DtNotificaciones.Clear()
|
||||
DtNotificaciones = Nothing
|
||||
End If
|
||||
End If
|
||||
ObjMovimientos.Dispose()
|
||||
DTClientes.Dispose()
|
||||
|
||||
Try
|
||||
If DtNotificaciones IsNot Nothing Then
|
||||
For Each Row As DataRow In DtNotificaciones.Rows
|
||||
Dim CveCliente As Integer = Row("CveCliente").ToString().ToEntero()
|
||||
Dim Cliente As New Modelos.ClienteModel(CveCliente, UsuarioActual.CveEmpresa)
|
||||
|
||||
If Cliente IsNot Nothing Then
|
||||
Dim Correo As String = Cliente.CobranzaCorreo '"japmx95@gmail.com" 'RowCliente("CobranzaCorreo").ToString()
|
||||
Dim Correo As String = Cliente.CobranzaCorreo
|
||||
|
||||
Dim Envio As Boolean = False
|
||||
If Not String.IsNullOrEmpty(Correo) Then
|
||||
@@ -395,6 +496,10 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
If Envio Then
|
||||
|
||||
Using ObjMov As New ClsMovimientos
|
||||
ObjMov.UpdateNotificacionEdoCuentaCliente(Row("CveNotificacionBitacora").ToString().ToEntero(), Notifico:=True)
|
||||
End Using
|
||||
|
||||
ClientesEdoEnviado.Add(New JObject(
|
||||
New JProperty("CveCliente", Cliente.CveCliente),
|
||||
New JProperty("Cliente", Cliente.Nombre)
|
||||
@@ -410,9 +515,17 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
))
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
DTClientes.Dispose()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
GuardaLog("Ocurrio un error al agregar las notificaciones de edo cuenta. " + ex.ToString())
|
||||
End Try
|
||||
|
||||
If DtNotificaciones IsNot Nothing Then
|
||||
DtNotificaciones.Dispose()
|
||||
End If
|
||||
|
||||
End If
|
||||
Json.Add(New JProperty("ClientesSinEnviar", ClientesSinEnviar))
|
||||
Json.Add(New JProperty("ClientesEdoEnviado", ClientesEdoEnviado))
|
||||
@@ -422,7 +535,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
Private Function EnviarEstadoCuenta(UsuarioActual As Usuario, Correo As String, Cliente As Modelos.ClienteModel) As Boolean
|
||||
Dim Retorno As Boolean = True
|
||||
|
||||
Try
|
||||
Dim ArchivoPDF As Byte() = Nothing
|
||||
|
||||
Dim Formato As String = "PDF"
|
||||
@@ -465,7 +578,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
dtt = Nothing
|
||||
OnError("Ocurrió un erro al obtener el CxC", ex)
|
||||
GuardaLog("Ocurrió un erro al obtener el CxC. " + ex.ToString())
|
||||
End Try
|
||||
|
||||
If Not Retorno Then
|
||||
@@ -602,7 +715,8 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar MAIL de Orden de Compra", ex)
|
||||
ArchivoPDF = Nothing
|
||||
GuardaLog("Ocurrió un erro al obtener el CxC" + ex.ToString())
|
||||
End Try
|
||||
Else
|
||||
Dim lista = New List(Of CrystalParametro)
|
||||
@@ -653,7 +767,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el pdf", ex)
|
||||
GuardaLog("Ocurrió un error al generar el pdf" + ex.ToString())
|
||||
ArchivoPDF = Nothing
|
||||
End Try
|
||||
|
||||
@@ -668,16 +782,18 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
<br />
|
||||
<b>ESTE CORREO SE GENERO EN FORMA AUTOMATICA.</b>", Cliente.NombreComercial, UsuarioActual.Empresa.Empresa)
|
||||
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(ArchivoPDF, Correo, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo))
|
||||
Hilo.Start()
|
||||
Retorno = True
|
||||
Retorno = MandaCorreo(ArchivoPDF, Correo, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo)
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
OnError("Ocurrió error al mandar el correo de estado de cuenta", ex)
|
||||
GuardaLog("Ocurrió error al mandar el correo de estado de cuenta. " + ex.ToString())
|
||||
End Try
|
||||
Else
|
||||
Retorno = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
GuardaLog("Ocurrió error al mandar el correo de estado de cuenta" + ex.ToString())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
@@ -749,7 +865,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
Return Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=LSRutasMail)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el correo de edo cuenta", ex)
|
||||
GuardaLog("Ocurrió error al mandar el correo de estado de cuenta. " + ex.ToString())
|
||||
Return False
|
||||
End Try
|
||||
|
||||
@@ -780,4 +896,430 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "S C O R E C A R D"
|
||||
Private Sub CargaScoreCard(ByVal context As HttpContext, pCveEmpresa As Integer, FechaEnvio As DateTime)
|
||||
Dim Usuario = ValidaUsuarioSistema(pCveEmpresa)
|
||||
Dim obj = EjecutarEnvioScoreCard(Usuario, FechaEnvio)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function EjecutarEnvioScoreCard(UsuarioActual As Usuario, FechaEnvio As DateTime) As Boolean
|
||||
Dim DtGrupoVendedores As DataTable = Nothing
|
||||
Dim DtGrupoSucursales As DataTable = Nothing
|
||||
Dim DtGrupoEmpresa As DataTable = Nothing
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
'VENDEDORES
|
||||
If ObjVentas.GetRepMetasVendedores(FechaEnvio, UsuarioActual.CveEmpresa, -1, -1,
|
||||
-1, -1, -1,
|
||||
-1, -1, GrupoSuperior:=0) Then
|
||||
DtGrupoVendedores = ObjVentas.DtResultados.Copy
|
||||
End If
|
||||
'SUCURSAL
|
||||
If ObjVentas.GetRepMetasVendedores(FechaEnvio, UsuarioActual.CveEmpresa, -1, -1,
|
||||
-1, -1, -1,
|
||||
-1, -1, GrupoSuperior:=1) Then
|
||||
DtGrupoSucursales = ObjVentas.DtResultados.Copy
|
||||
End If
|
||||
'EMPRESA
|
||||
If ObjVentas.GetRepMetasVendedores(FechaEnvio, UsuarioActual.CveEmpresa, -1, -1,
|
||||
-1, -1, -1,
|
||||
-1, -1, GrupoSuperior:=2) Then
|
||||
DtGrupoEmpresa = ObjVentas.DtResultados.Copy
|
||||
End If
|
||||
End Using
|
||||
|
||||
Dim DtUsuarios As DataTable = GlobalDTUsuariosE140()
|
||||
|
||||
Dim ListaDirectivos As New List(Of MUsuarioEnviar)
|
||||
'OSCAR FERNANDO LOPEZ CARRASCO
|
||||
ListaDirectivos.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {2138}"), TipoUsuarioEnviar.Directivo) With
|
||||
{
|
||||
.SubProyecto = "Todos",
|
||||
.ReporteEnviar = New MReporteEnviar() With
|
||||
{
|
||||
.Empresa = True, .Sucursal = True, .Vendedor = True
|
||||
}
|
||||
})
|
||||
'ANA IVETTE LOPEZ CARRASCO
|
||||
ListaDirectivos.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {2292}"), TipoUsuarioEnviar.Directivo) With
|
||||
{
|
||||
.SubProyecto = "Todos",
|
||||
.ReporteEnviar = New MReporteEnviar() With
|
||||
{
|
||||
.Empresa = True, .Sucursal = True, .Vendedor = True
|
||||
}
|
||||
})
|
||||
'FERNANDO MENDOZA LAMADRID
|
||||
ListaDirectivos.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {2275}"), TipoUsuarioEnviar.Directivo) With
|
||||
{
|
||||
.SubProyecto = "Todos",
|
||||
.ReporteEnviar = New MReporteEnviar() With
|
||||
{
|
||||
.Empresa = True, .Sucursal = True, .Vendedor = True
|
||||
}
|
||||
})
|
||||
'CARLOS ARMANDO MORENO GONZALEZ
|
||||
ListaDirectivos.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {2763}"), TipoUsuarioEnviar.Directivo) With
|
||||
{
|
||||
.SubProyecto = "Todos",
|
||||
.ReporteEnviar = New MReporteEnviar() With
|
||||
{
|
||||
.Empresa = True, .Sucursal = True, .Vendedor = True
|
||||
}
|
||||
})
|
||||
'EMMANUEL LOPEZ FIMBRES
|
||||
ListaDirectivos.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3099}"), TipoUsuarioEnviar.Directivo) With
|
||||
{
|
||||
.SubProyecto = "Todos",
|
||||
.ReporteEnviar = New MReporteEnviar() With
|
||||
{
|
||||
.Empresa = True, .Sucursal = True, .Vendedor = True
|
||||
}
|
||||
})
|
||||
|
||||
Dim PDFEmpresa As Byte() = GenerarScoredCardDirectivo(UsuarioActual, DtGrupoEmpresa)
|
||||
Dim PDFSucursales As Byte() = GenerarScoredCardDirectivo(UsuarioActual, DtGrupoSucursales)
|
||||
Dim PDFVendedores As Byte() = GenerarScoredCardDirectivo(UsuarioActual, DtGrupoVendedores)
|
||||
|
||||
For Each UsuarioEnviar In ListaDirectivos
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
|
||||
If UsuarioEnviar.ReporteEnviar.Empresa Then
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With
|
||||
{
|
||||
.ArchivoBinario = PDFEmpresa,
|
||||
.NombreArchivo = "ScoreCardEmpresa.pdf"
|
||||
})
|
||||
End If
|
||||
|
||||
If UsuarioEnviar.ReporteEnviar.Sucursal Then
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With
|
||||
{
|
||||
.ArchivoBinario = PDFSucursales,
|
||||
.NombreArchivo = "ScoreCardSucursales.pdf"
|
||||
})
|
||||
End If
|
||||
|
||||
If UsuarioEnviar.ReporteEnviar.Vendedor Then
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With
|
||||
{
|
||||
.ArchivoBinario = PDFVendedores,
|
||||
.NombreArchivo = "ScoreCardVendedores.pdf"
|
||||
})
|
||||
End If
|
||||
|
||||
If LSRutasMail.Count > 0 Then
|
||||
EnviarCorreoFactura(UsuarioActual, UsuarioEnviar, LSRutasMail)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Dim ListaVendedores As New List(Of MUsuarioEnviar)
|
||||
'LUIS FERNADO GRIJALVA COTA
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3236} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'FERNANDO GRIJALVA
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3293} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'ADRIAN MURRIETA
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3352} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'BRAYAM URIEL CORRALES
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {2700} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'DANIEL GASTELUM
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3360} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'ALEJANDRA QUINTERO
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3336} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'RICARDO FUENTES
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3363} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
'GERMAN LUNA
|
||||
ListaVendedores.Add(New MUsuarioEnviar(DtUsuarios.FiltroPrimero($"CveUsuario = {3354} AND CveSubProyecto > 0"), TipoUsuarioEnviar.Vendedor))
|
||||
|
||||
For Each UsuarioEnviar In ListaVendedores
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
Dim DtReporteVendedor As DataTable = Nothing
|
||||
|
||||
If UsuarioEnviar.CveSubProyecto > 0 AndAlso UsuarioEnviar.CveVendedor > 0 Then
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetRepMetasVendedores(FechaEnvio, UsuarioActual.CveEmpresa, UsuarioEnviar.CveVendedor, -1,
|
||||
-1, -1, -1, UsuarioEnviar.CveSubProyecto, -1, GrupoSuperior:=1) Then
|
||||
DtReporteVendedor = ObjVentas.DtResultados.Copy
|
||||
End If
|
||||
End Using
|
||||
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With
|
||||
{
|
||||
.ArchivoBinario = GenerarScoredCard(UsuarioActual, UsuarioEnviar, DtReporteVendedor),
|
||||
.NombreArchivo = "ScoreCardSucursales.pdf"
|
||||
})
|
||||
|
||||
If LSRutasMail.Count > 0 Then
|
||||
EnviarCorreoFactura(UsuarioActual, UsuarioEnviar, LSRutasMail)
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Sub EnviarCorreoFactura(UsuarioActual As Usuario, UsuarioEnviar As MUsuarioEnviar, LSRutasMail As List(Of ClsSisMail.ArchivoMail))
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim Mail As String = "jonathan.perez@adssistemas.mx"
|
||||
Dim MailCC As String = "rene.molina@adssistemas.mx"
|
||||
|
||||
Dim ExistePDF As Boolean = False
|
||||
|
||||
If Not String.IsNullOrEmpty(Mail) Then
|
||||
Try
|
||||
Dim Asunto As String = $"ScoreCard: {Now.ToString("dd/MM/yyyy")}"
|
||||
Dim Cuerpo As String = String.Empty
|
||||
Dim ResultadoMail As Integer = 0
|
||||
|
||||
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Mail, Asunto, Cuerpo, If(String.IsNullOrEmpty(MailCC), "", MailCC), LSRutasMail) Then
|
||||
ResultadoMail = 1
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el Mail", ex)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Function GenerarScoredCard(UsuarioActual As Usuario, UsuarioEnviar As MUsuarioEnviar, DtDatos As DataTable) As Byte()
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("pImg", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("pImg", ""))
|
||||
End If
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
|
||||
params.Add(New ReportParameter("FechaImpresion", Today))
|
||||
params.Add(New ReportParameter("SubProyecto", UsuarioEnviar.SubProyecto))
|
||||
params.Add(New ReportParameter("Agente", UsuarioEnviar.Agente))
|
||||
|
||||
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim rds As New ReportDataSource
|
||||
rds.Name = "DataSet1"
|
||||
rds.Value = DtDatos
|
||||
lrds.Add(rds)
|
||||
|
||||
Return StreamPDF(UsuarioActual, "Empresas/Grales/Formatos/MetasVendedores.rdlc", lrds, params, "Rep. Metas por vendedores", "PDF")
|
||||
End Function
|
||||
|
||||
Protected Function GenerarScoredCardDirectivo(UsuarioActual As Usuario, DtDatos As DataTable) As Byte()
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("pImg", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("pImg", ""))
|
||||
End If
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
|
||||
params.Add(New ReportParameter("FechaImpresion", Today))
|
||||
params.Add(New ReportParameter("SubProyecto", "Todos"))
|
||||
params.Add(New ReportParameter("Agente", "Todos"))
|
||||
|
||||
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim rds As New ReportDataSource
|
||||
rds.Name = "DataSet1"
|
||||
rds.Value = DtDatos
|
||||
lrds.Add(rds)
|
||||
|
||||
Return StreamPDF(UsuarioActual, "Empresas/Grales/Formatos/MetasVendedores.rdlc", lrds, params, "Rep. Metas por vendedores", "PDF")
|
||||
End Function
|
||||
|
||||
Public Enum TipoUsuarioEnviar
|
||||
Directivo
|
||||
Vendedor
|
||||
End Enum
|
||||
|
||||
Public Class MUsuarioEnviar
|
||||
|
||||
Sub New(RowUsuario As DataRow, Tipo As TipoUsuarioEnviar)
|
||||
If RowUsuario IsNot Nothing Then
|
||||
Me.CveUsuario = RowUsuario("CveUsuario").ToString().ToEntero()
|
||||
Me.Nombre = RowUsuario("Nombre").ToString()
|
||||
Me.Correo = RowUsuario("Correo").ToString()
|
||||
Me.CveSubProyecto = RowUsuario("CveSubProyecto").ToString().ToEntero()
|
||||
Me.CveVendedor = RowUsuario("CveVendedor").ToString().ToEntero()
|
||||
Me.Tipo = Tipo
|
||||
|
||||
If Me.Tipo = TipoUsuarioEnviar.Vendedor Then
|
||||
Me.Agente = Me.Nombre
|
||||
Else
|
||||
Me.Agente = "Todos"
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(SubProyecto) AndAlso CveSubProyecto > 0 Then
|
||||
Me.SubProyecto = GlobalDTSubProyectosE140(-1, CveSubProyecto:=Me.CveSubProyecto).FiltroPrimeroValor("SubProyecto")
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Property CveUsuario As Integer
|
||||
Public Property Nombre As String
|
||||
Public Property Tipo As TipoUsuarioEnviar
|
||||
Public Property ReporteEnviar As MReporteEnviar
|
||||
Public Property CveSubProyecto As Integer
|
||||
Public Property SubProyecto As String
|
||||
Public Property Correo As String
|
||||
Public Property CveVendedor As Integer
|
||||
Public Property Agente As String
|
||||
|
||||
End Class
|
||||
|
||||
Public Class MReporteEnviar
|
||||
Public Property Empresa As Boolean = False
|
||||
Public Property Sucursal As Boolean = False
|
||||
Public Property Vendedor As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Function StreamPDF(UsuarioActual As Usuario, RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte()
|
||||
'limpio ReportViwer
|
||||
Dim sw As New System.Diagnostics.Stopwatch()
|
||||
sw.Start()
|
||||
Dim Bytes As Byte() = Nothing
|
||||
|
||||
Dim CveUsuario As Integer = 0
|
||||
Dim CveEmpresa As Integer = 0
|
||||
Dim RutaEmpresa As String = ""
|
||||
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
CveUsuario = UsuarioActual.CveUsuario
|
||||
CveEmpresa = UsuarioActual.CveEmpresa
|
||||
RutaEmpresa = UsuarioActual.Empresa.RutaArchivos
|
||||
End If
|
||||
|
||||
Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory)
|
||||
|
||||
'TOMAR LA RUTA BASE PARA EL DIRECTORIO DE LA EMPRESA
|
||||
If Not String.IsNullOrEmpty(RutaEmpresa) AndAlso Not RutaReporte.Contains("Grales") Then
|
||||
bdir = RutaEmpresa.Replace($"{CveEmpresa}/", "")
|
||||
End If
|
||||
|
||||
RutaReporte.Replace("/", "\")
|
||||
|
||||
If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then
|
||||
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
|
||||
End If
|
||||
|
||||
Dim EsProduccion As Boolean = UsuarioActual.Empresa.FacturaProduccion
|
||||
|
||||
If EsProduccion Then
|
||||
|
||||
Dim wsreport As New WSRDLC.WebServiceSoapClient
|
||||
Dim params As New List(Of WSRDLC.ReportParameter)
|
||||
Dim ds As New DataSet
|
||||
For Each rpds As ReportDataSource In DataSource
|
||||
Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable)
|
||||
If dt Is Nothing Then
|
||||
dt = New DataTable()
|
||||
Else
|
||||
dt = dt.Copy()
|
||||
End If
|
||||
dt.TableName = rpds.Name
|
||||
ds.Tables.Add(dt)
|
||||
Next
|
||||
For Each rpds As ReportParameter In Parametros
|
||||
Dim param As New WSRDLC.ReportParameter
|
||||
param.Name = rpds.Name
|
||||
param.Values = {rpds.Values(0)}
|
||||
params.Add(param)
|
||||
Next
|
||||
Bytes = wsreport.StreamPDFBytes(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
|
||||
wsreport = Nothing
|
||||
params = Nothing
|
||||
ds.Dispose() : ds = Nothing
|
||||
Else
|
||||
If IsNothing(MR) Then MR = New ReportViewer
|
||||
Try
|
||||
' MasterReporteador.LocalReport.DataSources.Clear()
|
||||
For Each RDS As ReportDataSource In DataSource
|
||||
MR.LocalReport.DataSources.Add(RDS)
|
||||
Next
|
||||
|
||||
MR.LocalReport.ReportPath = RutaReporte
|
||||
MR.ProcessingMode = ProcessingMode.Local
|
||||
MR.LocalReport.EnableExternalImages = True
|
||||
MR.LocalReport.SetParameters(Parametros)
|
||||
MR.LocalReport.Refresh()
|
||||
Dim Warnings As Warning() = Nothing
|
||||
Dim StreamIds As String() = Nothing
|
||||
Dim MimeType As String = Nothing
|
||||
Dim Encoding As String = Nothing
|
||||
Dim Extension As String = Nothing
|
||||
Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings)
|
||||
Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
|
||||
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
Catch ex As Exception
|
||||
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
End Try
|
||||
MR.Dispose()
|
||||
MR = Nothing
|
||||
'Dim ruta = wsreport.StreamPDF(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
|
||||
'If File.Exists(ruta) Then
|
||||
' Bytes = File.ReadAllBytes(ruta)
|
||||
' File.Delete(ruta)
|
||||
'End If
|
||||
'Dim setup As AppDomainSetup = New AppDomainSetup
|
||||
'With setup
|
||||
' .ApplicationBase = Environment.CurrentDirectory
|
||||
' .LoaderOptimization = LoaderOptimization.MultiDomainHost
|
||||
'End With
|
||||
'setup.SetCompatibilitySwitches({"NetFx40_LegacySecurityPolicy"})
|
||||
'Dim _casPolicyEnabledDomain As AppDomain = AppDomain.CreateDomain("Full Trust", Nothing, setup)
|
||||
'Dim fllreport As ADSReportLib.FullTrustReportviewer = Nothing
|
||||
'Try
|
||||
|
||||
' fllreport = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(ADSReportLib.FullTrustReportviewer).Assembly.CodeBase, GetType(ADSReportLib.FullTrustReportviewer).FullName), ADSReportLib.FullTrustReportviewer)
|
||||
|
||||
' fllreport.Initialize("DisplayName", RutaReporte, Parametros.AsEnumerable(), New List(Of String()), True)
|
||||
' For Each RDS As ReportDataSource In DataSource
|
||||
' fllreport.AddDataSources(RDS.Name, DirectCast(RDS.Value, DataTable))
|
||||
' Next
|
||||
' Dim Warnings As Warning() = Nothing
|
||||
' Dim StreamIds As String() = Nothing
|
||||
' Dim MimeType As String = Nothing
|
||||
' Dim Encoding As String = Nothing
|
||||
' Dim Extension As String = Nothing
|
||||
' Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds)
|
||||
' fllreport = Nothing
|
||||
'Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
|
||||
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
' 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
'Catch ex As Exception
|
||||
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
' 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
'Finally
|
||||
' AppDomain.Unload(_casPolicyEnabledDomain)
|
||||
'End Try
|
||||
'If fllreport IsNot Nothing Then fllreport.liberarecursos()
|
||||
|
||||
End If
|
||||
sw.Stop()
|
||||
|
||||
If sw.Elapsed.TotalSeconds > 5 Then
|
||||
GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ")
|
||||
End If
|
||||
|
||||
Return Bytes
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -736,6 +736,7 @@ public partial class General_PopUpPaqueteriasGuias : ClsPaginas
|
||||
|
||||
}
|
||||
}
|
||||
ObjVentas.Dispose();
|
||||
}
|
||||
|
||||
private string DocumentoEntregaInterna()
|
||||
@@ -849,7 +850,6 @@ public partial class General_PopUpPaqueteriasGuias : ClsPaginas
|
||||
|
||||
private void MandaCorreoNotificacionGuia(string Correos)
|
||||
{
|
||||
Correos.GuardaLog();
|
||||
|
||||
string body = DocumentoEntregaInterna();
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
|
||||
If Request("CveMovimiento") IsNot Nothing AndAlso Request("CveMovimiento").ToString.ToEntero > 0 Then
|
||||
If UsuarioActual.CveUsuario = 100 AndAlso UsuarioActual.CveEmpresa = 140 Then
|
||||
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.CveEmpresa = 140 Then
|
||||
LnkGenerarVirtual.Visible = True
|
||||
End If
|
||||
|
||||
|
||||
@@ -2062,7 +2062,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString().ToEntero(), Dr1("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr1("Serie").ToString(), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1)) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString().ToEntero(), Dr1("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr1("Serie").ToString(), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-1) Then
|
||||
Dim CveSeccionAlmacen As Integer = 0
|
||||
For Each Dr2 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows
|
||||
|
||||
@@ -2120,7 +2120,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString().ToEntero(), Dr1("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString(), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1)) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString().ToEntero(), Dr1("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString(), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), CveSeccionAlmacen:=-1) Then
|
||||
|
||||
CantidadSaldo = Dr("CantidadGV").ToString().ToDecimal
|
||||
|
||||
@@ -2171,7 +2171,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
Else
|
||||
|
||||
If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1)) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-1) Then
|
||||
|
||||
CantidadSaldo = Dr("CantidadGV").ToString().ToDecimal
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public partial class Inventarios_RepTraspasoEmitido : ClsPaginas
|
||||
}
|
||||
|
||||
protected void LnkCancelarTraspaso_Click(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
GridViewRow Gvr = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
Timbrado ObjCancelacion = new Timbrado();
|
||||
DateTime CancelacionFecha=MinFecha;
|
||||
|
||||
@@ -6921,27 +6921,29 @@ Partial Class OC
|
||||
Dim tmpDTPS As DataTable = DtDetalle
|
||||
Dim DTAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($" CveTipoAlmacen IN (1,9) ") 'AND CveSucursal = {CveSucursal}")
|
||||
Dim objInv As New ClsInventarios
|
||||
Dim consulta As New StringBuilder
|
||||
'Dim consulta As New StringBuilder
|
||||
|
||||
|
||||
consulta.Append(" ")
|
||||
consulta.Append(" DECLARE @TEMP TABLE (CvePS INT, CveSubProyecto INT);")
|
||||
For Each row As DataRow In tmpDTPS.Rows
|
||||
consulta.AppendFormat("INSERT INTO @TEMP VALUES ({0},{1});", row("CvePS"), row("CveSubProyecto"))
|
||||
Next
|
||||
consulta.Append(" SELECT CASE WHEN LEN (ISNULL (P.Codigo, '')) = 0 THEN P.PS ELSE CONCAT( P.Codigo, ' - ', P.PS) END AS Producto, SUM(OCPR.Cantidad) AS [Por Recibir] ")
|
||||
For Each row As DataRow In DTAlmacen.Rows
|
||||
consulta.AppendFormat(" ,SUM(CASE WHEN CS.CveAlmacen={0} THEN CS.Existencia - ISNULL(INV.Cantidad,0) ELSE 0 END) AS [{1}] ", row("CveAlmacen"), row("Almacen"))
|
||||
Next
|
||||
consulta.Append(" FROM @TEMP T ")
|
||||
consulta.Append(" INNER JOIN [ProductosServicios] P ON P.CvePS = T.CvePS ")
|
||||
consulta.Append(" LEFT JOIN [Inv_ExistenciasProductos] CS ON P.CvePS = CS.CvePS ")
|
||||
consulta.Append(" LEFT JOIN Vw_InventarioPorSurtir INV ON INV.CvePS = P.CvePS AND INV.CveAlmacen = CS.CveAlmacen ")
|
||||
consulta.Append(" LEFT JOIN Vw_OC_PorRecibir OCPR ON OCPR.CvePS = P.CvePS AND OCPR.CveAlmacen = CS.CveAlmacen AND OCPR.CveSubProyecto = T.CveSubProyecto")
|
||||
consulta.Append(" WHERE P.CveTipoPS = 2")
|
||||
consulta.Append(" GROUP BY P.CvePS,P.Codigo,P.PS")
|
||||
'consulta.Append(" ")
|
||||
'consulta.Append(" DECLARE @TEMP TABLE (CvePS INT, CveSubProyecto INT);")
|
||||
'For Each row As DataRow In tmpDTPS.Rows
|
||||
' consulta.AppendFormat("INSERT INTO @TEMP VALUES ({0},{1});", row("CvePS"), row("CveSubProyecto"))
|
||||
'Next
|
||||
'consulta.Append(" SELECT CASE WHEN LEN (ISNULL (P.Codigo, '')) = 0 THEN P.PS ELSE CONCAT( P.Codigo, ' - ', P.PS) END AS Producto, SUM(OCPR.Cantidad) AS [Por Recibir] ")
|
||||
'For Each row As DataRow In DTAlmacen.Rows
|
||||
' consulta.AppendFormat(" ,SUM(CASE WHEN CS.CveAlmacen={0} THEN CS.Existencia - ISNULL(INV.Cantidad,0) ELSE 0 END) AS [{1}] ", row("CveAlmacen"), row("Almacen"))
|
||||
'Next
|
||||
'consulta.Append(" FROM @TEMP T ")
|
||||
'consulta.Append(" INNER JOIN [ProductosServicios] P ON P.CvePS = T.CvePS ")
|
||||
'consulta.Append(" LEFT JOIN [Inv_ExistenciasProductos] CS ON P.CvePS = CS.CvePS ")
|
||||
'consulta.Append(" LEFT JOIN Vw_InventarioPorSurtir INV ON INV.CvePS = P.CvePS AND INV.CveAlmacen = CS.CveAlmacen ")
|
||||
'consulta.Append(" LEFT JOIN Vw_OC_PorRecibir OCPR ON OCPR.CvePS = P.CvePS AND OCPR.CveAlmacen = CS.CveAlmacen AND OCPR.CveSubProyecto = T.CveSubProyecto")
|
||||
'consulta.Append(" WHERE P.CveTipoPS = 2")
|
||||
'consulta.Append(" GROUP BY P.CvePS,P.Codigo,P.PS")
|
||||
|
||||
objInv.GetQuery(consulta.ToString())
|
||||
'objInv.GetQuery(consulta.ToString())
|
||||
|
||||
objInv.GetExistenciasAlmacenDT(CveOrdenCompra, UsuarioActual.CveEmpresa)
|
||||
|
||||
' limpio los almacenes donde no tiene ningun producto existencia
|
||||
For i = objInv.DtResultados.Columns.Count - 1 To 1 Step -1
|
||||
|
||||
@@ -3654,7 +3654,7 @@ Partial Class Ventas
|
||||
|
||||
'VALIDA EXISTENCIAS DE ALMACÉN
|
||||
'Dim DrPS = GlobalDTProductosServicios(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero()).FiltroPrimero("")
|
||||
Dim DrPS = GlobalDTPS(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero()).FiltroPrimero("")
|
||||
Dim DrPS = GlobalDTPSSimplificado(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero()).FiltroPrimero("")
|
||||
|
||||
If DrPS IsNot Nothing Then
|
||||
Dim CveTipoPS As Integer = DrPS("CveTipoPS").ToString().ToEntero()
|
||||
@@ -6364,12 +6364,18 @@ Partial Class Ventas
|
||||
Else
|
||||
' el cliente tiene crédito disponible, no tiene bloqueo
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
|
||||
Dim EsCotizacion As Boolean = False
|
||||
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
|
||||
EsCotizacion = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar
|
||||
If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar
|
||||
|
||||
DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
|
||||
|
||||
If EsCotizacion Then
|
||||
DdlTipoComprobante.SelectedValueExistInsert("Cot", "Cotización")
|
||||
End If
|
||||
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
|
||||
End If
|
||||
|
||||
@@ -7124,6 +7130,10 @@ Partial Class Ventas
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").ToolTip = "No se puede editar el descuento porque viene de una promoción"
|
||||
End If
|
||||
|
||||
If Me.CveVenta > 0 AndAlso UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot") Then
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
|
||||
GvPS.EditIndex = -1
|
||||
@@ -19328,7 +19338,10 @@ Partial Class Ventas
|
||||
'COMIENZA: VENTADETALLE
|
||||
'CUANDO SEA SALIDA VA POR LA VENTA DETALLE DE LA FACTURA DE LA REMISION - OJO!! SOLO FUNCIONA HASTA ORITA QUE SE HACE SALIDA SOLO CUANDO SE FACTURA LA REMISION
|
||||
Dim CveVentaDetalle = If(ConceptoEntrada.Contiene(3, 40), TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero(), MovDet("CveVentaDetalle").ToString().ToEntero())
|
||||
Dim CveVentaDetallePadre As Integer = -1
|
||||
Dim CveVentaDetalleRemision As Integer = -1
|
||||
If ConceptoEntrada = 40 AndAlso MovDet("CveVentaDetalle").ToString().ToEntero() > 0 Then
|
||||
CveVentaDetalleRemision = MovDet("CveVentaDetalle").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
'If ConceptoEntrada = 3 Then
|
||||
' CveVentaDetalle = TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero()
|
||||
@@ -19365,7 +19378,7 @@ Partial Class Ventas
|
||||
CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, CveVentaDetallePadre:=CveVentaDetallePadre) Then
|
||||
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, CveVentaDetalleRemision:=CveVentaDetalleRemision) Then
|
||||
ContadorMovtosDetalles += 1
|
||||
Else
|
||||
OcurrioError = True
|
||||
|
||||
Reference in New Issue
Block a user