Logo desde url de archivo en RepVentasDetalle
This commit is contained in:
@@ -7,10 +7,10 @@ Imports Microsoft.Reporting.WebForms
|
||||
Imports System.IO
|
||||
Imports System.IO.Compression
|
||||
Imports System.Net
|
||||
Imports System.Net.Http
|
||||
|
||||
Imports System.Net.Http
|
||||
|
||||
Partial Class RepVentaDetalle
|
||||
Inherits ClsPaginas
|
||||
Inherits ClsPaginas
|
||||
#Region "P R O P I E D A D E S"
|
||||
Private Property CveProyecto As Integer
|
||||
Get
|
||||
@@ -54,26 +54,26 @@ Partial Class RepVentaDetalle
|
||||
Set(value As Integer)
|
||||
ViewState("CveMoneda") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
End Property
|
||||
|
||||
|
||||
Private Property TipoCliente As Integer
|
||||
Get
|
||||
If ViewState("TipoCliente") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("TipoCliente").ToString.ToEntero
|
||||
End If
|
||||
|
||||
If ViewState("TipoCliente") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("TipoCliente").ToString.ToEntero
|
||||
End If
|
||||
|
||||
End Get
|
||||
|
||||
Set(value As Integer)
|
||||
ViewState("TipoCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Private Property TCEspecifico As Decimal
|
||||
Get
|
||||
Return ViewState("TCEspecifico").ToString.ToDecimal
|
||||
@@ -108,10 +108,10 @@ Partial Class RepVentaDetalle
|
||||
Set(value As DataTable)
|
||||
ViewState("DtColor") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
'pRivate ReadOnly Property ColumnasVisibles As
|
||||
'pRivate ReadOnly Property ColumnasVisibles As
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx")
|
||||
@@ -253,16 +253,16 @@ Partial Class RepVentaDetalle
|
||||
If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) Then
|
||||
ImgExcelVSH.Visible = True
|
||||
ImgExcel.Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveVendedor > 0 AndAlso Not UsuarioActual.TienePermisoProceso(263) Then
|
||||
DdlVendedor.SelectedValuesIfExistM(UsuarioActual.CveVendedor.ToString)
|
||||
DdlVendedor.Attributes.Add("disabled", "")
|
||||
DdlVendedor.Enabled = False
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "CARGA COMBOS"
|
||||
Private Sub CargaGrupo()
|
||||
DdlGrupo.Items.Insert(0, New ListItem("Año", "1"))
|
||||
@@ -278,7 +278,7 @@ Partial Class RepVentaDetalle
|
||||
DdlGrupo.Items.Insert(10, New ListItem("Año Ejec.", "11"))
|
||||
DdlGrupo.Items.Insert(11, New ListItem("Mes Ejec.", "12"))
|
||||
DdlGrupo.Items.Insert(12, New ListItem("Año/Mes Ejec.", "13"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Fecha Ejec.", "14"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Fecha Ejec.", "14"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Vendedor/Cliente", "21"))
|
||||
DdlGrupo.DataBind()
|
||||
End Sub
|
||||
@@ -379,7 +379,7 @@ Partial Class RepVentaDetalle
|
||||
|
||||
'Vendedor
|
||||
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Sin Vendedor", "-2"))
|
||||
|
||||
'CargaUsuarios
|
||||
@@ -393,11 +393,11 @@ Partial Class RepVentaDetalle
|
||||
'Carga Clasificacion Cliente
|
||||
DdlClienteClasificacion.DataSource = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa)
|
||||
DdlClienteClasificacion.DataBind()
|
||||
DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
|
||||
DdlTipoRelacion.DataSource = GlobalDTVtaTiposRelacion
|
||||
DdlTipoRelacion.DataBind()
|
||||
DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
|
||||
DdlTipoRelacion.DataSource = GlobalDTVtaTiposRelacion
|
||||
DdlTipoRelacion.DataBind()
|
||||
DdlTipoRelacion.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
CargaGrupo()
|
||||
@@ -421,9 +421,9 @@ Partial Class RepVentaDetalle
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
'DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "SELECTED INDEX CHANGE"
|
||||
Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaEstatus()
|
||||
@@ -451,18 +451,18 @@ Partial Class RepVentaDetalle
|
||||
'DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveClienteClasificacion = {DdlClienteClasificacion.SelectedValue.ToEntero} OR {DdlClienteClasificacion.SelectedValue.ToEntero} = -1")
|
||||
'DdlClientes.DataBind()
|
||||
'DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "CONSULTAR"
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
ConfiguraEmpresa()
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim AnioMes = If(Request("AnioMes") IsNot Nothing, Request("AnioMes").ToString, "-1").ToString
|
||||
Dim Fecha = If(Request("Fecha") IsNot Nothing, Request("Fecha").ToString, "-1").ToString
|
||||
Dim IVA = If(Request("IVA") IsNot Nothing, Request("IVA").ToString, "-1").ToString
|
||||
@@ -475,7 +475,7 @@ Partial Class RepVentaDetalle
|
||||
'PARAMETROS DE LOS LISTBOXS
|
||||
Dim TipoComprobante As String = If(DdlTipoComprobante.GetSelectedValuesM = "", "-1", DdlTipoComprobante.GetSelectedValuesM)
|
||||
Dim Sucursales As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM)
|
||||
Dim Estatus As String = If(DdlEstatus.GetSelectedValuesM = "", "-1", DdlEstatus.GetSelectedValuesM)
|
||||
Dim Estatus As String = If(DdlEstatus.GetSelectedValuesM = "", "-1", DdlEstatus.GetSelectedValuesM)
|
||||
Dim CveCondicionesPago As Integer = If(DdlCondicionesPago.SelectedValue = "", -1, DdlCondicionesPago.SelectedValue.ToEntero)
|
||||
Dim Vendedores As String = If(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM)
|
||||
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
|
||||
@@ -489,16 +489,16 @@ Partial Class RepVentaDetalle
|
||||
FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.Trim.ToDate, MinFecha)
|
||||
FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.Trim.ToDate, MaxFecha)
|
||||
|
||||
Dim ModalidadContable As Boolean = CBool(If(Request("ModalidadContable") IsNot Nothing, Request("ModalidadContable").ToEntero(), 0))
|
||||
|
||||
ChkLecturaAdmin.Checked = Not ModalidadContable
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
'FechaI, FechaF, -1, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero
|
||||
Dim ModalidadContable As Boolean = CBool(If(Request("ModalidadContable") IsNot Nothing, Request("ModalidadContable").ToEntero(), 0))
|
||||
|
||||
ChkLecturaAdmin.Checked = Not ModalidadContable
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
'FechaI, FechaF, -1, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero
|
||||
If ObjVentas.GetRepVentasDetalle(DdlGrupo.SelectedValue.ToEntero, Anio.ToEntero, Mes.ToEntero, AnioMes, Fecha, CveCliente,
|
||||
IVA, Vendedores, DdlUsuario.SelectedValue.ToEntero, Estatus, FechaI, FechaF,
|
||||
CveCorte.ToEntero, TipoComprobante, DdlSubProyectoEjecucion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, FechaIEjec, FechaFEjec,
|
||||
CveProyecto, Sucursales, TipoCambio, TCEspecifico, CveMoneda, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero,
|
||||
CveProyecto, Sucursales, TipoCambio, TCEspecifico, CveMoneda, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero,
|
||||
CveCondicionesPago:=CveCondicionesPago, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, ModalidadContable:=Not ChkLecturaAdmin.Checked, CveTipoRelacion:=DdlTipoRelacion.SelectedValue.ToEntero()) Then
|
||||
DtVentas = AddRows(ObjVentas.DtResultados)
|
||||
ImgImprimir.Enabled = True
|
||||
@@ -507,19 +507,19 @@ Partial Class RepVentaDetalle
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
GvVsh.DataSource = Nothing
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
Agrupador = DdlGrupo.SelectedItem.Text
|
||||
|
||||
Agrupador = DdlGrupo.SelectedItem.Text
|
||||
|
||||
GvDatos.DataBind()
|
||||
GvVsh.DataBind()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "GRIDVIEW"
|
||||
|
||||
|
||||
Private Function AddRows(ByRef DT As DataTable) As DataTable
|
||||
Dim i As Integer = 0
|
||||
Dim Ultima As String = String.Empty
|
||||
@@ -607,16 +607,16 @@ Partial Class RepVentaDetalle
|
||||
If e.Row.DBCampo("RetIVA").ToDouble < 0 Then e.Row.Cells(9).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("RetISR").ToDouble < 0 Then e.Row.Cells(10).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Total").ToDouble < 0 Then e.Row.Cells(11).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Total").ToDouble < 0 Then e.Row.Cells(12).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Total").ToDouble < 0 Then e.Row.Cells(13).ForeColor = Drawing.Color.Red
|
||||
|
||||
|
||||
'If e.Row.DBCampo("MAX_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlMaxSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("AVG_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlAVGSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("MIN_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlMinSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("MAX_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlMaxTotal").Text = ""
|
||||
'If e.Row.DBCampo("AVG_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlAVGTotal").Text = ""
|
||||
'If e.Row.DBCampo("MIN_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlMinTotal").Text = ""
|
||||
If e.Row.DBCampo("Total").ToDouble < 0 Then e.Row.Cells(12).ForeColor = Drawing.Color.Red
|
||||
If e.Row.DBCampo("Total").ToDouble < 0 Then e.Row.Cells(13).ForeColor = Drawing.Color.Red
|
||||
|
||||
|
||||
'If e.Row.DBCampo("MAX_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlMaxSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("AVG_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlAVGSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("MIN_SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlMinSubTotal").Text = ""
|
||||
'If e.Row.DBCampo("MAX_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlMaxTotal").Text = ""
|
||||
'If e.Row.DBCampo("AVG_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlAVGTotal").Text = ""
|
||||
'If e.Row.DBCampo("MIN_Total").ToDouble = 0 Then e.Row.FCLiteral("LtlMinTotal").Text = ""
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvVsh_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVsh.RowDataBound
|
||||
@@ -634,11 +634,11 @@ Partial Class RepVentaDetalle
|
||||
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
|
||||
|
||||
End If
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "PERSONALIZAR COLUMNAS"
|
||||
|
||||
|
||||
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
||||
|
||||
If ChkFolio.Checked Then
|
||||
@@ -822,10 +822,10 @@ Partial Class RepVentaDetalle
|
||||
ImgExcelPersonalizado.Visible = False
|
||||
End If
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "IMPRESIONES"
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
'GvDatos.ExportToExcel("DetalleVentas_" & Now.ToShortDateString)
|
||||
@@ -876,8 +876,8 @@ Partial Class RepVentaDetalle
|
||||
|
||||
pathPDF = Server.MapPath(String.Format("~/Empresas/{0}/PDF/{1}/{2}.pdf", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString))
|
||||
|
||||
If Not IO.File.Exists(pathPDF) Then
|
||||
GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero, UsuarioActual.CveUsuario)
|
||||
If Not IO.File.Exists(pathPDF) Then
|
||||
GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero, UsuarioActual.CveUsuario)
|
||||
'ListaPDF.Add(New MFacturaDescarga() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero, .PDF = GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero, 100)})
|
||||
End If
|
||||
End If
|
||||
@@ -886,8 +886,8 @@ Partial Class RepVentaDetalle
|
||||
'D E S C A R G A I O N I C !
|
||||
Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
|
||||
Using DescargaZIP
|
||||
DescargaZIP.UseZip64WhenSaving = Ionic.Zip.Zip64Option.AsNecessary
|
||||
|
||||
DescargaZIP.UseZip64WhenSaving = Ionic.Zip.Zip64Option.AsNecessary
|
||||
|
||||
For Each gvr As GridViewRow In GvDatos.Rows
|
||||
If gvr.DataKey("CveVenta").ToEntero > 0 Then
|
||||
Select Case gvr.DataKey("TipoDocumento").ToString
|
||||
@@ -912,9 +912,9 @@ Partial Class RepVentaDetalle
|
||||
If IO.File.Exists(pathPDF) Then
|
||||
'NO AGREGAR ARCHIVOS REPETIDOS
|
||||
Dim File As New IO.FileInfo(pathPDF)
|
||||
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
|
||||
DescargaZIP.AddFile(pathPDF, gvr.DataKey("TipoDocumento").ToString)
|
||||
End If
|
||||
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
|
||||
DescargaZIP.AddFile(pathPDF, gvr.DataKey("TipoDocumento").ToString)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@@ -923,7 +923,7 @@ Partial Class RepVentaDetalle
|
||||
Response.AddHeader("content-Disposition", "attachment; filename=ReporteVentasPDF.zip")
|
||||
Response.ContentType = "application/zip"
|
||||
Response.End()
|
||||
End Sub
|
||||
End Sub
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||
Dim File As Byte() = Nothing
|
||||
@@ -978,8 +978,8 @@ Partial Class RepVentaDetalle
|
||||
If IO.File.Exists(pathXML) Then
|
||||
'NO AGREGAR ARCHIVOS REPETIDOS
|
||||
Dim File As New IO.FileInfo(pathXML)
|
||||
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
|
||||
DescargaZIP.AddFile(pathXML, gvr.DataKey("TipoDocumento").ToString)
|
||||
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
|
||||
DescargaZIP.AddFile(pathXML, gvr.DataKey("TipoDocumento").ToString)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -1014,13 +1014,15 @@ Partial Class RepVentaDetalle
|
||||
Vendedor = If(DdlVendedor.GetSelectedText = "", "", $" <b>Vendedor:</b> {DdlVendedor.GetSelectedText}")
|
||||
CveUsuario = If(DdlUsuario.SelectedValue = "-1", "", $" <b>Usuario:</b> {DdlUsuario.SelectedItem.Text}")
|
||||
CveEstatusFactura = If(DdlEstatus.GetSelectedText = "", "", $" <b>Estatus:</b> {DdlEstatus.GetSelectedText}")
|
||||
CondicionesPago = If(DdlCondicionesPago.selectedValue = "-1", "", String.Format(" <b>Condiciones Pago</b>: {0}", DdlCondicionesPago.SelectedItem.Text))
|
||||
|
||||
|
||||
CondicionesPago = If(DdlCondicionesPago.selectedValue = "-1", "", String.Format(" <b>Condiciones Pago</b>: {0}", DdlCondicionesPago.SelectedItem.Text))
|
||||
|
||||
|
||||
Dim RutaFormato = String.Format("{0}Formatos\RepVentaDetalle.rdlc", UsuarioActual.Empresa.Ruta)
|
||||
Dim Archivo As New System.IO.FileInfo(RutaFormato)
|
||||
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", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim logouri = String.Format("file://{0}", Imagen.FullName)
|
||||
|
||||
Dim dt As DataTable = DtVentas.FiltraParametros("(GPO IS NULL AND Cantidad IS NOT NULL) OR (GPO IS NOT NULL AND Cantidad IS NOT NULL)")
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
@@ -1050,134 +1052,134 @@ Partial Class RepVentaDetalle
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Private Function GenerarFacturaVentaDEV(CveVenta As Integer, CveUsuario As Integer) As Byte()
|
||||
|
||||
Return DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, CveUsuario)
|
||||
'Dim ObjVentas As New ClsVentas
|
||||
'Dim Vta As Modelos.Factura = Nothing
|
||||
|
||||
'Dim TmpDTImpuestos = New DataTable
|
||||
'TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String))
|
||||
'TmpDTImpuestos.Columns.Add("Importe", GetType(Double))
|
||||
'TmpDTImpuestos.Columns.Add("Orden", GetType(Integer))
|
||||
|
||||
'If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
' Dim dtVentas As DataTable = ObjVentas.DtResultados
|
||||
|
||||
' ' se rellenan los campos de la factura
|
||||
' Vta = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, Server.MapPath("/"))
|
||||
|
||||
' Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString
|
||||
' 'se rellena la sucursal
|
||||
' Vta.Cliente.Sucursal = New Modelos.ClienteModel(dtVentas(0)("CveCliente").ToString.ToEntero, UsuarioActual.CveEmpresa)
|
||||
' Vta.Cliente = New Modelos.ClienteModel
|
||||
' Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString
|
||||
' Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString
|
||||
' Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString
|
||||
' Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString
|
||||
' Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString
|
||||
' Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString
|
||||
' Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString
|
||||
' Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString
|
||||
' Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString
|
||||
' Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString
|
||||
' Vta.AtencionA = dtVentas(0)("AtencionA").ToString
|
||||
' Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString
|
||||
' Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString
|
||||
' Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString
|
||||
' Vta.Cliente.Mail = dtVentas(0)("Mail").ToString
|
||||
' Vta.RefDocto = dtVentas(0)("Ref").ToString
|
||||
' Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero
|
||||
|
||||
|
||||
' Vta.ClienteSucursal = New Modelos.SucursalModel
|
||||
' Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString
|
||||
' Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString
|
||||
' Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString
|
||||
' Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString
|
||||
' Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString
|
||||
' Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString
|
||||
' Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString
|
||||
' Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString
|
||||
' Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString
|
||||
' Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString
|
||||
' Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString
|
||||
' Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString
|
||||
|
||||
' Vta.EnviarA = New Modelos.EnviarAModel
|
||||
' Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero
|
||||
' Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString
|
||||
' Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString
|
||||
' Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString
|
||||
' Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString
|
||||
' Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString
|
||||
|
||||
' Dim DR As DataRow = TmpDTImpuestos.NewRow()
|
||||
' If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then
|
||||
' If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("IVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR)
|
||||
|
||||
' 'solo para eclipse, que muesre un subtotal debajo de IVA
|
||||
' If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 1000 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra
|
||||
' Vta.DtDetalle = ObjVentas.DtResultados
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then
|
||||
' If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then
|
||||
' Dim dtImpuesto As DataTable = ObjVentas.DtResultados
|
||||
' If dtImpuesto.Rows.Count > 0 Then
|
||||
' For Each Row As DataRow In dtImpuesto.Rows
|
||||
' Dim Orden = 80
|
||||
' If Row("Importe").ToString.ToDouble <> 0 Then
|
||||
' DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString
|
||||
' DR("Importe") = Row("Importe").ToString.ToDouble
|
||||
' DR("Orden") = Orden
|
||||
' TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' Orden = Orden + 1
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
' Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
||||
' Else
|
||||
' Vta.DtDeduccion = ObjVentas.DtResultados
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentasFirmas(CveVenta) Then
|
||||
' Vta.DtFirmas = ObjVentas.DtResultados
|
||||
' End If
|
||||
'End If
|
||||
'ObjVentas.Dispose()
|
||||
|
||||
'If Not IsNothing(Vta) Then
|
||||
' PdfFactura(Vta)
|
||||
' Vta = Nothing
|
||||
'End If
|
||||
|
||||
End Function
|
||||
|
||||
Private Function GenerarFacturaVentaDEV(CveVenta As Integer, CveUsuario As Integer) As Byte()
|
||||
|
||||
Return DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, CveUsuario)
|
||||
'Dim ObjVentas As New ClsVentas
|
||||
'Dim Vta As Modelos.Factura = Nothing
|
||||
|
||||
'Dim TmpDTImpuestos = New DataTable
|
||||
'TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String))
|
||||
'TmpDTImpuestos.Columns.Add("Importe", GetType(Double))
|
||||
'TmpDTImpuestos.Columns.Add("Orden", GetType(Integer))
|
||||
|
||||
'If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
' Dim dtVentas As DataTable = ObjVentas.DtResultados
|
||||
|
||||
' ' se rellenan los campos de la factura
|
||||
' Vta = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, Server.MapPath("/"))
|
||||
|
||||
' Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString
|
||||
' 'se rellena la sucursal
|
||||
' Vta.Cliente.Sucursal = New Modelos.ClienteModel(dtVentas(0)("CveCliente").ToString.ToEntero, UsuarioActual.CveEmpresa)
|
||||
' Vta.Cliente = New Modelos.ClienteModel
|
||||
' Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString
|
||||
' Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString
|
||||
' Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString
|
||||
' Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString
|
||||
' Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString
|
||||
' Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString
|
||||
' Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString
|
||||
' Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString
|
||||
' Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString
|
||||
' Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString
|
||||
' Vta.AtencionA = dtVentas(0)("AtencionA").ToString
|
||||
' Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString
|
||||
' Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString
|
||||
' Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString
|
||||
' Vta.Cliente.Mail = dtVentas(0)("Mail").ToString
|
||||
' Vta.RefDocto = dtVentas(0)("Ref").ToString
|
||||
' Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero
|
||||
|
||||
|
||||
' Vta.ClienteSucursal = New Modelos.SucursalModel
|
||||
' Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString
|
||||
' Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString
|
||||
' Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString
|
||||
' Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString
|
||||
' Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString
|
||||
' Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString
|
||||
' Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString
|
||||
' Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString
|
||||
' Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString
|
||||
' Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString
|
||||
' Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString
|
||||
' Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString
|
||||
|
||||
' Vta.EnviarA = New Modelos.EnviarAModel
|
||||
' Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero
|
||||
' Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString
|
||||
' Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString
|
||||
' Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString
|
||||
' Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString
|
||||
' Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString
|
||||
|
||||
' Dim DR As DataRow = TmpDTImpuestos.NewRow()
|
||||
' If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then
|
||||
' If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("IVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR)
|
||||
|
||||
' 'solo para eclipse, que muesre un subtotal debajo de IVA
|
||||
' If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 1000 : TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra
|
||||
' Vta.DtDetalle = ObjVentas.DtResultados
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then
|
||||
' If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then
|
||||
' Dim dtImpuesto As DataTable = ObjVentas.DtResultados
|
||||
' If dtImpuesto.Rows.Count > 0 Then
|
||||
' For Each Row As DataRow In dtImpuesto.Rows
|
||||
' Dim Orden = 80
|
||||
' If Row("Importe").ToString.ToDouble <> 0 Then
|
||||
' DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString
|
||||
' DR("Importe") = Row("Importe").ToString.ToDouble
|
||||
' DR("Orden") = Orden
|
||||
' TmpDTImpuestos.Rows.Add(DR)
|
||||
' DR = TmpDTImpuestos.NewRow()
|
||||
' Orden = Orden + 1
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
' Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
||||
' Else
|
||||
' Vta.DtDeduccion = ObjVentas.DtResultados
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' If ObjVentas.GetVentasFirmas(CveVenta) Then
|
||||
' Vta.DtFirmas = ObjVentas.DtResultados
|
||||
' End If
|
||||
'End If
|
||||
'ObjVentas.Dispose()
|
||||
|
||||
'If Not IsNothing(Vta) Then
|
||||
' PdfFactura(Vta)
|
||||
' Vta = Nothing
|
||||
'End If
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "GRAFICA"
|
||||
|
||||
|
||||
Private Sub CreaDataTableColor()
|
||||
DtColor = New DataTable
|
||||
DtColor.Columns.Add("Color")
|
||||
@@ -1308,9 +1310,9 @@ Partial Class RepVentaDetalle
|
||||
|
||||
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CambioGrafica()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user