Commit inicial Ventas Productivo
This commit is contained in:
297
Bancos/RepIngresosPorComprobar.aspx.vb
Normal file
297
Bancos/RepIngresosPorComprobar.aspx.vb
Normal file
@@ -0,0 +1,297 @@
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Bancos_RepIngresosPorComprobar
|
||||
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
|
||||
|
||||
Private Property DtAnticipos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtAnticipos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtAnticipos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
'DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
'DdlProveedores.DataBind()
|
||||
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(91) Then
|
||||
DdlUsuarioRegistro.DataSource = GlobalDTUsuarios.FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa), "Nombre") 'GlobalDTUsuarioResponsable.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
DdlUsuarioRegistro.DataBind()
|
||||
DdlUsuarioRegistro.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
Else
|
||||
DdlUsuarioRegistro.DataSource = GlobalDTUsuarios(UsuarioActual.CveUsuario)
|
||||
DdlUsuarioRegistro.DataBind()
|
||||
End If
|
||||
|
||||
|
||||
DdlMoneda.DataSource = GlobalDTMonedas
|
||||
DdlMoneda.DataBind()
|
||||
|
||||
TxtFecha.Text = Now.ToShortDateString
|
||||
|
||||
CargaDatos()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim Mov As New ClsMovimientos
|
||||
Dim FechaI, FechaF As String
|
||||
|
||||
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
|
||||
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
|
||||
|
||||
|
||||
If Mov.GetIngresosPorComprobar(FechaI, FechaF, DdlClientes.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, If(ChkSaldo.Checked, 1, 0), UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = Mov.DtResultados
|
||||
CargaGrid("")
|
||||
UPDatos.Update()
|
||||
|
||||
End If
|
||||
|
||||
If Mov.GetIngresosAnticiposPorComprobar(FechaI, FechaF, DdlClientes.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, If(ChkSaldo.Checked, 1, 0), UsuarioActual.CveEmpresa) Then
|
||||
DtAnticipos = Mov.DtResultados
|
||||
CargaGrid("")
|
||||
UpAnt.Update()
|
||||
|
||||
End If
|
||||
|
||||
Mov.Dispose()
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnCargarProveedores_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
|
||||
DdlClientes.CssClass += " select2me"
|
||||
DdlClientes.Items.Clear()
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
|
||||
DdlClientes.DataBind()
|
||||
DdlClientes.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlClientes.Attributes.Remove("onclick")
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvIPC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvIPC.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("CveCliente") = "" 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
|
||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
||||
End If
|
||||
|
||||
|
||||
If e.Row.RowIndex = 1 Then
|
||||
e.Row.Cells(1).Width = Unit.Pixel(520)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(150)
|
||||
e.Row.Cells(6).Width = Unit.Pixel(100)
|
||||
End If
|
||||
|
||||
'Sustituido 3-5 lineas mas abajo
|
||||
'If e.Row.DBCampo("FechaDocumento") = "" Then e.Row.BackColor = Drawing.Color.LightGray
|
||||
|
||||
'CUANDO ES SUBTITULO
|
||||
If e.Row.DBCampo("CveIE") = "" Then
|
||||
|
||||
If e.Row.DBCampo("CveMoneda") = "" Then
|
||||
e.Row.CssClass = "SubTotales2 !important"
|
||||
Else
|
||||
'e.Row.CssClass = "SubTotales"
|
||||
e.Row.FCLiteral("LtMoneda").Visible = True
|
||||
e.Row.FCHyperLink("Hpl").Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'LINK A IE
|
||||
If e.Row.DBCampo("Folio") <> "" Then
|
||||
e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(1).ForeColor = Drawing.Color.Red
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvAnt_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAnt.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("CveCliente") = "" 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
|
||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
||||
End If
|
||||
|
||||
|
||||
If e.Row.RowIndex = 1 Then
|
||||
e.Row.Cells(1).Width = Unit.Pixel(520)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(50)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(150)
|
||||
End If
|
||||
|
||||
'Sustituido 3-5 lineas mas abajo
|
||||
'If e.Row.DBCampo("FechaDocumento") = "" Then e.Row.BackColor = Drawing.Color.LightGray
|
||||
|
||||
'CUANDO ES SUBTITULO
|
||||
If e.Row.DBCampo("CveVenta") = "" Then
|
||||
|
||||
If e.Row.DBCampo("CveMoneda") = "" Then
|
||||
e.Row.CssClass = "SubTotales2 !important"
|
||||
Else
|
||||
'e.Row.CssClass = "SubTotales"
|
||||
e.Row.FCLiteral("LtMoneda").Visible = True
|
||||
e.Row.FCHyperLink("Hpl").Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
''LINK A IE
|
||||
'If e.Row.DBCampo("Folio") <> "" Then
|
||||
' e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
|
||||
'End If
|
||||
|
||||
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(1).ForeColor = Drawing.Color.Red
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGrid(Orden As String)
|
||||
GvIPC.DataSource = DtDatos.FiltraParametros("CveCliente IS NOT NULL", Orden)
|
||||
GvIPC.DataBind()
|
||||
|
||||
GvAnt.DataSource = DtAnticipos.FiltraParametros("CveCliente IS NOT NULL", Orden)
|
||||
GvAnt.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim gvi As Integer = 0
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
gvi = Arg(1).ToEntero
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
||||
Campo = Campo.Substring(0, Campo.Length - 1)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo, gvi)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo, gvi)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo, gvi)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo, gvi)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
' CargaGv(Orden, gvi)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "SALDAR"
|
||||
|
||||
Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
|
||||
For Each gr As GridViewRow In GvIPC.Rows
|
||||
If gr.DataKey("CveIE") <> "" Then
|
||||
gr.FCCheckBox("Chk").Visible = True
|
||||
LnkSaldar.Visible = True
|
||||
LnkHabilitarSaldar.Visible = False
|
||||
portletBody.Attributes.Remove("style")
|
||||
portletBody.Attributes.Add("style", "display: block;")
|
||||
|
||||
HExtensorFiltro.Attributes.Remove("class")
|
||||
HExtensorFiltro.Attributes.Add("class", "collapse")
|
||||
|
||||
UPFiltros.Update()
|
||||
UPDatos.Update()
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs)
|
||||
RegistraScript("$('#DivModalSaldar').modal();")
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
ObjConta.IniciaTransacSQL()
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
Dim IdCuentaContableOtrosIngresos As Integer = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
|
||||
For Each gr As GridViewRow In GvIPC.Rows
|
||||
If gr.FCCheckBox("Chk").Checked Then
|
||||
Dim IdCtaContable As Integer = 0
|
||||
|
||||
Dim CveCuenta As Integer = 0
|
||||
|
||||
If ObjConta.GetRetCuenta(92, gr.DataKey("CveCliente").ToEntero) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContClientes").ToString.ToEntero
|
||||
CveCuenta = ObjConta.DtResultados.Rows(0)("CveCuentaCliente").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepIngresosPorComprobar", 6, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, TxtFecha.Text.ToDate, "Saldo de IxC por Sistema", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, gr.DataKey("Saldo").ToDecimal, "", 92, "Saldo de IxC por Sistema", TxtFecha.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveCliente:=gr.DataKey("CveCliente").ToEntero, ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then
|
||||
MsgError = "Ocurrio un error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, gr.DataKey("Saldo").ToDecimal, "", 78, "Saldo de IxC por Sistema", TxtFecha.Text.ToDate, -1, IdCuentaContableOtrosIngresos, gr.DataKey("CveIE").ToEntero, ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=-1) Then
|
||||
MsgError = "Ocurrio un error al saldar el movimiento"
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If MsgError = "" Then
|
||||
ObjConta.Commit()
|
||||
CargaDatos()
|
||||
Alert("Los movimientos se saldaron correctamente.")
|
||||
Else
|
||||
ObjConta.RollBack()
|
||||
Alert(MsgError, TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
LnkSaldar.Visible = False
|
||||
LnkHabilitarSaldar.Visible = True
|
||||
UpAcciones.Update()
|
||||
UPFiltros.Update()
|
||||
ObjConta.Dispose()
|
||||
RegistraScript("$('#DivModalSaldar').modal('hide');")
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user