539 lines
26 KiB
VB.net
539 lines
26 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class OC_CotizacionEnLinea
|
|
Inherits Page
|
|
'debe de heredar de PAGE, no de clspaginas, porque sino valida la sesion en el servidor.
|
|
|
|
#Region "Propiedades"
|
|
Public Property Empresa As Empresa
|
|
|
|
Private Property CotizacionActiva As Boolean
|
|
Get
|
|
CotizacionActiva = CBool(ViewState("CotizacionActiva").ToString)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("CotizacionActiva") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveOrdenCompra As Integer
|
|
Get
|
|
CveOrdenCompra = ViewState("CveOrdenCompra").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveOrdenCompra") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveProveedor As Integer
|
|
Get
|
|
CveProveedor = ViewState("CveProveedor").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProveedor") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveColectiva As Integer
|
|
Get
|
|
CveColectiva = ViewState("CveColectiva").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveColectiva") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveEmpresa As Integer
|
|
Get
|
|
CveEmpresa = ViewState("CveEmpresa").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveEmpresa") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCotizacion As Integer
|
|
Get
|
|
CveCotizacion = ViewState("CveCotizacion").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCotizacion") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property Validacion As String
|
|
Get
|
|
Validacion = ViewState("Validacion").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Validacion") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CorreoCCP As String
|
|
Get
|
|
CorreoCCP = ViewState("CorreoCCP").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("CorreoCCP") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CorreoPara As String
|
|
Get
|
|
CorreoPara = ViewState("CorreoPara").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("CorreoPara") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property DtDetalle As DataTable
|
|
Get
|
|
DtDetalle = DirectCast(ViewState("DtDetalle"), DataTable)
|
|
End Get
|
|
Set(ByVal value As DataTable)
|
|
ViewState("DtDetalle") = value
|
|
End Set
|
|
End Property
|
|
Private Property DiasCredito As Integer
|
|
Get
|
|
DiasCredito = ViewState("DiasCredito").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("DiasCredito") = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "C A R G A D A T O S"
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CType(Me.Master, Site).EsPopup = True
|
|
CType(Me.Master, Site).PopupWidth = 670
|
|
|
|
|
|
If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then
|
|
|
|
If IfNull(Request("Conta"), "").ToString = "1" Then
|
|
Contabilizar(Request("CveEmpresa").ToEntero, Request("CvePrePoliza").ToEntero, Request("IdPoliza").ToEntero)
|
|
End If
|
|
Exit Sub
|
|
End If
|
|
|
|
'Validar que este activo aun el link
|
|
'ViewState("CveOrdenCompra") = If(Not Request("CveOrdenCompra") Is Nothing AndAlso Request("CveOrdenCompra").ToString.ToEntero > 0, Request("CveOrdenCompra").ToEntero, 0)
|
|
'ViewState("CveProveedor") = If(Not Request("CveProveedor") Is Nothing AndAlso Request("CveProveedor").ToString.ToEntero > 0, Request("CveProveedor").ToEntero, 0)
|
|
RegistraScript("$('#mBody').addClass('page-sidebar-closed')")
|
|
RegistraScript("$('#divMenu').css('display','none')")
|
|
|
|
ViewState("Validacion") = If(Not Request("P") Is Nothing, Request("P").ToString, "")
|
|
|
|
'If Validacion IsNot Nothing AndAlso Validacion = Encripta(String.Format("{0}|||{1}", CveOrdenCompra, CveProveedor)) Then
|
|
If Validacion IsNot Nothing Then
|
|
Dim Cadena As String = ModExtensiones.Decripta(Validacion)
|
|
|
|
If Cadena <> "" Then
|
|
Dim UrlParametros As Hashtable = Parametros(Cadena)
|
|
If UrlParametros("CVECOTIZACION") IsNot Nothing AndAlso UrlParametros("CVECOTIZACION").ToString.ToEntero > 0 Then
|
|
ViewState("CveCotizacion") = UrlParametros("CVECOTIZACION").ToString.ToEntero
|
|
' PnlGral.Visible = True
|
|
CargaMonedas()
|
|
CargaCotizacion()
|
|
Else
|
|
Alert("ERROR", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
Alert("ERROR", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
Alert("ERROR", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub Contabilizar(CveEmpresa As Integer, CvePrePoliza As Integer, IdPoliza As Integer)
|
|
Dim ObjConta As New ClsContabilidad
|
|
|
|
If IdPoliza > 0 Then 'si está bloqueada, lo desbloqueaprimero
|
|
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
|
End If
|
|
Dim Emp As Empresa = Nothing
|
|
Dim Empr As New ClsSisEmpresas
|
|
If Empr.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
|
|
Emp = Empr.Empresa
|
|
End If
|
|
|
|
Empr.Dispose()
|
|
|
|
|
|
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, 100, Emp, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1)) Then
|
|
' Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
Else
|
|
|
|
'Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
ObjConta.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub CargaMonedas()
|
|
Dim objMonedas As New ClsMonedas
|
|
|
|
If objMonedas.GetMonedas Then
|
|
ddlMoneda.DataSource = objMonedas.DtResultados
|
|
ddlMoneda.DataBind()
|
|
End If
|
|
|
|
objMonedas.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaCotizacion()
|
|
Dim objCotizacion As New ClsOC
|
|
|
|
If objCotizacion.GetCotizaciones(-1, CveCotizacion) Then
|
|
ViewState("CveOrdenCompra") = objCotizacion.CveOrdenCompra
|
|
ViewState("CveEmpresa") = objCotizacion.CveEmpresa
|
|
ViewState("CveProveedor") = objCotizacion.CveProveedor
|
|
ViewState("CveColectiva") = objCotizacion.CveColectiva
|
|
DiasCredito = objCotizacion.DiasCredito
|
|
|
|
lblEmpresa.Text = objCotizacion.Empresa
|
|
lblSubProyecto.Text = objCotizacion.SubProyecto
|
|
LbLugarEntrega.Text = objCotizacion.LugarEntrega
|
|
TxtDiasCredito.Text = objCotizacion.DiasCredito.ToString
|
|
'lblFolio.Text = objCotizacion.Folio.ToString
|
|
|
|
TxtFolio.Text = objCotizacion.Folio.ToString
|
|
ddlMoneda.SelectedValue = objCotizacion.CveMoneda.ToString
|
|
Dim Emp As New ClsSisEmpresas
|
|
If Emp.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
|
|
If Emp.DtResultados.Rows.Count > 0 Then
|
|
lblTelefono.Text = Emp.DtResultados.Rows(0)("Telefono").ToString
|
|
End If
|
|
|
|
End If
|
|
Emp.Dispose()
|
|
|
|
If objCotizacion.CveProveedor > 0 Then
|
|
Dim objProveedor As New ClsCompProveedores
|
|
|
|
If objProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, CveEmpresa) Then
|
|
If objProveedor.DtResultados.Rows.Count > 0 Then
|
|
lblProveedor.Text = objProveedor.DtResultados.Rows(0)("RazonSocial").ToString
|
|
End If
|
|
End If
|
|
objProveedor.Dispose()
|
|
ElseIf objCotizacion.CveColectiva > 0 Then
|
|
Dim objColectiva As New ClsGenerales
|
|
|
|
If objColectiva.GetColectivas(CveColectiva, "-1", "-1", "1", CveEmpresa) Then
|
|
If objColectiva.DtResultados.Rows.Count > 0 Then
|
|
lblProveedor.Text = objColectiva.DtResultados.Rows(0)("Colectiva").ToString
|
|
End If
|
|
End If
|
|
objColectiva.Dispose()
|
|
End If
|
|
|
|
|
|
'Dim CorreosCCP As String() = Nothing
|
|
Dim StrCorreoPara As String = ""
|
|
Dim StrCorreos As New StringBuilder
|
|
Dim Contador As Integer = 1
|
|
|
|
If objCotizacion.GetOC(CveOrdenCompra, CveEmpresa) Then
|
|
If objCotizacion.GetEstatusUsuarios(-1, objCotizacion.CveEstatusSiguiente, -1, CveOrdenCompra, CveEmpresa) Then
|
|
Dim Usr As New ClsSisUsuarios
|
|
For Each Row As DataRow In objCotizacion.DtResultados.Rows
|
|
'Array.Resize(CorreosCCP, If(CorreosCCP IsNot Nothing, UBound(CorreosCCP) + 2, 1))
|
|
If Usr.GetUsuarios(Row("CveUsuario").ToString.ToEntero) Then
|
|
If Usr.DtResultados.Rows.Count > 0 AndAlso Usr.DtResultados.Rows(0) IsNot Nothing Then
|
|
If Contador = 1 Then
|
|
StrCorreoPara = Usr.DtResultados.Rows(0)("correo").ToString
|
|
Contador += 1
|
|
Else
|
|
StrCorreos.AppendFormat("{0};", Usr.DtResultados.Rows(0)("correo").ToString)
|
|
End If
|
|
|
|
'CorreosCCP(UBound(CorreosCCP)) = Usr.DtResultados.Rows(0)("correo").ToString
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
Usr.Dispose()
|
|
End If
|
|
|
|
ViewState("CorreoCCP") = StrCorreos.ToString
|
|
ViewState("CorreoPara") = StrCorreoPara
|
|
|
|
If objCotizacion.GetCotizacionesDetalle(CveCotizacion, -1) Then
|
|
DtDetalle = objCotizacion.DtResultados
|
|
If objCotizacion.DtResultados.COUNT("CveCotizacionDetalle", "PU IS NOT NULL") = 0 Then ViewState("CotizacionActiva") = True Else ViewState("CotizacionActiva") = False
|
|
GvD.DataSource = DtDetalle
|
|
GvD.DataBind()
|
|
End If
|
|
|
|
If CotizacionActiva = False Then Alert("Esta cotización ya fue capturada y no puede ser modificada", TipoMensaje.MsgAdvertencia) : BtnGuardar.Visible = False : GvD.Enabled = False : TxtFolio.Enabled = False : FUArchivo.Enabled = False
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
objCotizacion.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
|
Dim objCotizacion As New ClsOC
|
|
objCotizacion.IniciaTransacSQL()
|
|
Dim TieneError = False
|
|
|
|
If objCotizacion.UpdateCotizacion(CveProveedor, CveColectiva, TxtFolio.Text, Now.ToShortDateString(), IO.Path.GetExtension(FUArchivo.FileName), ddlMoneda.SelectedValue.ToEntero, TxtDiasCredito.Text.ToEntero, 0, CveCotizacion) Then
|
|
|
|
If FUArchivo.HasFile Then
|
|
'verificar que exista el directorio
|
|
If Not System.IO.Directory.Exists(String.Format("{0}Cotizaciones/", Empresa.Ruta)) Then
|
|
System.IO.Directory.CreateDirectory(String.Format("{0}Cotizaciones/", Empresa.Ruta))
|
|
End If
|
|
FUArchivo.SaveAs(String.Format("{0}Cotizaciones/{1}{2}", Empresa.Ruta, CveCotizacion, IO.Path.GetExtension(FUArchivo.FileName)))
|
|
End If
|
|
|
|
For Each dr As GridViewRow In GvD.Rows
|
|
If Not objCotizacion.UpdateCotizacionDetalle(dr.DataKey("CveCotizacionDetalle").ToEntero, dr.FCTextBox("TxtPU").Text.ToDouble, dr.FCTextBox("txtCantidadSurtir").Text.ToDouble, If(dr.FCTextBox("txtFechaEntrega").Text.Trim = "" Or dr.FCTextBox("txtFechaEntrega").Text = "__/__/____", "-1", dr.FCTextBox("txtFechaEntrega").Text), dr.FCTextBox("txtObservacion").Text.ToString) Then
|
|
TieneError = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
If Not TieneError Then
|
|
objCotizacion.Commit()
|
|
Alert("Cotización Guardada.", TipoMensaje.MsgInformacion)
|
|
Else
|
|
objCotizacion.RollBack()
|
|
Alert("Ocurrió un error al guardar la cotización.", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
End If
|
|
|
|
objCotizacion.Dispose()
|
|
|
|
|
|
'Enviar mail
|
|
If Not TieneError Then
|
|
Dim Body As String = GeneraCorreo(CveProveedor, CveCotizacion)
|
|
|
|
If Body <> String.Empty AndAlso CorreoPara <> "" Then
|
|
ViewState("Para") = CorreoPara
|
|
ViewState("ArrayCC") = CorreoCCP
|
|
ViewState("Asunto") = "SIG - Cotización Recibida"
|
|
ViewState("Body") = Body
|
|
Dim Hilo As New System.Threading.Thread(AddressOf MandaCorreo)
|
|
Hilo.Start()
|
|
End If
|
|
End If
|
|
|
|
|
|
TxtFolio.Enabled = False
|
|
FUArchivo.Enabled = False
|
|
GvD.Enabled = False
|
|
BtnGuardar.Enabled = False
|
|
End Sub
|
|
|
|
#Region " C O R R E O "
|
|
Private Sub MandaCorreo()
|
|
Dim Mail As New ClsSisMail()
|
|
|
|
Empresa = ClsPaginas.EmpresaNotificaciones
|
|
'Empresa.Ruta = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa)
|
|
|
|
Mail.SendMail(Empresa, ViewState("Para").ToString, ViewState("Asunto").ToString, ViewState("Body").ToString, ViewState("ArrayCC").ToString)
|
|
|
|
'Mail.MandaCorreo(Empresa, ViewState("Para").ToString, ViewState("Asunto").ToString, CType(ViewState("ArrayCC"), String()), ViewState("Body").ToString)
|
|
End Sub
|
|
|
|
Private Function GeneraCorreo(CveProveedor As Integer, CveCotizacion As Integer) As String
|
|
|
|
Dim objCotizacion As New ClsOC
|
|
Dim strBody As New StringBuilder
|
|
|
|
If objCotizacion.GetOC(CveOrdenCompra, CveEmpresa) Then
|
|
Dim Folio = "", Descripcion = "", Justificacion = "", Estatus = "", Empresa = "", FechaEstimadaEntrega = ""
|
|
|
|
Folio = objCotizacion.Folio
|
|
Descripcion = objCotizacion.Descripcion
|
|
Justificacion = objCotizacion.Justificacion
|
|
Estatus = objCotizacion.Estatus
|
|
Empresa = objCotizacion.Empresa
|
|
FechaEstimadaEntrega = objCotizacion.FechaEstimadaEntrega
|
|
|
|
If objCotizacion.GetCotizaciones(-1, CveCotizacion) Then
|
|
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
|
strBody.Append("<head> ")
|
|
strBody.Append(" <style type=""text/css""> ")
|
|
strBody.Append(" body ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" margin:0px; ")
|
|
strBody.Append(" padding:0px 0px 0px 0px; ")
|
|
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
|
strBody.Append(" font-size: 10px; ")
|
|
strBody.Append(" background-color:#F0F0F0; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" a.Texto ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" font-size:11px; ")
|
|
strBody.Append(" background-color:#F7F6F3; ")
|
|
strBody.Append(" text-decoration:none; ")
|
|
strBody.Append(" font-weight:bold; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Texto ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .TextoAlterno ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
|
strBody.Append(" vertical-align:middle; height:20px;")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .BarraIdentidad ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" color:#FFFFFF; ")
|
|
strBody.Append(" background:#F0F0F0; ")
|
|
strBody.Append(" font-weight:bold; ")
|
|
strBody.Append(" font-size:19px; ")
|
|
strBody.Append(" font-style:oblique; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Titulos ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color: Gray;")
|
|
strBody.Append(" color:White; ")
|
|
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
|
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
|
strBody.Append(" text-decoration:none; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Contenido ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color: White;")
|
|
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
|
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
|
strBody.Append(" text-decoration:none; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Verde {color: #00CC00;} ")
|
|
strBody.Append(" .Negro {color: #000000;} ")
|
|
strBody.Append(" .Rojo {color: #FF0000;} ")
|
|
strBody.Append(" </style> ")
|
|
strBody.Append("</head> ")
|
|
strBody.Append("<body> ")
|
|
|
|
strBody.Append("<div class='Titulos'>Se acaba de recibir una Cotización</div><br>")
|
|
|
|
strBody.Append("<div class='Contenido'>")
|
|
strBody.AppendFormat(" <div id=""C_divOC"" style=""width: 550px""> <fieldset> <legend><b>Datos {0}</b></legend> ", "Cotización")
|
|
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Empresa:</td><td colspan=""3""><b>{0}</b></td> ", Empresa)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td>Entrega:</td><td><b>{0}</b></td><td> </td><td><b> </b></td> ", FechaEstimadaEntrega)
|
|
strBody.Append(" </tr> ")
|
|
'strBody.Append(" <tr style=""height: 20px""> ")
|
|
'strBody.AppendFormat(" <td>Descripción:</td><td colspan='3'><b>{0}</b></td> ", objOC.Descripcion)
|
|
'strBody.Append(" </tr> ")
|
|
'strBody.Append(" <tr style=""height: 20px""> ")
|
|
'strBody.AppendFormat(" <td>Justificación</td><td colspan=""3""><textarea name=""ctlTJ"" rows=""5"" cols=""20"" readonly=""readonly""id=""ctlTJ"" style=""width: 300px;"">{0}</textarea></td> ", OC.Justificacion)
|
|
'strBody.Append(" </tr> ")
|
|
strBody.Append(" </table> ")
|
|
strBody.Append(" </fieldset> ")
|
|
strBody.Append(" </div> ")
|
|
|
|
strBody.AppendFormat(" <div id=""C_divProv"" style=""width: 550px""> <fieldset> <legend><b>Proveedor</b></legend> ")
|
|
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Folio:</td><td style=""width: 125px""><b>{0}</b></td><td style=""width: 90px""> Estatus: </td><td><b>{1}</b></td> ", Folio, Estatus)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Proveedor:</td><td colspan=""3""><b>{0}</b></td> ", If(objCotizacion.CveProveedor > 0, objCotizacion.RazonSocial, objCotizacion.Colectiva))
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 20px""> ")
|
|
strBody.AppendFormat(" <td>Descripción:</td><td colspan='3'><b>{0}</b></td> ", Descripcion)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 20px""> ")
|
|
strBody.AppendFormat(" <td>Justificación</td><td colspan=""3""><textarea name=""ctlTJ"" rows=""5"" cols=""20"" readonly=""readonly""id=""ctlTJ"" style=""width: 300px;"">{0}</textarea></td> ", Justificacion)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" </table> ")
|
|
strBody.Append(" </fieldset> ")
|
|
strBody.Append(" </div> ")
|
|
'Cargo el detalle
|
|
|
|
strBody.Append(" <div style='width: 550px'> ")
|
|
strBody.Append(" <fieldset> ")
|
|
strBody.Append(" <legend>Productos Cotizados</legend> ")
|
|
strBody.Append(" <table width=""550px""> <tr style='background-color:gray;color:White;font-family:Verdana;font-size:10px;text-align:center;vertical-align:middle;font-weight:bold;height:20px;text-decoration:none;'><th scope='col' style='width: 50px'>Cantidad</th><th scope='col' style='width: 50px'>Unidad</th><th scope='col' style='width: 225px'>Descripción</th><th scope='col' style='width: 100px'>Precio Unitario</th><th scope='col' style='width: 125px'>Importe</th>")
|
|
'strBody.Append(" <th scope='col' style='width: 100px'>Clasificación</th><th scope='col' style='width: 85px'>Maq</th></tr>")
|
|
strBody.Append(" </tr>")
|
|
|
|
'verifico los permisos según el estatus
|
|
|
|
objCotizacion.GetCotizacionesDetalle(CveCotizacion)
|
|
Dim dtConceptos As DataTable = objCotizacion.DtResultados
|
|
|
|
For Each dr As DataRow In dtConceptos.Rows
|
|
strBody.AppendFormat("<tr class='Texto'><td style='width:50px;'>{0}</td><td style='width:50px;'>{1}</td><td align='left' style='width:225px;'>{2}</td><td style='width:100px;text-align:right;'>${3}</td><td style='width:125px;text-align:right;'>${4}</td></tr>", dr("Cantidad").ToString.FormatoNumero, dr("Abreviatura"), dr("PS"), dr("PU").ToString.FormatoNumero(2), dr("Importe").ToString.FormatoNumero)
|
|
|
|
Next
|
|
strBody.Append(" </table> ")
|
|
strBody.Append(" </fieldset> ")
|
|
strBody.Append(" </div> ")
|
|
|
|
|
|
strBody.Append("</div>")
|
|
strBody.Append("</body></html>")
|
|
Else
|
|
OnError("NO SE ENCONTRO COTIZACION AL QUERER MANDAR CORREO DONDE SE CAPTURO COTIZACION", New Exception)
|
|
End If
|
|
Else
|
|
OnError("NO SE ENCONTRO ORDEN DE COMPRA AL QUERER MANDAR CORREO DONDE SE CAPTURO COTIZACION", New Exception)
|
|
End If
|
|
|
|
Return strBody.ToString
|
|
End Function
|
|
#End Region
|
|
|
|
#Region "GV"
|
|
Protected Sub GvD_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvD.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
e.Row.FCCalendarExtender("CEFechaEntrega").StartDate = Date.Now
|
|
e.Row.FCTextBox("TxtPU").Attributes.Add("onchange", String.Format("$get('{0}').value = FormatNumber(parseFloat(this.value) * parseFloat($get('{1}').value), 2, true, true, true);", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.FCTextBox("TxtCant").ClientID))
|
|
|
|
Page.ClientScript.RegisterExpandoAttribute(e.Row.FCCustomValidator("CVFechaEntrega").ClientID, "txtCantidadSurtir", e.Row.FCTextBox("txtCantidadSurtir").ClientID, False)
|
|
Page.ClientScript.RegisterExpandoAttribute(e.Row.FCCustomValidator("CVPU").ClientID, "txtCantidadSurtirPU", e.Row.FCTextBox("txtCantidadSurtir").ClientID, False)
|
|
|
|
e.Row.FCRangeValidator("RVCantidad").MaximumValue = e.Row.DBCampo("Cantidad")
|
|
e.Row.FCTextBox("TxtPU").Attributes.Add("onkeyup", String.Format("CalculaImporte({0},this,{1})", e.Row.FCTextBox("TxtCantidadSurtir").ClientID, e.Row.FCTextBox("TxtImporte").ClientID))
|
|
e.Row.FCTextBox("TxtCantidadSurtir").Attributes.Add("onkeyup", String.Format("CalculaImporte(this,{0},{1})", e.Row.FCTextBox("TxtPU").ClientID, e.Row.FCTextBox("TxtImporte").ClientID))
|
|
End If
|
|
End Sub
|
|
|
|
Private Function Parametros(Cadena As String) As Hashtable
|
|
Dim P1() As String = Cadena.Split("&"c)
|
|
Dim Tmp As String
|
|
Dim P2() As String
|
|
|
|
Dim URLParametros As New Hashtable
|
|
|
|
For Each Tmp In P1
|
|
P2 = Tmp.Split("="c)
|
|
URLParametros.Add(P2(0).ToString.ToUpper, P2(1))
|
|
Next
|
|
Return URLParametros
|
|
End Function
|
|
#End Region
|
|
End Class
|