Promociones de baterias, editar observaciones, generacion de PDF en otro hilo
This commit is contained in:
@@ -709,6 +709,20 @@ Partial Class PV
|
||||
ViewState("CveAutorizacion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property ClienteCodigoRegimenFiscal As String
|
||||
Get
|
||||
|
||||
If ViewState("ClienteCodigoRegimenFiscal") Is Nothing Then
|
||||
ViewState("ClienteCodigoRegimenFiscal") = ""
|
||||
End If
|
||||
Return ViewState("ClienteCodigoRegimenFiscal").ToString
|
||||
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("ClienteCodigoRegimenFiscal") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
#Region "PROPIEDADES DE PUNTO DE VENTA"
|
||||
@@ -2431,8 +2445,10 @@ Partial Class PV
|
||||
'End If
|
||||
End Sub
|
||||
Private Sub CargaUsoCFDI()
|
||||
|
||||
DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica)
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then
|
||||
ClienteCodigoRegimenFiscal = "-1"
|
||||
End If
|
||||
DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=ClienteCodigoRegimenFiscal)
|
||||
DdlUsoCFDI.DataBind()
|
||||
End Sub
|
||||
Private Sub CargaNuevaFactura(OVenta As ClsVentas)
|
||||
@@ -2635,6 +2651,7 @@ Partial Class PV
|
||||
ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR
|
||||
ViewState("CodCliente") = ObjCliente.Codigo
|
||||
ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS
|
||||
ClienteCodigoRegimenFiscal = ObjCliente.DtResultados.Rows(0)("CodigoRegimenFiscal").ToString()
|
||||
|
||||
If (Boolean.Parse(ObjCliente.DtResultados(0)("EsDistribuidor").ToString)) Then
|
||||
TrEsDistribuidor.Visible = True
|
||||
@@ -2687,6 +2704,13 @@ Partial Class PV
|
||||
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33.ToString)
|
||||
'DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString)
|
||||
DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString)
|
||||
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
|
||||
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
|
||||
'S01 Sin efectos fiscales.
|
||||
DdlUsoCFDI.SelectedValueExist("23")
|
||||
DdlUsoCFDI.Enabled = False
|
||||
ClienteCodigoRegimenFiscal = "616"
|
||||
End If
|
||||
End If
|
||||
TxtFechaPago.Text = (Now.AddDays(ObjCliente.PlazoCobranza)).ToShortDateString
|
||||
|
||||
@@ -2865,6 +2889,13 @@ Partial Class PV
|
||||
DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString)
|
||||
DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString)
|
||||
DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString)
|
||||
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
|
||||
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
|
||||
'S01 Sin efectos fiscales.
|
||||
DdlUsoCFDI.SelectedValueExist("23")
|
||||
DdlUsoCFDI.Enabled = False
|
||||
ClienteCodigoRegimenFiscal = "616"
|
||||
End If
|
||||
End If
|
||||
|
||||
If CveVenta < 0 Then TxtAtencionA.Text = ObjCliente.DtResultados.Rows(0)("Contacto").ToString
|
||||
@@ -2894,6 +2925,13 @@ Partial Class PV
|
||||
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
|
||||
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
|
||||
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
|
||||
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
|
||||
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
|
||||
'S01 Sin efectos fiscales.
|
||||
DdlUsoCFDI.SelectedValueExist("23")
|
||||
DdlUsoCFDI.Enabled = False
|
||||
ClienteCodigoRegimenFiscal = "616"
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -4204,12 +4242,18 @@ Partial Class PV
|
||||
HdnDescuentoOriginal.Value = TxtDescuento.Text.ToDecimal().ToString()
|
||||
LblDescuentoIncluido.Text = TxtDescuento.Text.ToDecimal().FormatoNumero(2)
|
||||
|
||||
If PrecioSugerido > 0 AndAlso TxtDescuento.Text.ToDecimal() > 0 Then
|
||||
If PrecioSugerido > 0 Then
|
||||
TxtPrecio.Text = PrecioSugerido.FormatoNumero()
|
||||
LblPrecio1.Text = PrecioSugerido.FormatoNumero()
|
||||
'RegistraScript("$get('LblPrecio1').innerText = formato_numero(" + PrecioSugerido.ToString() + ", 2, '.', ',');", "A1")
|
||||
End If
|
||||
|
||||
If IsNumeric(TxtCantidad.Text.Trim) Then
|
||||
LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString.FormatoNumero(2)
|
||||
Else
|
||||
LblTotalPS.Text = "0.00"
|
||||
End If
|
||||
|
||||
If ChkAjuste.Checked Then
|
||||
CalculaMesesUso()
|
||||
UpAjuste.Update()
|
||||
@@ -4405,6 +4449,27 @@ Partial Class PV
|
||||
Descuento = 0
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
'LTH AA Paq. 2 baterias, LTH AAA Paq. 02 baterias, LTH AA Paq. 4 baterias, LTH AAA Paq. 4 Baterias
|
||||
If CvePS.Contiene(521445, 521448, 402917, 402918) Then
|
||||
'SI TIENE BATERIAS AGREGADAS CON LA MARCA LTH, APLICAR PROMOCION, LA CLASIFICACION DEBE SER ACUMULADORES
|
||||
If TmpDT.SUMD("Cantidad", "CveMarca IN (819,826,1085,1052) AND CveClasificacion IN (20520,20522,20513,20521,20512,20514,20229)") >= 1D Then
|
||||
Descuento = 0
|
||||
SeAjustoPU = True
|
||||
'Paq. 2 baterias
|
||||
If CvePS.Contiene(521445, 521448) Then
|
||||
PUPromocion = 25D
|
||||
End If
|
||||
'Paq. 4 baterias
|
||||
If CvePS.Contiene(402917, 402918) Then
|
||||
PUPromocion = 40D
|
||||
End If
|
||||
PUModificado = Math.Round(PUPromocion / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjDescuento.ImporteDescuento = Descuento
|
||||
ObjDescuento.CvePromocionDetalle = CvePromocionDetalle
|
||||
If SeAjustoPU Then
|
||||
@@ -4642,6 +4707,7 @@ Partial Class PV
|
||||
TmpDT.Columns("EliminarDB").DefaultValue = False
|
||||
|
||||
TmpDT.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -5014,6 +5080,11 @@ Partial Class PV
|
||||
|
||||
Row("EliminarDB") = EliminarDB
|
||||
|
||||
If TmpDT.Columns.Contains("CveMarca") Then
|
||||
Row("CveMarca") = DrPS("CveMarca")
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
|
||||
@@ -2619,6 +2619,7 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
|
||||
@@ -2638,6 +2639,7 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
|
||||
@@ -7661,8 +7663,14 @@ Partial Class Ventas
|
||||
|
||||
'EN BDH NO DEBE PODER EDITAR LOS PS
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
e.Row.FCLinkButton("imgE").Visible = False
|
||||
e.Row.FCLinkButton("imgD").Visible = False
|
||||
If ModalidadEdicion Then
|
||||
e.Row.FCLinkButton("imgE").Visible = True
|
||||
e.Row.FCLinkButton("imgD").Visible = False
|
||||
Else
|
||||
e.Row.FCLinkButton("imgE").Visible = False
|
||||
e.Row.FCLinkButton("imgD").Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -7702,6 +7710,22 @@ Partial Class Ventas
|
||||
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
|
||||
|
||||
If CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtCantidad").Enabled = False
|
||||
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownLost("DdlPS").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownLost("DdlPS").ddlWS.Attributes.Add("disabled", "disabled")
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlClasificacion").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlProyecto").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlSubProyecto").Enabled = False
|
||||
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtObsPS").Enabled = True
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
|
||||
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
|
||||
@@ -9488,8 +9512,15 @@ Partial Class Ventas
|
||||
If File.Exists(ArchivoXML) Then
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
|
||||
End If
|
||||
GeneraPDFFactura(ChkEnviarFactura.Checked) 'MANDA CORREO
|
||||
|
||||
Try
|
||||
'MANDA CORREO
|
||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, CveVenta, UsuarioActual, strURLHOST))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
'DESCARGA PDF
|
||||
@@ -14975,75 +15006,66 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region "¡ P D F R E P O R T V I E W E R !"
|
||||
Private Sub GeneraPDFFactura(EnviaCorreo As Boolean)
|
||||
|
||||
'CASO ESPECIAL
|
||||
If UsuarioActual.CveEmpresa = 8 AndAlso ObjFactura.TipoDocto.Contiene("Cot") Then
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("Sucursal", DdlSubProyectoDatos.SelectedItem.Text))
|
||||
'params.Add(New ReportParameter("Fecha", FechaCotizacion.ToString()))
|
||||
params.Add(New ReportParameter("Folio", ObjFactura.Folio.ToString()))
|
||||
params.Add(New ReportParameter("Cliente", LtlCliente.Text))
|
||||
params.Add(New ReportParameter("PersonaDirige", TxtAtencionA.Text))
|
||||
params.Add(New ReportParameter("Total", TxtTotal.Text))
|
||||
params.Add(New ReportParameter("Observaciones", TxtObsFact.Text))
|
||||
params.Add(New ReportParameter("Vendedor", DdlVendedor.SelectedItem.Text))
|
||||
params.Add(New ReportParameter("PersonaDirige", TxtAtencionA.Text.Trim))
|
||||
'params.Add(New ReportParameter("Folio", ""))
|
||||
ImprimirPDF(String.Format("{0}Formatos\Cotizacion.rdlc", UsuarioActual.Empresa.Ruta), TmpDT, params, "Cotización", RDSName:="DsCotizacion")
|
||||
End If
|
||||
|
||||
'Dim pdf As Byte() = Nothing
|
||||
|
||||
Private Sub GeneraPDFFactura(EnviaCorreo As Boolean, CveVenta As Integer, UsuarioActual As Usuario, strURLHOST As String)
|
||||
'GUARDA PDF
|
||||
Dim LocalSerieFolio As String = String.Empty
|
||||
Dim LocalTipoDocto As String = String.Empty
|
||||
|
||||
|
||||
Dim Factura As Modelos.Factura
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
Dim ObjetoPDF As Byte() = DescargarFactura(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True)
|
||||
Dim ObjetoPDF As Byte() = DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST)
|
||||
|
||||
If ObjetoPDF Is Nothing OrElse ObjetoPDF.Length = 0 Then
|
||||
PdfFactura(ObjFactura, AplicaPagare:=If(ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant"), "1", "0"))
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
|
||||
OnError("Ocurrió un error al generar el PDF", ex)
|
||||
End Try
|
||||
|
||||
If CveVenta > 0 Then
|
||||
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
|
||||
End If
|
||||
Dim ErrorCorreo As Boolean = False
|
||||
|
||||
LocalSerieFolio = ObjFactura.SerieFolio
|
||||
LocalTipoDocto = ObjFactura.TipoDocto
|
||||
'End If
|
||||
|
||||
|
||||
'MANDA CORREO
|
||||
If EnviaCorreo Then
|
||||
Dim ArchivoAdjunto As String = ""
|
||||
Dim ArchivoXML = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
|
||||
Dim ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
|
||||
If Adjunto <> "" Then
|
||||
ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto)
|
||||
Factura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
|
||||
If Factura IsNot Nothing Then
|
||||
'MANDA CORREO
|
||||
If EnviaCorreo Then
|
||||
LocalSerieFolio = Factura.SerieFolio
|
||||
LocalTipoDocto = Factura.TipoDocto
|
||||
|
||||
Dim ArchivoAdjunto As String = ""
|
||||
Dim ArchivoXML = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
|
||||
Dim ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
|
||||
If Adjunto <> "" Then
|
||||
ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto)
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim FIXML As New FileInfo(ArchivoXML)
|
||||
Dim FIPDF As New FileInfo(ArchivoPDF)
|
||||
If FIXML.Exists AndAlso FIPDF.Exists Then
|
||||
MandaMails(UsuarioActual, CveVenta, Factura.TipoDocto, LocalSerieFolio, EnviaCorreo, ArchivoXML, ArchivoPDF, ArchivoAdjunto)
|
||||
Else
|
||||
ErrorCorreo = True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorCorreo = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
Else
|
||||
ErrorCorreo = True
|
||||
End If
|
||||
|
||||
Try
|
||||
' BytesPdfCotizacion(CveVenta)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar Mail", ex)
|
||||
If ErrorCorreo Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ChkEnviarFactura.Checked Then
|
||||
If EnviaCorreo Then
|
||||
ObjVentas.UpdateVentaMail(3, CveVenta)
|
||||
Else
|
||||
ObjVentas.UpdateVentaMail(0, CveVenta)
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -16346,7 +16368,14 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'IMPRESION
|
||||
GeneraPDFFactura(ChkEnviarFactura.Checked)
|
||||
Try
|
||||
'MANDA CORREO
|
||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, CveVenta, UsuarioActual, strURLHOST))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
End Try
|
||||
|
||||
If ObjFactura.TipoDocto = "Ing" AndAlso ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07" Then
|
||||
CreaObjetosVentaAmortizacion(Nothing, ObjTimbrado.UUID, ObjFactura.CveVentaRelacion, CveVenta)
|
||||
@@ -18054,6 +18083,27 @@ Partial Class Ventas
|
||||
Alert("No se calculó el descuento correctamente", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
'LTH AA Paq. 2 baterias, LTH AAA Paq. 02 baterias, LTH AA Paq. 4 baterias, LTH AAA Paq. 4 Baterias
|
||||
If CvePS.Contiene(521445, 521448, 402917, 402918) Then
|
||||
'SI TIENE BATERIAS AGREGADAS CON LA MARCA LTH, APLICAR PROMOCION, LA CLASIFICACION DEBE SER ACUMULADORES
|
||||
If TmpDT.SUMD("Cantidad", "CveMarca IN (819,826,1085,1052) AND CveClasificacion IN (20520,20522,20513,20521,20512,20514,20229)") >= 1D Then
|
||||
Descuento = 0
|
||||
SeAjustoPU = True
|
||||
'Paq. 2 baterias
|
||||
If CvePS.Contiene(521445, 521448) Then
|
||||
PUPromocion = 25D
|
||||
End If
|
||||
'Paq. 4 baterias
|
||||
If CvePS.Contiene(402917, 402918) Then
|
||||
PUPromocion = 40D
|
||||
End If
|
||||
PUModificado = Math.Round(PUPromocion / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjDescuento.ImporteDescuento = Descuento.RoundSQL(2)
|
||||
ObjDescuento.CvePromocionDetalle = CvePromocionDetalle
|
||||
If SeAjustoPU Then
|
||||
@@ -18457,6 +18507,10 @@ Partial Class Ventas
|
||||
Row("EsOutSourcing") = DrPS("EsOutSourcing")
|
||||
Row("EsCargo") = EsCargo
|
||||
|
||||
If TmpDT.Columns.Contains("CveMarca") Then
|
||||
Row("CveMarca") = DrPS("CveMarca")
|
||||
End If
|
||||
|
||||
If ImporteProntoPago > 0 Then
|
||||
Row("ImporteProntoPago") = ImporteProntoPago
|
||||
Row("TieneProntoPago") = "Si"
|
||||
@@ -18696,6 +18750,7 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String))
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
|
||||
TmpDT.Columns("EsOutSourcing").DefaultValue = False
|
||||
TmpDT.Columns("EsCargo").DefaultValue = False
|
||||
@@ -20590,13 +20645,12 @@ Partial Class Ventas
|
||||
Private Sub MandaMails(UsuarioActual As Usuario, CveVenta As Integer, TipoDocto As String, SerieFolio As String, EnviarFactura As Boolean, XML As String, PDF As String, Adjunto As String)
|
||||
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ResultadoMail As Integer = 0
|
||||
|
||||
Try
|
||||
|
||||
Dim Asunto As String = String.Empty
|
||||
Dim Cuerpo As String = String.Empty
|
||||
Dim ResultadoMail As Integer = 0
|
||||
|
||||
Dim TipoComprobante = ""
|
||||
|
||||
@@ -20626,7 +20680,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If Not EnviarFactura Then
|
||||
ObjVentas.UpdateVentaMail(0, CveVenta)
|
||||
ResultadoMail = 0
|
||||
End If
|
||||
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
@@ -20649,7 +20703,7 @@ Partial Class Ventas
|
||||
Else
|
||||
ResultadoMail = 3
|
||||
End If
|
||||
ObjVentas.UpdateVentaMail(ResultadoMail, CveVenta)
|
||||
|
||||
|
||||
'CASO ESPECIAL
|
||||
If CveUsuarioActual = 1446 Then ' Flora
|
||||
@@ -20664,8 +20718,10 @@ Partial Class Ventas
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el Mail", ex)
|
||||
ObjVentas.UpdateVentaMail(3, CveVenta)
|
||||
ResultadoMail = 3
|
||||
Finally
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.UpdateVentaMail(ResultadoMail, CveVenta)
|
||||
ObjVentas.Dispose()
|
||||
End Try
|
||||
|
||||
@@ -21143,7 +21199,7 @@ Partial Class Ventas
|
||||
'EN BDH NO DEBE PERMITIR EDITAR EL PU
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
For Each Gvr As GridViewRow In GvPS.Rows
|
||||
Gvr.FCLinkButton("imgE").Visible = False
|
||||
Gvr.FCLinkButton("imgE").Visible = True
|
||||
Gvr.FCLinkButton("imgD").Visible = False
|
||||
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString().ToDouble
|
||||
Next
|
||||
@@ -21391,9 +21447,23 @@ Partial Class Ventas
|
||||
|
||||
'REGENERAR EL PDF
|
||||
If Not OcurrioError Then
|
||||
DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True)
|
||||
Try
|
||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RegenerarPDF(CveVenta As Integer, CveEmpresa As Integer, CveUsuario As Integer, strURLHOST As String)
|
||||
Try
|
||||
DescargarFactura(CveVenta, CveEmpresa, CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al regenerar el PDF", ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
@@ -32909,8 +32979,13 @@ Partial Class Ventas
|
||||
|
||||
' Return File
|
||||
'End Function
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0")))))
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False, Optional strURLHOST As String = "") As Byte()
|
||||
|
||||
If String.IsNullOrEmpty(strURLHOST) Then
|
||||
strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
End If
|
||||
|
||||
Dim Url = New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0")))))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient = New HttpClient()
|
||||
@@ -33676,6 +33751,7 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String))
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
|
||||
Return TmpDT
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user