@@ -1,371 +1,371 @@
Option Explicit On
Option Strict On
Imports Extensiones
Imports Microsoft . Reporting . WebForms
Imports System . Data
Partial Class PopUpAuxiliar
Inherits ClsPaginas
Private Property Tipo As String
Get
Return ViewState ( " Tipo " ) . ToString
End Get
Set ( value As String )
ViewState ( " Tipo " ) = value
End Set
End Property
Private Property CveCliente As Integer
Get
Return ViewState ( " CveCliente " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveCliente " ) = value
End Set
End Property
Private Property CveVenta As Integer
Get
Return ViewState ( " CveVenta " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveVenta " ) = value
End Set
End Property
Private Property CveProveedor As Integer
Get
Return ViewState ( " CveProveedor " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveProveedor " ) = value
End Set
End Property
Private Property CveCompra As Integer
Get
Return ViewState ( " CveCompra " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveCompra " ) = value
End Set
End Property
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 System . EventArgs ) Handles Me . Load
If Not IsPostBack Then
CType ( Me . Master , BaseMasterPage ) . EsPopup = True
CType ( Me . Master , BaseMasterPage ) . PopupWidth = 915
RegistraScript ( " $get('tdContenido').style.height='1000' " )
Tipo = Request ( " Tipo " )
CveCliente = 0
CveProveedor = 0
CargaDatos ( )
End If
End Sub
Private Sub CargaDatos ( )
GVAuxiliar . Columns ( 10 ) . Visible = UsuarioActual . TienePermisoProceso ( 94 )
Option Explicit On
Option Strict On
Imports Extensiones
Imports Microsoft . Reporting . WebForms
Imports System . Data
Partial Class PopUpAuxiliar
Inherits ClsPaginas
Private Property Tipo As String
Get
Return ViewState ( " Tipo " ) . ToString
End Get
Set ( value As String )
ViewState ( " Tipo " ) = value
End Set
End Property
Private Property CveCliente As Integer
Get
Return ViewState ( " CveCliente " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveCliente " ) = value
End Set
End Property
Private Property CveVenta As Integer
Get
Return ViewState ( " CveVenta " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveVenta " ) = value
End Set
End Property
Private Property CveProveedor As Integer
Get
Return ViewState ( " CveProveedor " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveProveedor " ) = value
End Set
End Property
Private Property CveCompra As Integer
Get
Return ViewState ( " CveCompra " ) . ToString . ToEntero
End Get
Set ( value As Integer )
ViewState ( " CveCompra " ) = value
End Set
End Property
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 System . EventArgs ) Handles Me . Load
If Not IsPostBack Then
CType ( Me . Master , BaseMasterPage ) . EsPopup = True
CType ( Me . Master , BaseMasterPage ) . PopupWidth = 915
RegistraScript ( " $get('tdContenido').style.height='1000' " )
Tipo = Request ( " Tipo " )
CveCliente = 0
CveProveedor = 0
CargaDatos ( )
End If
End Sub
Private Sub CargaDatos ( )
GVAuxiliar . Columns ( 10 ) . Visible = UsuarioActual . TienePermisoProceso ( 94 )
'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94)
GVAuxiliar . Columns ( 12 ) . Visible = UsuarioActual . TienePermisoProceso ( 94 )
Select Case Tipo
Case " CxCClientes "
CveCliente = Request ( " CveCliente " ) . ToEntero
CveVenta = Request ( " CveVenta " ) . ToEntero
CargaAuxiliarClienteCxC ( CveCliente , CveVenta )
LtlTipo1 . Text = " Cuentas por Cobrar "
LtlTipo2 . Text = " Folio de la Venta "
LtlTipo3 . Text = " Fecha de la Venta "
Case " AnticiposClientes "
CveCliente = Request ( " CveCliente " ) . ToEntero
CveVenta = Request ( " CveVenta " ) . ToEntero
CargaAuxiliarClienteAnticipos ( CveCliente , CveVenta )
LtlTipo1 . Text = " Anticipo de Clientes "
LtlTipo2 . Text = " Folio de la Venta "
LtlTipo3 . Text = " Fecha de la Venta "
Case " CxPProveedor "
CveProveedor = Request ( " CveProveedor " ) . ToEntero
CveCompra = Request ( " CveCompra " ) . ToEntero
CargaAuxiliarProveedor ( CveProveedor , CveCompra )
LtlTipo1 . Text = " Cuentas por Pagar "
LtlTipo2 . Text = " Folio de la Compra "
LtlTipo3 . Text = " Fecha de la Compra "
End Select
UpDatos . Update ( )
End Sub
Private Sub CargaAuxiliarClienteCxC ( CveCliente As Integer , CveVenta As Integer )
Dim ObjMovtos As New ClsMovimientos ( )
If ObjMovtos . GetCxCClienteAuxiliar ( CveCliente , CveVenta ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
LtlImporte . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Total " ) . ToString . FormatoNumero ( 2 )
LtlSaldo . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Saldo " ) . ToString . FormatoNumero ( 2 )
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
Private Sub CargaAuxiliarClienteAnticipos ( CveCliente As Integer , CveVenta As Integer )
Dim ObjMovtos As New ClsMovimientos ( )
If ObjMovtos . GetAnticiposClienteAuxiliar ( CveCliente , CveVenta ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2)
'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2)
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
Private Sub CargaAuxiliarProveedor ( CveProveedor As Integer , CveCompra As Integer )
Dim ObjMovtos As New ClsContabilidad ( )
If ObjMovtos . GetProveedorAuxiliar ( CveProveedor , CveCompra ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
LtlImporte . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Total " ) . ToString . FormatoNumero ( 2 )
LtlSaldo . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Saldo " ) . ToString . FormatoNumero ( 2 )
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
GVAuxiliar . Columns ( 12 ) . Visible = UsuarioActual . TienePermisoProceso ( 94 )
Select Case Tipo
Case " CxCClientes "
CveCliente = Request ( " CveCliente " ) . ToEntero
CveVenta = Request ( " CveVenta " ) . ToEntero
CargaAuxiliarClienteCxC ( CveCliente , CveVenta )
LtlTipo1 . Text = " Cuentas por Cobrar "
LtlTipo2 . Text = " Folio de la Venta "
LtlTipo3 . Text = " Fecha de la Venta "
Case " AnticiposClientes "
CveCliente = Request ( " CveCliente " ) . ToEntero
CveVenta = Request ( " CveVenta " ) . ToEntero
CargaAuxiliarClienteAnticipos ( CveCliente , CveVenta )
LtlTipo1 . Text = " Anticipo de Clientes "
LtlTipo2 . Text = " Folio de la Venta "
LtlTipo3 . Text = " Fecha de la Venta "
Case " CxPProveedor "
CveProveedor = Request ( " CveProveedor " ) . ToEntero
CveCompra = Request ( " CveCompra " ) . ToEntero
CargaAuxiliarProveedor ( CveProveedor , CveCompra )
LtlTipo1 . Text = " Cuentas por Pagar "
LtlTipo2 . Text = " Folio de la Compra "
LtlTipo3 . Text = " Fecha de la Compra "
End Select
UpDatos . Update ( )
End Sub
Private Sub CargaAuxiliarClienteCxC ( CveCliente As Integer , CveVenta As Integer )
Dim ObjMovtos As New ClsMovimientos ( )
If ObjMovtos . GetCxCClienteAuxiliar ( CveCliente , CveVenta ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
LtlImporte . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Total " ) . ToString . FormatoNumero ( 2 )
LtlSaldo . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Saldo " ) . ToString . FormatoNumero ( 2 )
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
Private Sub CargaAuxiliarClienteAnticipos ( CveCliente As Integer , CveVenta As Integer )
Dim ObjMovtos As New ClsMovimientos ( )
If ObjMovtos . GetAnticiposClienteAuxiliar ( CveCliente , CveVenta ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2)
'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2)
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
Private Sub CargaAuxiliarProveedor ( CveProveedor As Integer , CveCompra As Integer )
Dim ObjMovtos As New ClsContabilidad ( )
If ObjMovtos . GetProveedorAuxiliar ( CveProveedor , CveCompra ) Then
DTDatos = ObjMovtos . DtResultados
GVAuxiliar . DataSource = ObjMovtos . DtResultados
If ObjMovtos . DtResultados . Rows . Count > 0 Then
LtlFechaVenta . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " FechaVenta " ) . ToString . ToDate . ToShortDateString ( )
LtlFolio . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Folio " ) . ToString
LtlImporte . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Total " ) . ToString . FormatoNumero ( 2 )
LtlSaldo . Text = ObjMovtos . DtResultados . Rows ( 1 ) ( " Saldo " ) . ToString . FormatoNumero ( 2 )
End If
Else
GVAuxiliar . DataSource = Nothing
End If
ObjMovtos . Dispose ( )
GVAuxiliar . DataBind ( )
End Sub
Protected Sub GVAuxiliar_RowDataBound ( sender As Object , e As System . Web . UI . WebControls . GridViewRowEventArgs ) Handles GVAuxiliar . RowDataBound
If e . Row . RowType = DataControlRowType . DataRow Then
If e . Row . RowIndex = 0 Then
e . Row . BackColor = Drawing . Color . LightGray
e . Row . FCLiteral ( " LtlFechaMovto " ) . Text = " Totales: "
e . Row . Cells ( 0 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 0 ) . ColumnSpan = 2
e . Row . Cells ( 1 ) . Visible = False
e . Row . Cells ( 4 ) . ColumnSpan = 3
e . Row . Cells ( 5 ) . Visible = False
e . Row . Cells ( 6 ) . Visible = False
e . Row . Cells ( 7 ) . Visible = False
e . Row . Cells ( 8 ) . Visible = False
e . Row . Cells ( 12 ) . Visible = False
ElseIf e . Row . RowIndex = 1 Then
e . Row . Cells ( 0 ) . Width = Unit . Pixel ( 95 )
e . Row . Cells ( 1 ) . Width = Unit . Pixel ( 180 )
e . Row . Cells ( 2 ) . Width = Unit . Pixel ( 80 )
e . Row . Cells ( 3 ) . Width = Unit . Pixel ( 80 )
e . Row . Cells ( 4 ) . Width = Unit . Pixel ( 83 )
e . Row . Cells ( 5 ) . Width = Unit . Pixel ( 93 )
e . Row . Cells ( 6 ) . Width = Unit . Pixel ( 85 )
e . Row . Cells ( 7 ) . Width = Unit . Pixel ( 95 )
e . Row . Cells ( 8 ) . Width = Unit . Pixel ( 70 )
End If
e . Row . Cells ( 1 ) . HorizontalAlign = HorizontalAlign . Left
e . Row . Cells ( 2 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 3 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 4 ) . HorizontalAlign = HorizontalAlign . Left
If e . Row . FCLiteral ( " LtlContabilizado " ) . Text = " Si " Then
Dim Liga As String = String . Format ( " <a class= "" Texto "" href= "" /Contabilidad/RegPoliza.aspx?IdPoliza={0} "" > " , e . Row . DBCampo ( " IdPoliza " ) )
e . Row . FCLiteral ( " LtlPoliza " ) . Text = String . Format ( " {0}{1}</a> " , Liga , e . Row . DBCampo ( " Poliza " ) )
End If
If e . Row . DBCampo ( " CveConceptoContable " ) . ToEntero . Contiene ( 2 ) AndAlso e . Row . DBCampo ( " CvePersonal " ) . ToEntero > 0 Then
Dim Liga As String = String . Format ( " <a class= "" Texto "" href= "" /RH/Personal.aspx?CvePersonal={0} "" > " , e . Row . DBCampo ( " CvePersonal " ) )
e . Row . FCLiteral ( " LtlConcepto " ) . Text = String . Format ( " {0}{1}</a> " , Liga , e . Row . DBCampo ( " ConceptoContable " ) )
End If
If e . Row . DBCampo ( " TipoReferencia " ) . ToEntero = 1 Then
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Bancos/IE.aspx?CveIE={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then
' e.Row.Cells(10).Text = ""
'End If
ElseIf e . Row . DBCampo ( " TipoReferencia " ) . ToEntero = 2 Then
Select Case Tipo
Case " CxCClientes "
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
Case " CxPProveedor "
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Compras/Compras.aspx?CveCompra={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
End Select
End If
'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then
' Dim Liga As String = String.Format("<a class=""Texto"" href=""/Compras/Compras.aspx?CveCompra={0}"">", e.Row.DBCampo("CveCompraAmortizacion"))
' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
'End If
If e . Row . DBCampo ( " CveConceptoContable " ) . ToEntero . Contiene ( 275 ) AndAlso e . Row . DBCampo ( " CveVenta " ) . ToEntero > 0 Then
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo( "C veVenta " ).ToEntero} "
'Dim Liga As String = String.Format("<a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta"))
'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
End If
End If
End Sub
Protected Sub GvDatos_RowDeleting ( ByVal sender As Object , ByVal e As GridViewDeleteEventArgs ) Handles GVAuxiliar . RowDeleting
Dim ObjContPaq As ClsContPAQi = Nothing
Dim Conta As New ClsContabilidad ( )
Conta . IniciaTransacSQL ( )
Dim ClavePrePoliza = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CvePrePolizaOriginal " ) . ToEntero
Dim IdPoliza = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " IdPoliza " ) . ToEntero
Dim TieneError = False
If Not TieneError Then
If Not Conta . UpdatePrePolizasDetalleBloquear ( ClavePrePoliza , False ) Then
TieneError = True
End If
End If
If Not Conta . RemovePrePolizas ( ClavePrePoliza , UsuarioActual . CveEmpresa ) Then
TieneError = True
End If
If Conta . ValidacionPrePolizaCuadre ( ClavePrePoliza , - 1 ) Then
If Conta . ValorPolizaDescuadre > 0 Then
TieneError = True
End If
End If
If Not TieneError Then
If IdPoliza > 0 Then
If UsuarioActual . Empresa . UsaAC Or UsuarioActual . Empresa . UsaContabilidad Then
ObjContPaq = New ClsContPAQi ( UsuarioActual . Empresa )
ObjContPaq . IniciaTransacSQL ( )
If Not ObjContPaq . RemovePoliza ( IdPoliza ) Then
TieneError = True
End If
End If
End If
End If
If Not TieneError Then
Alert ( " Movimiento Eliminado " , TipoMensaje . MsgInformacion , " window.opener.location.reload(); window.close(); " )
If ObjContPaq IsNot Nothing Then ObjContPaq . Commit ( )
Conta . Commit ( )
Else
If ObjContPaq IsNot Nothing Then ObjContPaq . RollBack ( )
Conta . RollBack ( )
End If
If ObjContPaq IsNot Nothing Then ObjContPaq . Dispose ( )
Conta . Dispose ( )
CargaDatos ( )
End Sub
Private Sub GVAuxiliar_RowUpdating ( sender As Object , e As GridViewUpdateEventArgs ) Handles GVAuxiliar . RowUpdating
Dim CvePrePoliza As Integer
Dim ObjConta As New ClsContabilidad
ObjConta . IniciaTransacSQL ( )
Dim CvePlantillaPoliza As Integer = 0
Dim Importe As Decimal
Dim MsgError As String = " "
If GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Cargo " ) . ToDecimal > GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Abono " ) . ToDecimal Then
Importe = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Cargo " ) . ToDecimal
Else
Importe = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Abono " ) . ToDecimal
End If
If CveCliente > 0 Then CvePlantillaPoliza = 11
If CveProveedor > 0 Then CvePlantillaPoliza = 2
CvePrePoliza = ObjConta . AddPrePolizas ( " Contabilidad/PopUpAuxiliar " , CvePlantillaPoliza , Importe , Importe , 1 , Now , " Cancelacion de Pago " , UsuarioActual . CveUsuario , UsuarioActual . CveEmpresa )
If CvePlantillaPoliza = 2 Then
If Not ObjConta . CancelarPagoCompraConAnticipo ( CvePrePoliza , CveCompra , GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CveReferencia " ) . ToEntero ) Then
MsgError = " Ocurrió un error al cancelar el pago de la compra "
End If
End If
If CvePlantillaPoliza = 11 Then
If Not ObjConta . CancelarPagoVentaConAnticipo ( CvePrePoliza , CveVenta , GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CveReferencia " ) . ToEntero ) Then
MsgError = " Ocurrió un error al cancelar el pago de la venta "
End If
End If
If MsgError = " " Then
ObjConta . Commit ( )
Alert ( " El movimiento se canceló exitosamente. " )
Else
ObjConta . RollBack ( )
Alert ( MsgError , TipoMensaje . MsgError )
End If
ObjConta . Dispose ( )
End Sub
Private Sub LnkExportar_Click ( sender As Object , e As EventArgs ) Handles LnkPagosClientesBancosExcel . Click
GenerarPDF ( " Excel " )
End Sub
Private Sub LinkPDF_Click ( sender As Object , e As EventArgs ) Handles LnkPagosClientesBancosPDF . Click
GenerarPDF ( )
End Sub
Private Sub GenerarPDF ( Optional Formato As String = " PDF " )
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 )
If DTDatos IsNot Nothing And DTDatos . Rows . Count > 0 Then
Dim params As New List ( Of ReportParameter )
params . Add ( New ReportParameter ( " NombreEmpresa " , UsuarioActual . Empresa . Empresa ) )
params . Add ( New ReportParameter ( " UsuarioImprimio " , UsuarioActual . Nombre ) )
params . Add ( New ReportParameter ( " Tipo " , LtlTipo1 . Text ) )
params . Add ( New ReportParameter ( " Folio " , LtlFolio . Text ) )
params . Add ( New ReportParameter ( " Fecha " , LtlFechaVenta . Text ) )
params . Add ( New ReportParameter ( " Importe " , LtlImporte . Text ) )
params . Add ( New ReportParameter ( " Saldo " , LtlSaldo . Text ) )
If Imagen . Exists Then
params . Add ( New ReportParameter ( " LogoPath " , logouri ) )
Else
params . Add ( New ReportParameter ( " LogoPath " , " " ) )
End If
ImprimirPDF ( " Empresas\Grales\Formatos\RepAuxiliarContable.rdlc " , DTDatos , params , " RepAuxiliarContable_ " & LtlFolio . Text , Formato : = Formato )
Else
Alert ( " No se encontró información suficiente. " , TipoMensaje . MsgAdvertencia )
End If
If e . Row . RowType = DataControlRowType . DataRow Then
If e . Row . RowIndex = 0 Then
e . Row . BackColor = Drawing . Color . LightGray
e . Row . FCLiteral ( " LtlFechaMovto " ) . Text = " Totales: "
e . Row . Cells ( 0 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 0 ) . ColumnSpan = 2
e . Row . Cells ( 1 ) . Visible = False
e . Row . Cells ( 4 ) . ColumnSpan = 3
e . Row . Cells ( 5 ) . Visible = False
e . Row . Cells ( 6 ) . Visible = False
e . Row . Cells ( 7 ) . Visible = False
e . Row . Cells ( 8 ) . Visible = False
e . Row . Cells ( 12 ) . Visible = False
ElseIf e . Row . RowIndex = 1 Then
e . Row . Cells ( 0 ) . Width = Unit . Pixel ( 95 )
e . Row . Cells ( 1 ) . Width = Unit . Pixel ( 180 )
e . Row . Cells ( 2 ) . Width = Unit . Pixel ( 80 )
e . Row . Cells ( 3 ) . Width = Unit . Pixel ( 80 )
e . Row . Cells ( 4 ) . Width = Unit . Pixel ( 83 )
e . Row . Cells ( 5 ) . Width = Unit . Pixel ( 93 )
e . Row . Cells ( 6 ) . Width = Unit . Pixel ( 85 )
e . Row . Cells ( 7 ) . Width = Unit . Pixel ( 95 )
e . Row . Cells ( 8 ) . Width = Unit . Pixel ( 70 )
End If
e . Row . Cells ( 1 ) . HorizontalAlign = HorizontalAlign . Left
e . Row . Cells ( 2 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 3 ) . HorizontalAlign = HorizontalAlign . Right
e . Row . Cells ( 4 ) . HorizontalAlign = HorizontalAlign . Left
If e . Row . FCLiteral ( " LtlContabilizado " ) . Text = " Si " Then
Dim Liga As String = String . Format ( " <a class= "" Texto "" href= "" /Contabilidad/RegPoliza.aspx?IdPoliza={0} "" > " , e . Row . DBCampo ( " IdPoliza " ) )
e . Row . FCLiteral ( " LtlPoliza " ) . Text = String . Format ( " {0}{1}</a> " , Liga , e . Row . DBCampo ( " Poliza " ) )
End If
If e . Row . DBCampo ( " CveConceptoContable " ) . ToEntero . Contiene ( 2 ) AndAlso e . Row . DBCampo ( " CvePersonal " ) . ToEntero > 0 Then
Dim Liga As String = String . Format ( " <a class= "" Texto "" href= "" /RH/Personal.aspx?CvePersonal={0} "" > " , e . Row . DBCampo ( " CvePersonal " ) )
e . Row . FCLiteral ( " LtlConcepto " ) . Text = String . Format ( " {0}{1}</a> " , Liga , e . Row . DBCampo ( " ConceptoContable " ) )
End If
If e . Row . DBCampo ( " TipoReferencia " ) . ToEntero = 1 Then
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Bancos/IE.aspx?CveIE={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then
' e.Row.Cells(10).Text = ""
'End If
ElseIf e . Row . DBCampo ( " TipoReferencia " ) . ToEntero = 2 Then
Select Case Tipo
Case " CxCClientes "
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
Case " CxPProveedor "
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Compras/Compras.aspx?CveCompra={e.Row.DBCampo( "C veReferencia " ).ToEntero} "
End Select
End If
'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then
' Dim Liga As String = String.Format("<a class=""Texto"" href=""/Compras/Compras.aspx?CveCompra={0}"">", e.Row.DBCampo("CveCompraAmortizacion"))
' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
'End If
If e . Row . DBCampo ( " CveConceptoContable " ) . ToEntero . Contiene ( 275 ) AndAlso e . Row . DBCampo ( " CveVenta " ) . ToEntero > 0 Then
e . Row . FCHyperLink ( " HplReferencia " ) . NavigateUrl = $ " /Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo( "C veVenta " ).ToEntero} "
'Dim Liga As String = String.Format("<a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta"))
'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
End If
End If
End Sub
Protected Sub GvDatos_RowDeleting ( ByVal sender As Object , ByVal e As GridViewDeleteEventArgs ) Handles GVAuxiliar . RowDeleting
Dim ObjContPaq As ClsContPAQi = Nothing
Dim Conta As New ClsContabilidad ( )
Conta . IniciaTransacSQL ( )
Dim ClavePrePoliza = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CvePrePolizaOriginal " ) . ToEntero
Dim IdPoliza = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " IdPoliza " ) . ToEntero
Dim TieneError = False
If Not TieneError Then
If Not Conta . UpdatePrePolizasDetalleBloquear ( ClavePrePoliza , False ) Then
TieneError = True
End If
End If
If Not Conta . RemovePrePolizas ( ClavePrePoliza , UsuarioActual . CveEmpresa ) Then
TieneError = True
End If
If Conta . ValidacionPrePolizaCuadre ( ClavePrePoliza , - 1 ) Then
If Conta . ValorPolizaDescuadre > 0 Then
TieneError = True
End If
End If
If Not TieneError Then
If IdPoliza > 0 Then
If UsuarioActual . Empresa . UsaAC Or UsuarioActual . Empresa . UsaContabilidad Then
ObjContPaq = New ClsContPAQi ( UsuarioActual . Empresa )
ObjContPaq . IniciaTransacSQL ( )
If Not ObjContPaq . RemovePoliza ( IdPoliza ) Then
TieneError = True
End If
End If
End If
End If
If Not TieneError Then
Alert ( " Movimiento Eliminado " , TipoMensaje . MsgInformacion , " window.opener.location.reload(); window.close(); " )
If ObjContPaq IsNot Nothing Then ObjContPaq . Commit ( )
Conta . Commit ( )
Else
If ObjContPaq IsNot Nothing Then ObjContPaq . RollBack ( )
Conta . RollBack ( )
End If
If ObjContPaq IsNot Nothing Then ObjContPaq . Dispose ( )
Conta . Dispose ( )
CargaDatos ( )
End Sub
Private Sub GVAuxiliar_RowUpdating ( sender As Object , e As GridViewUpdateEventArgs ) Handles GVAuxiliar . RowUpdating
Dim CvePrePoliza As Integer
Dim ObjConta As New ClsContabilidad
ObjConta . IniciaTransacSQL ( )
Dim CvePlantillaPoliza As Integer = 0
Dim Importe As Decimal
Dim MsgError As String = " "
If GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Cargo " ) . ToDecimal > GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Abono " ) . ToDecimal Then
Importe = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Cargo " ) . ToDecimal
Else
Importe = GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " Abono " ) . ToDecimal
End If
If CveCliente > 0 Then CvePlantillaPoliza = 11
If CveProveedor > 0 Then CvePlantillaPoliza = 2
CvePrePoliza = ObjConta . AddPrePolizas ( " Contabilidad/PopUpAuxiliar " , CvePlantillaPoliza , Importe , Importe , 1 , Now , " Cancelacion de Pago " , UsuarioActual . CveUsuario , UsuarioActual . CveEmpresa )
If CvePlantillaPoliza = 2 Then
If Not ObjConta . CancelarPagoCompraConAnticipo ( CvePrePoliza , CveCompra , GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CveReferencia " ) . ToEntero ) Then
MsgError = " Ocurrió un error al cancelar el pago de la compra "
End If
End If
If CvePlantillaPoliza = 11 Then
If Not ObjConta . CancelarPagoVentaConAnticipo ( CvePrePoliza , CveVenta , GVAuxiliar . Rows ( e . RowIndex ) . DataKey ( " CveReferencia " ) . ToEntero ) Then
MsgError = " Ocurrió un error al cancelar el pago de la venta "
End If
End If
If MsgError = " " Then
ObjConta . Commit ( )
Alert ( " El movimiento se canceló exitosamente. " )
Else
ObjConta . RollBack ( )
Alert ( MsgError , TipoMensaje . MsgError )
End If
ObjConta . Dispose ( )
End Sub
Private Sub LnkExportar_Click ( sender As Object , e As EventArgs ) Handles LnkPagosClientesBancosExcel . Click
GenerarPDF ( " Excel " )
End Sub
Private Sub LinkPDF_Click ( sender As Object , e As EventArgs ) Handles LnkPagosClientesBancosPDF . Click
GenerarPDF ( )
End Sub
Private Sub GenerarPDF ( Optional Formato As String = " PDF " )
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 )
If DTDatos IsNot Nothing And DTDatos . Rows . Count > 0 Then
Dim params As New List ( Of ReportParameter )
params . Add ( New ReportParameter ( " NombreEmpresa " , UsuarioActual . Empresa . Empresa ) )
params . Add ( New ReportParameter ( " UsuarioImprimio " , UsuarioActual . Nombre ) )
params . Add ( New ReportParameter ( " Tipo " , LtlTipo1 . Text ) )
params . Add ( New ReportParameter ( " Folio " , LtlFolio . Text ) )
params . Add ( New ReportParameter ( " Fecha " , LtlFechaVenta . Text ) )
params . Add ( New ReportParameter ( " Importe " , LtlImporte . Text ) )
params . Add ( New ReportParameter ( " Saldo " , LtlSaldo . Text ) )
If Imagen . Exists Then
params . Add ( New ReportParameter ( " LogoPath " , logouri ) )
Else
params . Add ( New ReportParameter ( " LogoPath " , " " ) )
End If
ImprimirPDF ( " Empresas\Grales\Formatos\RepAuxiliarContable.rdlc " , DTDatos , params , " RepAuxiliarContable_ " & LtlFolio . Text , Formato : = Formato )
Else
Alert ( " No se encontró información suficiente. " , TipoMensaje . MsgAdvertencia )
End If
End Sub
Property CvePrePolizaNegativa As Integer
@@ -390,23 +390,37 @@ Partial Class PopUpAuxiliar
Dim TieneError As Boolean = False
ObjContabilidad . IniciaTransacSQL ( )
If ObjContabilidad . AddPrePolizasNegativa ( CvePrePoliza , UsuarioActual . CveUsuario , TxtConceptoCancelacion . Text , UsuarioActual . CveEmpresa , TxtFechaCancelacion . Text . ToDate ) Then
Alert ( " Se agrego polzia negativa correctamente. " )
Else
Dim CvePrePolizaNueva As Integer = ObjContabilidad . AddPrePolizasNegativa ( CvePrePoliza , UsuarioActual . CveUsuario , TxtConceptoCancelacion . Text , UsuarioActual . CveEmpresa , TxtFechaCancelacion . Text . ToDate )
If Not CvePrePolizaNueva > 0 Then
TieneError = True
End If
If TieneError Then
ObjContabilidad . RollBack ( )
Else
If Not TieneError Then
ObjContabilidad . Commit ( )
Dim Str As New StringBuilder
Str . Append ( " Se agrego la póliza de cancelación correctamente.<br/> " )
RegistraScript ( " $('#DivCancelar').modal('hide'); " )
CargaDatos ( )
If UsuarioActual . Empresa . Funcionalidad ( 200 ) = " 1 " Then
If ObjContabilidad . ContabilizarPrePoliza ( CvePrePolizaNueva , UsuarioActual . CveUsuario , UsuarioActual . Empresa ) Then
Str . AppendFormat ( " <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a> " , ObjContabilidad . ContaIdPoliza )
End If
End If
Alert ( Str . ToString )
Else
ObjContabilidad . RollBack ( )
End If
ObjContabilidad . Dispose ( )
ObjContabilidad . Dispose ( )
CargaDatos ( )
End Sub
@@ -424,4 +438,4 @@ Partial Class PopUpAuxiliar
End Class
End Class