Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

View File

@@ -0,0 +1,178 @@
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Bancos_RepCxCCliente
Inherits ClsPaginas
Private Property DtDatos As DataTable
Get
Return CType(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Protected Sub Page_Load(Sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
DdlMoneda.DataSource = GlobalDTMonedas()
DdlMoneda.DataBind()
If UsuarioActual.CveEmpresa = 119 Then
DdlClientesWS.setEsWebService(True)
Else
DdlClientesWS.setEsWebService(False)
DdlClientesWS.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientesWS.DataBind()
DdlClientesWS.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.DataBind()
'DdlSubProyecto.SelectedValueExist(UsuarioActual.CveSucursal.ToString)
'[IPP] 8 Enero 2018 - Se quito por que sera reemplazado al cargar solo los subproyectos del usuario
'If UsuarioActual.TienePermisoProceso(152) Then DdlSubProyecto.Enabled = False
InicializaPersonalizarColumnas()
CargaDatos()
End If
End Sub
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim Mov As New ClsMovimientos
Dim FechaI, FechaF As String
Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1)
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
If Mov.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then
GvCxC.DataSource = Mov.DtResultados
End If
Mov.Dispose()
GvCxC.DataBind()
If (GvCxC.Rows.Count > 0) Then
GvCxC.UseAccessibleHeader = True
GvCxC.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
UPDatos.Update()
End If
End Sub
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCxC.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If UsuarioActual.TienePermisoProceso(100) Then
e.Row.FCHyperLink("ImgAbonar").Visible = True
Else
e.Row.FCHyperLink("ImgAbonar").Visible = False
End If
If e.Row.DBCampo("CveCliente") = "" AndAlso e.Row.DBCampo("CveSubProyecto") = "" Then
e.Row.BackColor = Drawing.Color.LightGray
e.Row.FCHyperLink("ImgAbonar").Visible = False
e.Row.FCHyperLink("Hpl").NavigateUrl = ""
e.Row.FCHyperLink("Hpl").Font.Bold = True
Else
If e.Row.DBCampo("CveCliente") = "" AndAlso e.Row.DBCampo("CveSubProyecto") <> "" Then
e.Row.BackColor = Drawing.Color.LightGray
e.Row.FCHyperLink("ImgAbonar").Visible = False
e.Row.FCHyperLink("Hpl").NavigateUrl = ""
e.Row.FCHyperLink("Hpl").Font.Bold = True
End If
End If
Dim CveSubProyecto As Integer = IIf(DdlAgrupador.SelectedValue = "1", e.Row.DBCampo("CveSubProyecto").ToEntero, -1)
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(1).ForeColor = Drawing.Color.Red
'"/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&FechaI={1}&FechaF={2}&CveUsuarioProgramo={3}&CveMoneda={4}&Serie={5}&CveUsuario={6}", e.Row.DBCampo("CveProveedor"), If(txtFechaI.Text <> "", txtFechaI.Text, "-1"), If(txtFechaF.Text <> "", txtFechaF.Text, "-1"), DdlUsuarioProgramo.SelectedValue, e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("Serie"), e.Row.DBCampo("CveUsuario")
e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Ventas/ClientesAbonar.aspx?CveCliente={0}&FechaI={1}&FechaF={2}&CveMoneda={3}&CveUsuario={4}&CveSubProyecto={5}&CveClienteSucursal={6}", e.Row.DBCampo("CveCliente"), e.Row.DBCampo("FechaI"), e.Row.DBCampo("FechaF"), e.Row.DBCampo("CveMoneda"), UsuarioActual.CveUsuario, CveSubProyecto, e.Row.DBCampo("CveClienteSucursal"))
End If
End Sub
#Region " PERSONALIZAR COLUMNAS "
Private Sub InicializaPersonalizarColumnas()
'[IPP] SI ES JAM POR DEFAULT MUESTRA COLUMNA SUCURSAL
ChkSucursal.Checked = UsuarioActual.CveEmpresa = 119
GvCxC.Columns(1).Visible = UsuarioActual.CveEmpresa = 119
End Sub
Protected Sub BtnPersonalizarColumnas_Click(sender As Object, e As EventArgs)
GvCxC.Columns(1).Visible = ChkSucursal.Checked
CargaDatos()
RegistraScript("$('#ModalPersonalizarColumnas').modal('hide')", "ModalPersonalizarColumnasHide")
End Sub
#End Region
#Region " I M P R I M I R P D F"
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs)
GenerarPDFpp()
End Sub
Private Sub GenerarPDFpp()
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)
'OBTENEMOS LOS DATOS
Dim ObjMovtos As New ClsMovimientos()
Dim DTpp As DataTable
Dim FI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
Dim FF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
Dim FechaI, FechaF As String
Dim CveUsuarioProgramo As Integer = -1
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1)
If ObjMovtos.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then
DTpp = ObjMovtos.DtResultados
Else
DTpp = Nothing
End If
If DTpp.Rows.Count > 0 Then
Dim dr As DataRow = DTpp.Rows(0)
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("FechaInicio", FI))
params.Add(New ReportParameter("FechaFin", FF))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/RepPagoClientes.rdlc", DTpp, params, "ReportePagoClientes")
Else
Alert("No se tienen registrados movimientos", TipoMensaje.MsgAdvertencia)
End If
ObjMovtos.Dispose()
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click
GvCxC.ExportToExcel("CxC Cliente" & Now.ToShortDateString)
End Sub
#End Region
End Class