3 BUG de envio de correos, historial de venta etiqueta en correos y texto adicional
This commit is contained in:
@@ -4838,7 +4838,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header ">
|
<div class="modal-header ">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">Correo</h4>
|
<h4 class="modal-title">Envio de Correo</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<asp:UpdatePanel ID="UpSendMail" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpSendMail" runat="server" UpdateMode="Conditional">
|
||||||
|
|||||||
@@ -2289,6 +2289,8 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -2307,6 +2309,10 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -2327,6 +2333,10 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -2344,6 +2354,8 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -2354,7 +2366,7 @@ Partial Class Clientes
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Cuerpo = $"{Cuerpo} <br> {TxtBody.Text}"
|
||||||
|
|
||||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
||||||
Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf"
|
Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf"
|
||||||
@@ -5751,6 +5763,10 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -5769,6 +5785,8 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -5789,6 +5807,8 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -5807,6 +5827,8 @@ Partial Class Clientes
|
|||||||
If Dr IsNot Nothing Then
|
If Dr IsNot Nothing Then
|
||||||
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
@@ -5819,7 +5841,7 @@ Partial Class Clientes
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Cuerpo = $"{Cuerpo}<br>{TxtBody2.Text}"
|
||||||
|
|
||||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then
|
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then
|
||||||
If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml") Then
|
If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml") Then
|
||||||
|
|||||||
@@ -417,6 +417,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LbVerificarExistencia" Visible="false" runat="server"><i class='fa fa-list-alt'></i>Verificar Existencias</asp:LinkButton>
|
<asp:LinkButton ID="LbVerificarExistencia" Visible="false" runat="server"><i class='fa fa-list-alt'></i>Verificar Existencias</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LnkEnvioDeCorreoFactura" runat="server" CausesValidation="False" OnClick="LnkEnvioDeCorreoFactura_Click" Visible="false" > <i class="fa fa-envelope-o" aria-hidden="true"></i> Envio De Correo</asp:LinkButton>
|
||||||
|
</li>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
<Triggers>
|
<Triggers>
|
||||||
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
|
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
|
||||||
@@ -9319,6 +9322,64 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="ModalDivMailFactura" class="modal ADS fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header ">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">Envio de Correo</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<asp:UpdatePanel ID="UpSendMailFactura" runat="server" UpdateMode="Conditional">
|
||||||
|
<ContentTemplate>
|
||||||
|
<asp:HiddenField ID="HdnCveVentaFactura" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<asp:HiddenField ID="HdnFolioVenta" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<asp:HiddenField ID="HdnTipoDocto" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<asp:HiddenField ID="HdnSerieFolio" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<asp:HiddenField ID="HdnSubProyecto" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<asp:HiddenField ID="HiddenField2" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">Para:</div>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<asp:TextBox ID="TxtParaMailFactura" runat="server" Width="370px" CssClass="form-control" ClientIDMode="Static"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">
|
||||||
|
Con copia para:<br />
|
||||||
|
(Separar con: ;)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<asp:TextBox ID="TxtCCFactura" runat="server" TextMode="MultiLine" Columns="3" Rows="3" CssClass="form-control"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">Texto Adicional:</div>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<asp:TextBox ID="TxtBodyFactura" runat="server" TextMode="MultiLine" Columns="3" Rows="3" CssClass="form-control"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<asp:UpdatePanel runat="server">
|
||||||
|
<ContentTemplate>
|
||||||
|
<asp:Button ID="BtnSendMailFactura" Text="Enviar" runat="server" ClientIDMode="Static" CssClass="btn btn-primary" OnClick="BtnSendMailFactura_Click" />
|
||||||
|
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||||
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
|
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
|
||||||
|
|||||||
@@ -2103,6 +2103,23 @@ Partial Class Ventas
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Property CobranzaCorreo As String
|
||||||
|
Get
|
||||||
|
If ViewState("CobranzaCorreo") Is Nothing Then
|
||||||
|
ViewState("CobranzaCorreo") = ""
|
||||||
|
End If
|
||||||
|
Return ViewState("CobranzaCorreo").ToString
|
||||||
|
End Get
|
||||||
|
Set(value As String)
|
||||||
|
ViewState("CobranzaCorreo") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Private Property VentaDesglosaIEPS As Boolean
|
Private Property VentaDesglosaIEPS As Boolean
|
||||||
Get
|
Get
|
||||||
Return CBool(IfNull(ViewState("VentaDesglosaIEPS"), "False", ViewState("VentaDesglosaIEPS")))
|
Return CBool(IfNull(ViewState("VentaDesglosaIEPS"), "False", ViewState("VentaDesglosaIEPS")))
|
||||||
@@ -2976,6 +2993,8 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
LnkEnvioDeCorreoFactura.Visible = True
|
||||||
|
|
||||||
Else
|
Else
|
||||||
TxtFechaOS.Text = NowADS().ToDateTime.ToString("yyyy-MM-dd HH:mm").Replace(" ", "T")
|
TxtFechaOS.Text = NowADS().ToDateTime.ToString("yyyy-MM-dd HH:mm").Replace(" ", "T")
|
||||||
|
|
||||||
@@ -6910,7 +6929,7 @@ Partial Class Ventas
|
|||||||
EnviarCorreoCliente = ObjCliente.EnviarFactura
|
EnviarCorreoCliente = ObjCliente.EnviarFactura
|
||||||
EstatusCliente = ObjCliente.Estatus
|
EstatusCliente = ObjCliente.Estatus
|
||||||
EsFilial = ObjCliente.EsFilial
|
EsFilial = ObjCliente.EsFilial
|
||||||
|
CobranzaCorreo = ObjCliente.CobranzaCorreo
|
||||||
Me.PermiteCredito = ObjCliente.PermiteCredito
|
Me.PermiteCredito = ObjCliente.PermiteCredito
|
||||||
LnkAgregarCliente.Visible = False
|
LnkAgregarCliente.Visible = False
|
||||||
|
|
||||||
@@ -40875,5 +40894,256 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Protected Sub LnkEnvioDeCorreoFactura_Click(sender As Object, e As EventArgs)
|
||||||
|
'HdnSerieFolioPago.Value = gvRow.DataKey("SerieFolioCP").ToString()
|
||||||
|
TxtParaMailFactura.Text = CobranzaCorreo
|
||||||
|
HdnSerieFolio.Value = If(ViewState("Serie").ToString.Trim.Length > 0, $"{ViewState("Serie").ToString}-{ViewState("Folio").ToString}", ViewState("Folio").ToString)
|
||||||
|
HdnFolioVenta.Value = If(ViewState("Serie").ToString.Trim.Length > 0, $"{ViewState("Serie").ToString}-{ViewState("Folio").ToString}", ViewState("Folio").ToString)
|
||||||
|
HdnTipoDocto.Value = DdlTipoComprobante.SelectedValue
|
||||||
|
HdnCveVentaFactura.Value = CveVenta.ToString
|
||||||
|
|
||||||
|
UpSendMailFactura.Update()
|
||||||
|
RegistraScript("$('#ModalDivMailFactura').modal();")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub BtnSendMailFactura_Click(sender As Object, e As EventArgs)
|
||||||
|
Try
|
||||||
|
|
||||||
|
If HdnCveVentaFactura.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then
|
||||||
|
|
||||||
|
Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, HdnTipoDocto.Value, HdnFolioVenta.Value)
|
||||||
|
'REGENERAR EL PDF
|
||||||
|
If Not File.Exists(ArchivoPDF) Then
|
||||||
|
Try
|
||||||
|
GenerarPDFVenta(HdnCveVentaFactura.Value.ToEntero(), AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ObjMail As New ClsSisMail()
|
||||||
|
Dim Ruta As String = UsuarioActual.Empresa.Ruta
|
||||||
|
|
||||||
|
Dim Cuerpo As String = TxtBodyFactura.Text
|
||||||
|
Dim Asunto As String = ""
|
||||||
|
Dim TipoComprobante As String = ""
|
||||||
|
Dim Adjunto As String = ""
|
||||||
|
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Ing" Then TipoComprobante = "Factura"
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Egs" Then TipoComprobante = "Nota de Crédito"
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Dev" Then TipoComprobante = "Nota de Devolución"
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Rem" Then TipoComprobante = "Remisión"
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Cot" Then TipoComprobante = "Cotización"
|
||||||
|
If DdlTipoComprobante.SelectedValue.ToString() = "Ant" Then TipoComprobante = "Anticipo"
|
||||||
|
|
||||||
|
Dim DisplayName As String = ""
|
||||||
|
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
|
||||||
|
|
||||||
|
Dim ObjVenta As New ClsVentas
|
||||||
|
Dim Dr As DataRow = Nothing
|
||||||
|
If ObjVenta.GetVenta(HdnCveVentaFactura.Value.ToEntero(), UsuarioActual.CveEmpresa) Then
|
||||||
|
If ObjVenta.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dr = ObjVenta.DtResultados.Rows(0)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
ObjVenta.Dispose()
|
||||||
|
|
||||||
|
If HdnTipoDocto.Value.ToString() = "Cot" Then
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion.Trim.Length > 0 Then
|
||||||
|
|
||||||
|
Cuerpo = UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion
|
||||||
|
Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString())
|
||||||
|
|
||||||
|
If Dr IsNot Nothing Then
|
||||||
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Sucursal""}", Dr("SubProyecto").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""DescripcionVenta""}", Dr("DescripcionVenta").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion.Trim.Length > 0 Then
|
||||||
|
Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion
|
||||||
|
Asunto = Asunto.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa)
|
||||||
|
Asunto = Asunto.Replace("{""NombreCliente""}", LtlCliente.Text.Trim)
|
||||||
|
Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||||
|
Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString())
|
||||||
|
|
||||||
|
If Dr IsNot Nothing Then
|
||||||
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""Sucursal""}", Dr("SubProyecto").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""DescripcionVenta""}", Dr("DescripcionVenta").ToString())
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then
|
||||||
|
Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta
|
||||||
|
Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||||
|
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString())
|
||||||
|
If Dr IsNot Nothing Then
|
||||||
|
Cuerpo = Cuerpo.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
|
||||||
|
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""Sucursal""}", Dr("SubProyecto").ToString())
|
||||||
|
Cuerpo = Cuerpo.Replace("{""DescripcionVenta""}", Dr("DescripcionVenta").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then
|
||||||
|
Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta
|
||||||
|
Asunto = Asunto.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa)
|
||||||
|
Asunto = Asunto.Replace("{""NombreCliente""}", LtlCliente.Text.Trim)
|
||||||
|
Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||||
|
Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString())
|
||||||
|
If Dr IsNot Nothing Then
|
||||||
|
Asunto = Asunto.Replace("{""FechaFactura""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""ImporteFactura""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Asunto = Asunto.Replace("{""Fecha""}", Dr("Fecha").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Total""}", Dr("Total").ToString().FormatoNumero())
|
||||||
|
Asunto = Asunto.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString().ToDate().ToShortDateString())
|
||||||
|
Asunto = Asunto.Replace("{""Vigencia""}", Dr("Vigencia").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""AtencionA""}", Dr("AtencionA").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""Sucursal""}", Dr("SubProyecto").ToString())
|
||||||
|
Asunto = Asunto.Replace("{""DescripcionVenta""}", Dr("DescripcionVenta").ToString())
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Cuerpo = $"{Cuerpo} <br> {TxtBodyFactura.Text}"
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
||||||
|
Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf"
|
||||||
|
Dim XML As String = $"{Ruta}XML\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.xml"
|
||||||
|
If File.Exists(PDF) AndAlso File.Exists(XML) Then
|
||||||
|
|
||||||
|
Dim ResultadoMail As Integer = 0
|
||||||
|
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||||
|
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF})
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML})
|
||||||
|
|
||||||
|
If Dr("Adjunto").ToString() <> "" Then
|
||||||
|
Adjunto = Dr("Adjunto").ToString()
|
||||||
|
Dim ArchivoAdjunto As String = $"{Ruta}Ventas\{Adjunto}"
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = ArchivoAdjunto})
|
||||||
|
End If
|
||||||
|
|
||||||
|
'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then
|
||||||
|
If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMailFactura.Text.Trim, Asunto, Cuerpo, TxtCCFactura.Text.Trim, LSRutasMail, Displayname:=DisplayName) Then
|
||||||
|
ResultadoMail = 1
|
||||||
|
TxtCCFactura.Text = ""
|
||||||
|
TxtBodyFactura.Text = ""
|
||||||
|
RegistraScript("$('#ModalDivMail').modal('hide');")
|
||||||
|
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
ResultadoMail = 3
|
||||||
|
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVentaFactura.Value.ToEntero())
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
Else
|
||||||
|
Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
|
||||||
|
ElseIf HdnTipoDocto.Value.Contiene("Cot", "Rem") Then
|
||||||
|
If File.Exists($"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf") Then
|
||||||
|
Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf"
|
||||||
|
|
||||||
|
Dim ResultadoMail As Integer = 0
|
||||||
|
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF})
|
||||||
|
If Dr("Adjunto").ToString() <> "" Then
|
||||||
|
Adjunto = Dr("Adjunto").ToString()
|
||||||
|
Dim ArchivoAdjunto As String = $"{Ruta}Ventas\{Adjunto}"
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = ArchivoAdjunto})
|
||||||
|
End If
|
||||||
|
'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then
|
||||||
|
If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMailFactura.Text.Trim, Asunto, Cuerpo, TxtCCFactura.Text.Trim, LSRutasMail) Then
|
||||||
|
ResultadoMail = 1
|
||||||
|
TxtCCFactura.Text = ""
|
||||||
|
TxtBodyFactura.Text = ""
|
||||||
|
RegistraScript("$('#ModalDivMail').modal('hide');")
|
||||||
|
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
ResultadoMail = 3
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVentaFactura.Value.ToEntero())
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
Else
|
||||||
|
Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'End If
|
||||||
|
'ObjEmprea.Dispose()
|
||||||
|
ElseIf HdnSerieFolioPago.Value <> "-1" Then
|
||||||
|
|
||||||
|
Dim ObjMail As New ClsSisMail()
|
||||||
|
Dim RutaXML As String = String.Format("{0}XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value)
|
||||||
|
Dim RutaPDF As String = String.Format("{0}PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value)
|
||||||
|
|
||||||
|
Dim Cuerpo As String = "Se hace entrega del comprobante de pago"
|
||||||
|
Dim Asunto As String = "Entrega de comprobante de pago"
|
||||||
|
|
||||||
|
If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then
|
||||||
|
|
||||||
|
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||||
|
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF})
|
||||||
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML})
|
||||||
|
|
||||||
|
If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMailFactura.Text.Trim, Asunto, Cuerpo, TxtCCFactura.Text.Trim, LSRutasMail) Then
|
||||||
|
TxtCCFactura.Text = ""
|
||||||
|
RegistraScript("$('#ModalDivMail').modal('hide');")
|
||||||
|
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert("No se encontraron los archivos para enviar.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió error al mandar MAIL", ex)
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
ObjVentas.UpdateVentaMail(3, HdnCveVentaFactura.Value.ToEntero())
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Reference in New Issue
Block a user