4to. Revisión Promociones
This commit is contained in:
@@ -5,6 +5,7 @@ Imports System.Activities.Expressions
|
||||
Imports System.Data
|
||||
Imports DocumentFormat.OpenXml.Office.CustomUI
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Partial Class Ventas_RepPedidosSTF
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -66,6 +67,8 @@ Partial Class Ventas_RepPedidosSTF
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaDatos()
|
||||
LnkImprimirPedidos.Visible = False
|
||||
|
||||
|
||||
DatosGV = New DataTable
|
||||
|
||||
@@ -97,7 +100,9 @@ Partial Class Ventas_RepPedidosSTF
|
||||
DatosGV.Columns.Add("CodigoPSOrg", GetType(String))
|
||||
|
||||
GvDatos.DataSource = DatosGV
|
||||
|
||||
If DatosGV IsNot Nothing AndAlso DatosGV.Rows.Count > 0 Then
|
||||
LnkImprimirPedidos.Visible = True
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
GvDatos.DataBind()
|
||||
@@ -113,7 +118,17 @@ Partial Class Ventas_RepPedidosSTF
|
||||
DTProductosEdicion = New DataTable
|
||||
Dim ObjVentas As ClsVentas = New ClsVentas()
|
||||
If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then
|
||||
DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
|
||||
|
||||
|
||||
DTProductosEdicion = ObjVentas.DtResultados
|
||||
'If UsuarioActual.CveRol = 1 Then
|
||||
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros("", "CodigoPS", {"CvePS", "CodigoPS", "Precio"})
|
||||
'Else
|
||||
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
@@ -137,7 +152,7 @@ Partial Class Ventas_RepPedidosSTF
|
||||
If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then
|
||||
Else
|
||||
|
||||
e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion
|
||||
e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion.FiltraParametros($"CveVendedor = {e.Row.DataKey("CveVendedor")}")
|
||||
e.Row.FCDropDownList("DdlPS").DataBind()
|
||||
e.Row.FCDropDownList("DdlPS").SelectedValueExist(e.Row.DBCampo("CvePS"))
|
||||
|
||||
@@ -232,6 +247,7 @@ Partial Class Ventas_RepPedidosSTF
|
||||
TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal))
|
||||
TmpDTRemis.Columns.Add("Observacion", GetType(String))
|
||||
|
||||
|
||||
TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal))
|
||||
TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer))
|
||||
TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String))
|
||||
@@ -256,11 +272,22 @@ Partial Class Ventas_RepPedidosSTF
|
||||
drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero
|
||||
drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg")
|
||||
|
||||
|
||||
TmpDTRemis.Rows.Add(drp)
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Dim DTDeriesFolio As DataTable = TmpDTRemis.FiltraParametros("", "", {"Observacion"})
|
||||
Dim Observaciones As String = ""
|
||||
Dim lista As New List(Of String)
|
||||
For Each drow As DataRow In DTDeriesFolio.Rows
|
||||
lista.Add(drow("Observacion").ToString)
|
||||
Next
|
||||
|
||||
Observaciones = String.Join(", ", lista)
|
||||
|
||||
|
||||
|
||||
If TmpDTRemis IsNot Nothing AndAlso TmpDTRemis.Rows.Count = 0 Then
|
||||
Alert("No se ha seleccionado ninguna partida, favor de seleccionar", TipoMensaje.MsgAdvertencia)
|
||||
@@ -275,7 +302,10 @@ Partial Class Ventas_RepPedidosSTF
|
||||
For Each drt As DataRow In TmpDTRemis.FiltraParametros("", DistinctColumns:={"CveCliente", "CveSubProyecto", "CveVendedor", "GastosEnvio"}).Rows
|
||||
|
||||
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, drt("CveSubProyecto").ToString.ToEntero, drt("CveCliente").ToString.ToEntero, 1, "Rem")
|
||||
|
||||
ObjFactura.CveVendedor = drt("CveVendedor").ToString.ToEntero
|
||||
ObjFactura.Observaciones = Observaciones
|
||||
|
||||
For Each dr As DataRow In TmpDTRemis.FiltraParametros($"CveCliente ={drt("CveCliente")} AND CveVendedor = {drt("CveVendedor")} AND CveSubProyecto = {drt("CveSubProyecto")}").Rows
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
@@ -296,7 +326,7 @@ Partial Class Ventas_RepPedidosSTF
|
||||
TieneError = True
|
||||
Exit For
|
||||
Else
|
||||
If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 0) Then
|
||||
If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
@@ -343,4 +373,48 @@ Partial Class Ventas_RepPedidosSTF
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkImprimirPedidos_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim FechaI As String = txtFechaI.Text
|
||||
Dim FechaF As String = txtFechaF.Text
|
||||
If txtFechaI.Text = "" Then FechaI = "-1"
|
||||
If txtFechaF.Text = "" Then FechaF = "-1"
|
||||
|
||||
Dim Sucursal As String = If(DdlSubProyecto.SelectedValue = "-1", "", $" <b>Sucursal:</b> {DdlSubProyecto.SelectedItem.Text}")
|
||||
Dim Vendedor As String = If(DdlVendedor.SelectedValue = "-1", "", $" <b>Vendedor:</b> {DdlVendedor.SelectedItem.Text}")
|
||||
|
||||
Dim FechaIn As String = If(txtFechaI.Text = "", "", $" <b>Fecha Inicio:</b> {txtFechaI.Text}")
|
||||
Dim FechaFn As String = If(txtFechaF.Text = "", "", $" <b>Fecha Fin:</b> {txtFechaF.Text}")
|
||||
|
||||
Dim TituloReporte As String = "Reporte de Pedidos"
|
||||
|
||||
If DatosGV.Rows.Count > 0 Then
|
||||
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepProveedorCxP.rpt", UsuarioActual.Empresa.Ruta))
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("TituloReporte", TituloReporte))
|
||||
params.Add(New ReportParameter("AgrupadoPor", $" {Sucursal}{Vendedor}{FechaIn}{FechaFn}"))
|
||||
|
||||
If Imagen.Exists Then ''POR EMPRESA
|
||||
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepPedidos.rdlc", DatosGV, params, "ReportePedidos")
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user