From d9c953e6cb2e899ce11e0e435a2f23a9ec566088 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 2 Jun 2020 19:14:49 -0700 Subject: [PATCH] - --- Inventarios/EntregaAlmacen.aspx.vb | 131 ++++++++++++++++++-------- Inventarios/ResguardoMaterial.aspx.vb | 47 +-------- Ventas/Ventas.aspx | 13 +-- 3 files changed, 100 insertions(+), 91 deletions(-) diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 97d147928..7f6dcafec 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -5,13 +5,14 @@ Imports System.Data Imports System.IO Imports System.Linq Imports CrystalDecisions.[Shared].Json +Imports ExcelLibrary.BinaryFileFormat Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Inventarios_EntregaAlmacen - Inherits ClsPaginas - + Inherits ClsPaginas + #Region "PROPIEDADES" Private Property CveVentaAD As Integer Get @@ -245,10 +246,10 @@ Partial Class Inventarios_EntregaAlmacen Set(value As Boolean) ViewState("EsDevolucionDirecta") = value End Set - End Property - + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -256,9 +257,9 @@ Partial Class Inventarios_EntregaAlmacen CargaParametrosAD() If UsuarioActual.CveEmpresa.Contiene(72, 80) Then DdlAlmacen.AutoPostBack = True End If - End Sub - - + End Sub + + #Region " INICIALIZA VALORES " Private Sub InicializaValores() TipoEstatus = -1 @@ -326,11 +327,11 @@ Partial Class Inventarios_EntregaAlmacen LimpiaCampos() - End Sub - + End Sub + #End Region - - + + #Region " CARGA PARAMETROS - EXCLUSIVO USO AD " Private Sub CargaParametrosAD() @@ -348,9 +349,9 @@ Partial Class Inventarios_EntregaAlmacen BtnGuardar.Visible = False End If - End Sub + End Sub #End Region - + #Region " CARGA PENDIENTES POR SURTIR " Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) CargaFolios() @@ -468,11 +469,11 @@ Partial Class Inventarios_EntregaAlmacen End Select UpPendientes.Update() End If - End Sub - + End Sub + #End Region - - + + #Region " CARGA VENTA POR SURTIR " Protected Sub BtnSurtir_Click(sender As Object, e As EventArgs) @@ -918,14 +919,14 @@ Partial Class Inventarios_EntregaAlmacen End If objInv.Dispose() GvDocs.DataBind() - End Sub - - + End Sub + + #End Region - - + + #Region " AGREGAR " - + Protected Sub BtnSerie_Click(sender As Object, e As EventArgs) Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) @@ -952,10 +953,10 @@ Partial Class Inventarios_EntregaAlmacen UpLoteBatch.Update() End If - End Sub - + End Sub + #Region " AGREGA POR SERIE/LOTE " - + Private Sub CreaDtDetalle() If DtDatosDetalle Is Nothing Then DtDatosDetalle = New DataTable @@ -1160,11 +1161,11 @@ Partial Class Inventarios_EntregaAlmacen DtDatosDetalle.AcceptChanges() CargaSerie() - End Sub + End Sub #End Region - + #Region " AGREGA CON LOTE BATCH " - + Private Sub CreaDtDetalleLote() If DtDatosDetalleLote Is Nothing Then DtDatosDetalleLote = New DataTable @@ -1352,9 +1353,9 @@ Partial Class Inventarios_EntregaAlmacen End Try DtDatosDetalleLote.AcceptChanges() CargaLote() - End Sub + End Sub #End Region - + #Region " AGREGA CON TXT | CODIGO - SERIE " Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) @@ -1488,12 +1489,12 @@ Partial Class Inventarios_EntregaAlmacen End If TxtCantidadEspecialDiv.Text = "1" - End Sub + End Sub #End Region - + #End Region - - + + #Region " GUARDAR " Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) @@ -2423,12 +2424,17 @@ Partial Class Inventarios_EntregaAlmacen Dim FechaEstimada As String = If(TxtFechaEstimada.Text = "", "-1", TxtFechaEstimada.Text) Dim NoCajas As Integer = TxtNoCajas.Text.ToEntero() Dim Observaciones As String = TxtObservacionesPaqInterna.Text - Dim CvePaqueteriaGuia As Integer = ObjGeneral.AddPaqueteriasGuias(-1, -1, CveEstatus, CveSubProyecto, Fecha, "-1", "-1", NoCajas, 0.00, "-1", FechaEstimada, Observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, EsEntregaInterna:=True) + Dim CvePaqueteriaGuia As Integer = ObjGeneral.AddPaqueteriasGuias(-1, 9, CveEstatus, CveSubProyecto, Fecha, "-1", "-1", NoCajas, 0.00, "-1", FechaEstimada, Observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, EsEntregaInterna:=True) If CvePaqueteriaGuia > 0 Then If CveVentaSurtir > 0 OrElse CveSubProyecto > 0 Then - ErrorMovInv = Not ObjGeneral.AddPaqueteriasGuiasDetalles(CvePaqueteriaGuia, CveVentaSurtir, -1, CveMovimiento, -1) + If ObjGeneral.AddPaqueteriasGuiasDetalles(CvePaqueteriaGuia, CveVentaSurtir, -1, CveMovimiento, -1) Then + ''manda correo + MandaCorreoEntrega(CveVentaSurtir) + Else + ErrorMovInv = True + End If End If If ErrorMovInv Then Alert("Error en el paqueteria guia detalle", TipoMensaje.MsgError) @@ -2755,6 +2761,53 @@ Partial Class Inventarios_EntregaAlmacen End Sub + + Private Sub MandaCorreoEntrega(tCveVenta As Integer) + Dim Correo As New ClsSisMail() + Dim SerieFolio As String = "" + Dim Asunto As String = String.Format("{0} Envio de pedido: {1}", UsuarioActual.Empresa.NombreCorto, SerieFolio) + Dim Cuerpo As New StringBuilder() + Dim Destinatario As String = "" + Dim MensajeEnviado = False + Dim tCvecliente As Integer + + + Dim ObjVentas As New ClsVentas() + + If (ObjVentas.GetVenta(tCveVenta, UsuarioActual.CveEmpresa)) Then + Dim dr As DataRow = ObjVentas.DtResultados.FiltroPrimero("") + Destinatario = String.Format("{0};{1}", dr("CorreoNotificacion"), dr("CorreoVendedorVenta")) + + tCvecliente = dr("CveCliente").ToString.ToEntero + + Dim drC As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=tCvecliente).FiltroPrimero("") + Destinatario += String.Format("{0};{1}", drC("CorreoEntregaCompras"), drC("CorreoEntregaAlmacen")) + + Cuerpo.AppendLine(String.Format("Estimado {0} le informamos que los productos de la factura {1} han sido enviados a entrega.

", dr("NombreCliente"), dr("SerieFolio"))) + Cuerpo.AppendLine("

Dudas y aclaraciones con su coordinador empresarial.") + + End If + ObjVentas.Dispose() + + + ' Dim ArchivoAdjunto As New ClsSisMail.ArchivoMail() + + 'Dim ListaAdjuntos As New List(ClsSisMail.ArchivoMail) + + + 'If (File.Exists(RutaArchivoAdjunto))Then + ' { + ' ArchivoAdjunto.ArchivoBinario = File.ReadAllBytes(RutaArchivoAdjunto); + ' ArchivoAdjunto.Ruta = RutaArchivoAdjunto; + ' ArchivoAdjunto.NombreArchivo = new FileInfo(RutaArchivoAdjunto).Name; + ' ListaAdjuntos.Add(ArchivoAdjunto); + ' } + + + MensajeEnviado = Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) + + + End Sub Private Sub Limpia() 'DATOS DE LA VENTA @@ -3051,7 +3104,7 @@ Partial Class Inventarios_EntregaAlmacen If fi.Exists() Then linkDescarga = $"/Empresas/{UsuarioActual.CveEmpresa}/Documentacion/ventas/{fi.Name}" ImgDownLoad.Visible = True - ImgDownLoad.Text = String.Format(" ", linkDescarga) + ImgDownLoad.Text = String.Format(" ", linkDescarga) End If diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index 9aabeb893..f6173c7ed 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -84,22 +84,6 @@ Partial Class Inventarios_ResguardoMaterial End Property - Private Property DtSeccionAlmacen As DataTable - Get - Return CType(ViewState("DtSeccionAlmacen"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSeccionAlmacen") = value - End Set - End Property - Private Property IndexSeccionAlmacen As Integer - Get - Return CType(ViewState("IndexSeccionAlmacen"), Integer) - End Get - Set(value As Integer) - ViewState("IndexSeccionAlmacen") = value - End Set - End Property Private Property CantidadTotal As Decimal Get Return CType(ViewState("CantidadTotal"), Decimal) @@ -174,7 +158,6 @@ Partial Class Inventarios_ResguardoMaterial GvM.DataBind() CantidadTotal = 0 - IndexSeccionAlmacen = 0 CvePS = 0 TipoSeccionAlmacen = 0 @@ -379,7 +362,7 @@ Partial Class Inventarios_ResguardoMaterial #End Region -#Region " EISTENCIAS " +#Region " EXISTENCIAS " Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional Serie As String = "-1") As Double Dim Inv As New ClsInventarios Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie) @@ -481,10 +464,10 @@ Partial Class Inventarios_ResguardoMaterial Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then - If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then - e.Row.FCLinkButton("lnkRemove").Visible = False - e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" - End If + 'If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then + ' e.Row.FCLinkButton("lnkRemove").Visible = False + ' e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" + 'End If End If End Sub #End Region @@ -502,7 +485,6 @@ Partial Class Inventarios_ResguardoMaterial DdlAlmacen.SelectedValueExist("-1") DdlAlmacenDestino.SelectedValueExist("-1") - DtSeccionAlmacen.Rows.Clear() TxtObservaciones.Text = "" TxtFecha.Text = Now.ToShortDateString @@ -595,8 +577,6 @@ Partial Class Inventarios_ResguardoMaterial FechaLiberacion = TxtFechaLiberacion.Text BtnGuardarLiberacion.Visible = True - DtSeccionAlmacen.Rows.Clear() - UpGeneralesLibreacion.Update() Else Alert("Ocurrió un error al cargar los resguardos del personal. Por favor vuelva a intentar.", TipoMensaje.MsgError) @@ -633,8 +613,6 @@ Partial Class Inventarios_ResguardoMaterial LbFechaLiberacion.Text = "" FechaLiberacion = "" BtnGuardarLiberacion.Visible = False - DtSeccionAlmacen.Rows.Clear() - DdlAlmacenDestinoLiberacion.SelectedValue = "-1" TxtObservacionesLiberacion.Text = "" @@ -685,14 +663,6 @@ Partial Class Inventarios_ResguardoMaterial Alert(TextoExistencia.ToString, TipoMensaje.MsgError) End If - Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad") - If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then - If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then - Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If - Guardar(23) End Sub @@ -724,13 +694,6 @@ Partial Class Inventarios_ResguardoMaterial Exit Sub End If - If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then - If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then - Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If - Guardar(24) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 6dd529d64..97b534794 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3259,14 +3259,7 @@ - - - Correo Notificaciones:  - - - - - + Orden de Compra:   @@ -3294,10 +3287,10 @@ Kilometraje  - + Correo Notificaciones:  - +