diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index e82343f8c..16e26a4a7 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -3867,7 +3867,7 @@ Public Class ClsGenerales End Function Public Function AddInvEntregaAlmacenRuta(CveSubProyecto As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveMovimientoAlmacen As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, FechaLlegada As DateTime, Tipo As String, - FolioReferencia As String, Referencia As String, FechaLimite As Date, Orden As Integer, Estatus As Integer, Distancia As Integer, Optional ConfigCartaPorte As String = "-1", + FolioReferencia As String, Referencia As String, FechaLimite As Date, Orden As Integer, Estatus As Integer, Distancia As Integer, Optional CveConfigAutoTransporte As Integer = -1, Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Inv_EntregaAlmacenRutaAdd") @@ -3893,7 +3893,7 @@ Public Class ClsGenerales .Add("@CveCamionRemolque1", SqlDbType.Int).Value = CveCamionRemolque1 .Add("@CveCamionRemolque2", SqlDbType.Int).Value = CveCamionRemolque2 - .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte .Add("@CveEntregaAlmacen", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -3909,7 +3909,7 @@ Public Class ClsGenerales Public Function UpdateInvEntregaAlmacenRuta(CveEntregaAlmacen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, CveEmpresa As Integer, Optional FechaLlegada As DateTime = MinFecha, Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1, Optional Distancia As Integer = -1, - Optional ConfigCartaPorte As String = "-1") As Boolean + Optional CveConfigAutoTransporte As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_EntregaAlmacenRutaUpdate") @@ -3928,7 +3928,7 @@ Public Class ClsGenerales .Add("@CveCamionRemolque1", SqlDbType.Int).Value = CveCamionRemolque1 .Add("@CveCamionRemolque2", SqlDbType.Int).Value = CveCamionRemolque2 .Add("@Distancia", SqlDbType.Int).Value = Distancia - .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte End With diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index fe1fe6f3f..e5d8cb414 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5542,16 +5542,17 @@ Public Class ClsInventarios Return Retorno End Function - Public Function AddCamiones(Placa As String, Especificacion As String, CveEmpresa As Integer, ConfigCartaPorte As String, Anio As Integer, CveTipoPermisoSCT As Integer, NumPermisoSCT As String, NombreAseguradora As String, + Public Function AddCamiones(Placa As String, Especificacion As String, CveEmpresa As Integer, CveConfigAutoTransporte As Integer, Anio As Integer, CveTipoPermisoSCT As Integer, NumPermisoSCT As String, NombreAseguradora As String, NumPolizaSeguro As String, CveUsuario As Integer, NombreAseguradoraMedioAmbiente As String, NumPolizaSeguroMedioAmbiente As String, NombreAseguradoraCarga As String, NumPolizaSeguroCarga As String, Optional CveTipoCamion As Integer = 1, Optional LongitudCaja As String = "", Optional LineaTransportacion As String = "", Optional SCAC As String = "", Optional CAAT As String = "", Optional CveTipoRemolque As Integer = -1, Optional NumeroTrailer As String = "") As Boolean + Dim Retorno As Boolean = False DataAdapter("PA_Inv_CamionesAdd") With SqlAdapter.SelectCommand.Parameters .Add("@Placa", SqlDbType.VarChar).Value = Placa .Add("@Especificacion", SqlDbType.VarChar).Value = Especificacion - .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte .Add("@Anio", SqlDbType.Int).Value = Anio .Add("@CveTipoPermisoSCT", SqlDbType.VarChar).Value = CveTipoPermisoSCT .Add("@NumPermisoSCT", SqlDbType.VarChar).Value = NumPermisoSCT @@ -5594,7 +5595,7 @@ Public Class ClsInventarios End Try Return Retorno End Function - Public Function UpdateCamiones(CveCamion As Integer, Placa As String, Especificacion As String, ConfigCartaPorte As String, Anio As Integer, CveTipoPermisoSCT As Integer, NumPermisoSCT As String, NombreAseguradora As String, + Public Function UpdateCamiones(CveCamion As Integer, Placa As String, Especificacion As String, CveConfigAutoTransporte As Integer, Anio As Integer, CveTipoPermisoSCT As Integer, NumPermisoSCT As String, NombreAseguradora As String, NumPolizaSeguro As String, CveUsuario As Integer, CveEmpresa As Integer, NombreAseguradoraMedioAmbiente As String, NumPolizaSeguroMedioAmbiente As String, NombreAseguradoraCarga As String, NumPolizaSeguroCarga As String, Optional CveTipoCamion As Integer = -1, Optional LongitudCaja As String = "", Optional LineaTransportacion As String = "", Optional SCAC As String = "", Optional CAAT As String = "", Optional CveTipoRemolque As Integer = -1, Optional NumeroTrailer As String = "") As Boolean @@ -5604,7 +5605,7 @@ Public Class ClsInventarios .Add("@CveCamion", SqlDbType.Int).Value = CveCamion .Add("@Placa", SqlDbType.VarChar).Value = Placa .Add("@Especificacion", SqlDbType.VarChar).Value = Especificacion - .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte .Add("@Anio", SqlDbType.Int).Value = Anio .Add("@CveTipoPermisoSCT", SqlDbType.Int).Value = CveTipoPermisoSCT .Add("@NumPermisoSCT", SqlDbType.VarChar).Value = NumPermisoSCT diff --git a/App_Code/DtDatos.xsd b/App_Code/DtDatos.xsd index c658dbec9..a9dc6f67a 100644 --- a/App_Code/DtDatos.xsd +++ b/App_Code/DtDatos.xsd @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -217,7 +217,7 @@ - + @@ -243,7 +243,7 @@ - + @@ -259,7 +259,7 @@ - + @@ -297,10 +297,11 @@ + - + @@ -310,7 +311,7 @@ - + diff --git a/Bancos/RepComplementoPago.aspx b/Bancos/RepComplementoPago.aspx index 73d4236b4..7ffa1835d 100644 --- a/Bancos/RepComplementoPago.aspx +++ b/Bancos/RepComplementoPago.aspx @@ -177,10 +177,10 @@ - + Cancelar SAT - + @@ -189,7 +189,94 @@ + + + + diff --git a/Bancos/RepComplementoPago.aspx.vb b/Bancos/RepComplementoPago.aspx.vb index d79cc385c..001edbfc8 100644 --- a/Bancos/RepComplementoPago.aspx.vb +++ b/Bancos/RepComplementoPago.aspx.vb @@ -6,14 +6,89 @@ Imports Extensiones Imports GemBox.Spreadsheet Partial Class Bancos_RepComplementoPago - Inherits ClsPaginas - - Private Sub Bancos_RepComplementoPago_Load(sender As Object, e As EventArgs) Handles Me.Load - If Not Page.IsPostBack Then + Inherits ClsPaginas + + +#Region "C A N C E L A C I O N DE C O M P L E M E N T O S" + + Private Property Can_FolioFiscalCancelar As String + Get + + If ViewState("Can_FolioFiscalCancelar") Is Nothing Then + ViewState("Can_FolioFiscalCancelar") = "" + End If + + Return ViewState("Can_FolioFiscalCancelar").ToString + + End Get + Set(value As String) + ViewState("Can_FolioFiscalCancelar") = value + End Set + End Property + + + Private Property Can_CveComplementoPagoCancelar As Integer + Get + + If ViewState("Can_CveComplementoPagoCancelar") Is Nothing Then + ViewState("Can_CveComplementoPagoCancelar") = "" + End If + + Return ViewState("Can_CveComplementoPagoCancelar").ToString.ToEntero + + End Get + Set(value As Integer) + ViewState("Can_CveComplementoPagoCancelar") = value + End Set + End Property + + Private Property Can_CvePACCancelacion As Integer + Get + + If ViewState("Can_CvePACCancelacion") Is Nothing Then + ViewState("Can_CvePACCancelacion") = "" + End If + + Return ViewState("Can_CvePACCancelacion").ToString.ToEntero + + End Get + Set(value As Integer) + ViewState("Can_CvePACCancelacion") = value + End Set + End Property + + Private Property Can_RFCReceptorCancelar As String + Get + + If ViewState("Can_RFCReceptorCancelar") Is Nothing Then + ViewState("Can_RFCReceptorCancelar") = "" + End If + + Return ViewState("Can_RFCReceptorCancelar").ToString + + End Get + Set(value As String) + ViewState("Can_RFCReceptorCancelar") = value + End Set + End Property + + + +#End Region + + Private Sub Bancos_RepComplementoPago_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + txtFechaI.Text = $"{New DateTime(Now.Year, Now.Month, 1).ToString("dd/MM/yyyy")}" txtFechaF.Text = DateTime.Now.ToString("dd/MM/yyyy") DdlCliente.setEsWebService(True) + DdlMotivoCancelacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion = 2 or CveSATMotivoCancelacion = 3 ") + DdlMotivoCancelacion.DataBind() + DdlMotivoCancelacion.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + Dim objGral As New ClsGralFolios If objGral.GetFolios("CP", UsuarioActual.CveEmpresa) Then If objGral.DtResultados.Rows.Count > 0 Then @@ -150,9 +225,9 @@ Partial Class Bancos_RepComplementoPago e.Row.FCHyperLink("HplPDF").Visible = True : e.Row.FCHyperLink("HplPDF").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CompP&EXT=pdf&CveComplementoPago={0}&SerieFolio={1}&CveIE={2}", e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("SerieFolioPago").ToString.Replace("&", "%26%"), e.Row.DBCampo("CveIE").ToString))) e.Row.FCLinkButton("LnkSendMail").Visible = True - 'If DdlOpcion.SelectedValue.ToEntero = 2 Then - ' e.Row.FCLinkButton("LnkCancelarFolioFiscal").Visible = True - 'End If + If DdlOpcion.SelectedValue.ToEntero = 2 Then + e.Row.FCLinkButton("LnkCancelarFolioFiscal").Visible = True + End If End If @@ -326,53 +401,18 @@ Partial Class Bancos_RepComplementoPago Protected Sub LnkCancelaFolioFiscal(sender As Object, e As EventArgs) - Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero - Dim SerieFolioPago As String = Gvr.DataKey("SerieFolioPago").ToString - Dim FolioFiscalCancelar As String = Gvr.DataKey("FolioFiscalComplemento").ToString - Dim CveComplementoPagoCancelar As Integer = Gvr.DataKey("CveComplementoPago").ToEntero - Dim CvePACCancelacion As Integer = UsuarioActual.Empresa.CvePAC - Dim RFCReceptorCancelar As String = Gvr.DataKey("RFC").ToString - - If FolioFiscalCancelar <> "" Then - Dim ObjCancelacion As New Timbrado - Dim ObjBanco As New ClsBancos - - If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then - - If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then - - Alert("El complemento se cancelo correctamente.") - End If - - Else - - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then - - If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then - - Alert("El complemento se cancelo correctamente.") - End If - Else - Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgError) - End If - - End If - - ObjBanco.Dispose() - - 'Dim objBancos As New ClsBancos - - 'If objBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, -1, CFDIRelacionado, True) Then - ' Alert($"Complemento {SerieFolioPago} cancelado correctamente.") - 'Else - ' Alert($"Se presento un error al cancelar el complementob {SerieFolioPago}.", TipoMensaje.MsgError) - 'End If - - 'objBancos.Dispose() - End If + Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Can_FolioFiscalCancelar = Gvr.DataKey("FolioFiscalComplemento").ToString + Can_CveComplementoPagoCancelar = Gvr.DataKey("CveComplementoPago").ToEntero + Can_CvePACCancelacion = UsuarioActual.Empresa.CvePAC + Can_RFCReceptorCancelar = Gvr.DataKey("RFC").ToString + + DdlMotivoCancelacion.SelectedValueExist(-1) + + RegistraScript("$('#ModalCancelacion').modal('show');") + UpModalCancelacion.Update() End Sub @@ -417,8 +457,6 @@ Partial Class Bancos_RepComplementoPago End Sub - - Private Sub Imprimir(Optional reporte As String = "PDF") If GvD.Rows.Count > 0 Then Dim StrFiltro As New StringBuilder @@ -482,7 +520,6 @@ Partial Class Bancos_RepComplementoPago worksheet.Columns("E").Width = 6000 worksheet.Columns("F").Width = 6000 worksheet.Columns("G").Width = 4000 - worksheet.Columns("H").Width = 12000 For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex @@ -532,8 +569,57 @@ Partial Class Bancos_RepComplementoPago End Sub + Protected Sub BtnCancelarComplemento_Click(sender As Object, e As EventArgs) + + + Dim CveMotivoCancelacion As Integer = DdlMotivoCancelacion.SelectedValue.ToEntero + Dim CveSATMotivoCancelacion As Integer = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveMotivoCancelacion:=CveMotivoCancelacion).FiltroPrimeroValor("CveSATMotivoCancelacion").ToEntero() + + If CveMotivoCancelacion <= 0 Or CveSATMotivoCancelacion <= 0 Then + Alert("Debe de elegir un motivo de cancelación.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim ErrorProceso As Boolean = True + If Can_FolioFiscalCancelar <> "" Then + Dim ObjCancelacion As New Timbrado + Dim ObjBanco As New ClsBancos + + If EstatusSATCancelado(Can_FolioFiscalCancelar, UsuarioActual.Empresa.RFC, Can_RFCReceptorCancelar) Then + + If ObjBanco.UpdateComplementoPago(Can_CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, Can_CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then + Alert("El complemento se cancelo correctamente.") + ErrorProceso = False + End If + + Else + + If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, Can_FolioFiscalCancelar, 0, Can_RFCReceptorCancelar, UsuarioActual.Empresa.RFC, Can_CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then + + If ObjBanco.UpdateComplementoPago(Can_CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, Can_CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then + Alert("El complemento se cancelo correctamente.") + ErrorProceso = False + End If + + Else + Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgError) + ErrorProceso = True + End If + + End If + + ObjBanco.Dispose() + Else + ErrorProceso = False + End If + + If Not ErrorProceso Then + RegistraScript("$('#ModalCancelacion').modal('hide');") + End If + + + End Sub End Class diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 0f6736094..7046abfe8 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1,165 +1,165 @@  -Imports System.Data -Imports Extensiones -Imports System.Linq -Imports System.Web.Services -Imports GemBox.Spreadsheet +Imports System.Data +Imports Extensiones +Imports System.Linq +Imports System.Web.Services +Imports GemBox.Spreadsheet Imports Microsoft.Reporting.WebForms Imports System.IO Imports iTextSharp.text.pdf -Partial Class ContabilidadC_RegPrePolizaS +Partial Class ContabilidadC_RegPrePolizaS Inherits ClsPaginas -#Region "Propiedades" - Public Property ArregloMovs As ArrayList - Get - Return CType(ViewState("ArregloMovs"), ArrayList) - End Get - Set(value As ArrayList) - ViewState("ArregloMovs") = value - End Set - End Property - Public Property DtMovimientos As DataTable - Get - Return CType(ViewState("DtMovimientos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtMovimientos") = value - End Set - End Property - Public Property DtCuentasContables As DataTable - Get - Return CType(ViewState("DtCuentasContables"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtCuentasContables") = value - End Set - End Property - Public Property TipoPlantilla As Integer - Get - Return CType(ViewState("TipoPlantilla"), Integer) - End Get - Set(value As Integer) - ViewState("TipoPlantilla") = value - End Set - End Property - Public Property CveMoneda As Integer - Get - Return CType(ViewState("CveMoneda"), Integer) - End Get - Set(value As Integer) - ViewState("CveMoneda") = value - End Set - End Property - Private ReadOnly Property CvePrePoliza As Integer - Get - Return ViewState("CvePrePoliza").ToString.ToEntero - End Get - End Property - - 'PARA CREAR IE - Private Property CveConcepto As Integer - Get - Return ViewState("CveConcepto").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveConcepto") = value - End Set - End Property - Private Property CveTipoTransaccion As Integer - Get - Return ViewState("CveTipoTransaccion").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveTipoTransaccion") = value - End Set - End Property - Private Property CveCuenta As Integer - Get - Return ViewState("CveCuenta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCuenta") = value - End Set - End Property - Private Property Folio As String - Get - Return ViewState("Folio").ToString - End Get - Set(value As String) - ViewState("Folio") = value - End Set - End Property - Private Property ImporteDocumento As Decimal - Get - Return ViewState("ImporteDocumento").ToString.ToDecimal - End Get - Set(value As Decimal) - ViewState("ImporteDocumento") = value - End Set - End Property - Private Property Observaciones As String - Get - Return ViewState("Observaciones").ToString - End Get - Set(value As String) - ViewState("Observaciones") = value - End Set - End Property - Private Property Beneficiario As String - Get - Return ViewState("Beneficiario").ToString - End Get - Set(value As String) - ViewState("Beneficiario") = value - End Set - End Property - Private Property RowIndex As Integer - Get - Return ViewState("RowIndex").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("RowIndex") = value - End Set - End Property - Private Property Actualizar As Boolean - Get - Return CBool(ViewState("Actualizar").ToString) - End Get - Set(value As Boolean) - ViewState("Actualizar") = value - End Set - End Property - - Private ReadOnly Property CvePeriodo As Integer - Get - Return CType(ViewState("CvePeriodo"), Integer) - End Get - End Property - Private ReadOnly Property CveProyecto As Integer - Get - Return CType(ViewState("CveProyecto"), Integer) - End Get - End Property - Private ReadOnly Property CveSubProyecto As Integer - Get - Return CType(ViewState("CveSubProyecto"), Integer) - End Get - End Property - Private ReadOnly Property CveTurno As Integer - Get - Return CType(ViewState("CveTurno"), Integer) - End Get - End Property - Public Property IndiceGrid As Integer - Get - Return CType(ViewState("IndiceGrid"), Integer) - End Get - Set(value As Integer) - ViewState("IndiceGrid") = value - End Set +#Region "Propiedades" + Public Property ArregloMovs As ArrayList + Get + Return CType(ViewState("ArregloMovs"), ArrayList) + End Get + Set(value As ArrayList) + ViewState("ArregloMovs") = value + End Set + End Property + Public Property DtMovimientos As DataTable + Get + Return CType(ViewState("DtMovimientos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMovimientos") = value + End Set + End Property + Public Property DtCuentasContables As DataTable + Get + Return CType(ViewState("DtCuentasContables"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCuentasContables") = value + End Set + End Property + Public Property TipoPlantilla As Integer + Get + Return CType(ViewState("TipoPlantilla"), Integer) + End Get + Set(value As Integer) + ViewState("TipoPlantilla") = value + End Set + End Property + Public Property CveMoneda As Integer + Get + Return CType(ViewState("CveMoneda"), Integer) + End Get + Set(value As Integer) + ViewState("CveMoneda") = value + End Set + End Property + Private ReadOnly Property CvePrePoliza As Integer + Get + Return ViewState("CvePrePoliza").ToString.ToEntero + End Get + End Property + + 'PARA CREAR IE + Private Property CveConcepto As Integer + Get + Return ViewState("CveConcepto").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveConcepto") = value + End Set + End Property + Private Property CveTipoTransaccion As Integer + Get + Return ViewState("CveTipoTransaccion").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveTipoTransaccion") = value + End Set + End Property + Private Property CveCuenta As Integer + Get + Return ViewState("CveCuenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuenta") = value + End Set + End Property + Private Property Folio As String + Get + Return ViewState("Folio").ToString + End Get + Set(value As String) + ViewState("Folio") = value + End Set + End Property + Private Property ImporteDocumento As Decimal + Get + Return ViewState("ImporteDocumento").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("ImporteDocumento") = value + End Set + End Property + Private Property Observaciones As String + Get + Return ViewState("Observaciones").ToString + End Get + Set(value As String) + ViewState("Observaciones") = value + End Set + End Property + Private Property Beneficiario As String + Get + Return ViewState("Beneficiario").ToString + End Get + Set(value As String) + ViewState("Beneficiario") = value + End Set + End Property + Private Property RowIndex As Integer + Get + Return ViewState("RowIndex").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("RowIndex") = value + End Set + End Property + Private Property Actualizar As Boolean + Get + Return CBool(ViewState("Actualizar").ToString) + End Get + Set(value As Boolean) + ViewState("Actualizar") = value + End Set + End Property + + Private ReadOnly Property CvePeriodo As Integer + Get + Return CType(ViewState("CvePeriodo"), Integer) + End Get + End Property + Private ReadOnly Property CveProyecto As Integer + Get + Return CType(ViewState("CveProyecto"), Integer) + End Get + End Property + Private ReadOnly Property CveSubProyecto As Integer + Get + Return CType(ViewState("CveSubProyecto"), Integer) + End Get + End Property + Private ReadOnly Property CveTurno As Integer + Get + Return CType(ViewState("CveTurno"), Integer) + End Get + End Property + Public Property IndiceGrid As Integer + Get + Return CType(ViewState("IndiceGrid"), Integer) + End Get + Set(value As Integer) + ViewState("IndiceGrid") = value + End Set End Property Public Property IdPoliza As Integer Get @@ -234,71 +234,71 @@ Partial Class ContabilidadC_RegPrePolizaS End Property -#End Region +#End Region - Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load - - If Not Page.IsPostBack Then + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then Tick = DateTime.Now.Ticks.ToString - - CveMoneda = 1 - ViewState("CvePrePoliza") = 0 - ViewState("CvePeriodo") = "0" - CveConcepto = -1 - CveTipoTransaccion = -1 - CveCuenta = -1 - Folio = "-1" - ImporteDocumento = -1 - Observaciones = "-1" - Beneficiario = "-1" - Actualizar = False + + CveMoneda = 1 + ViewState("CvePrePoliza") = 0 + ViewState("CvePeriodo") = "0" + CveConcepto = -1 + CveTipoTransaccion = -1 + CveCuenta = -1 + Folio = "-1" + ImporteDocumento = -1 + Observaciones = "-1" + Beneficiario = "-1" + Actualizar = False IdPoliza = -1 CargaCtaContableE() CargaConceptosContablesE() - CargaModalConceptoCuentas() - - If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then - DivTipoGasto.Visible = True - ThTipoGasto.Visible = True - CargaTiposGasto() - End If - + CargaModalConceptoCuentas() + + If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then + DivTipoGasto.Visible = True + ThTipoGasto.Visible = True + CargaTiposGasto() + End If + If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then - ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero - CreaDT() - CargaPrePoliza() - If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then - GvPrePoliza.Columns(5).Visible = False - DivTG.Visible = False - GvMov.Columns(5).Visible = False + ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero + CreaDT() + CargaPrePoliza() + If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + GvPrePoliza.Columns(5).Visible = False + DivTG.Visible = False + GvMov.Columns(5).Visible = False End If ValidaCrearAPartirDe() DvPlantilla.Visible = False UPPDocumento.Visible = False - Exit Sub - + Exit Sub + ElseIf Request("CvePrePolizaOrigen") IsNot Nothing AndAlso IsNumeric(Request("CvePrePolizaOrigen")) AndAlso Request("CvePrePolizaOrigen").ToEntero > 0 Then - CvePrePolizaOrigen = Request("CvePrePolizaOrigen").ToEntero + CvePrePolizaOrigen = Request("CvePrePolizaOrigen").ToEntero CreaDT() CargaPrePolizaOrigen() OcultarControlesCrearApartirDe() DvPlantilla.Visible = False - Exit Sub - - Else - CreaDT() + Exit Sub + + Else + CreaDT() BtnEliminar.Visible = False - LnkExcel.Visible = True - LnkImprimirPDF.Visible = False - DvPlantilla.Visible = True - - TxtFechaDocumento.Text = Now.ToString("dd/MM/yyyy") + LnkExcel.Visible = True + LnkImprimirPDF.Visible = False + DvPlantilla.Visible = True + + TxtFechaDocumento.Text = Now.ToString("dd/MM/yyyy") TxtFechaelaboracion.Text = Now.ToString("dd/MM/yyyy") TxtConcepto.Enabled = True TxtUsuarioElaboro.Text = UsuarioActual.Usuario @@ -307,192 +307,192 @@ Partial Class ContabilidadC_RegPrePolizaS UpPrePoliza.Visible = False - End If - - - TipoPlantilla = -1 - If IfNull(Request("Tipo"), "").ToString = "Ing" Then - TipoPlantilla = 1 - LblEncabezado.Text = "Otros Ingresos" - End If - - CargaPlantillas(TipoPlantilla) - - 'If UsuarioActual.CveRol = 1 Then trNotificar.Visible = True - - CargaConceptos() - CargaSubProyectos() - CargaCuentasContables() - - 'crea tabla temporal - ArregloMovs = New ArrayList - - CargaCuentas() - - - If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then - GvPrePoliza.Columns(4).Visible = False - GvMov.Columns(4).Visible = False - End If - - - - End If - - End Sub - - Private Sub CreaDT() - DtMovimientos = New DataTable("Movimientos") - Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True + End If + + + TipoPlantilla = -1 + If IfNull(Request("Tipo"), "").ToString = "Ing" Then + TipoPlantilla = 1 + LblEncabezado.Text = "Otros Ingresos" + End If + + CargaPlantillas(TipoPlantilla) + + 'If UsuarioActual.CveRol = 1 Then trNotificar.Visible = True + + CargaConceptos() + CargaSubProyectos() + CargaCuentasContables() + + 'crea tabla temporal + ArregloMovs = New ArrayList + + CargaCuentas() + + + If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + GvPrePoliza.Columns(4).Visible = False + GvMov.Columns(4).Visible = False + End If + + + + End If + + End Sub + + Private Sub CreaDT() + DtMovimientos = New DataTable("Movimientos") + Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True With DtMovimientos.Columns - .Add("CodigoCuenta", Type.GetType("System.String")) - .Add("Cuenta", Type.GetType("System.String")) - .Add("Referencia", Type.GetType("System.String")) - .Add("Concepto", Type.GetType("System.String")) - .Add("Cargo", Type.GetType("System.Double")) - .Add("Abono", Type.GetType("System.Double")) - .Add("TipoMovto", Type.GetType("System.Int32")) - .Add("EsComodin", Type.GetType("System.Int32")) - .Add("CveConcepto", Type.GetType("System.Int32")) - .Add("CveSubProyecto", Type.GetType("System.Int32")) - .Add("Descripcion", Type.GetType("System.String")) - .Add("CveProveedor", Type.GetType("System.Int32")) - .Add("CvePersonal", Type.GetType("System.Int32")) - .Add("CveCompra", Type.GetType("System.Int32")) - .Add("CveCliente", Type.GetType("System.Int32")) - .Add("CveVenta", Type.GetType("System.Int32")) - .Add("CveClasificacion", Type.GetType("System.Int32")) - .Add("MultipleSubProyecto", Type.GetType("System.Boolean")) - .Add("CveTipoGasto", Type.GetType("System.Int32")) - .Add("CvePrePolizaDetalle", Type.GetType("System.Int32")) - .Add("CveConceptoContable", Type.GetType("System.Int32")) - .Add("IdCtaContable", Type.GetType("System.Int32")) - .Add("ConceptoContable", Type.GetType("System.String")) + .Add("CodigoCuenta", Type.GetType("System.String")) + .Add("Cuenta", Type.GetType("System.String")) + .Add("Referencia", Type.GetType("System.String")) + .Add("Concepto", Type.GetType("System.String")) + .Add("Cargo", Type.GetType("System.Double")) + .Add("Abono", Type.GetType("System.Double")) + .Add("TipoMovto", Type.GetType("System.Int32")) + .Add("EsComodin", Type.GetType("System.Int32")) + .Add("CveConcepto", Type.GetType("System.Int32")) + .Add("CveSubProyecto", Type.GetType("System.Int32")) + .Add("Descripcion", Type.GetType("System.String")) + .Add("CveProveedor", Type.GetType("System.Int32")) + .Add("CvePersonal", Type.GetType("System.Int32")) + .Add("CveCompra", Type.GetType("System.Int32")) + .Add("CveCliente", Type.GetType("System.Int32")) + .Add("CveVenta", Type.GetType("System.Int32")) + .Add("CveClasificacion", Type.GetType("System.Int32")) + .Add("MultipleSubProyecto", Type.GetType("System.Boolean")) + .Add("CveTipoGasto", Type.GetType("System.Int32")) + .Add("CvePrePolizaDetalle", Type.GetType("System.Int32")) + .Add("CveConceptoContable", Type.GetType("System.Int32")) + .Add("IdCtaContable", Type.GetType("System.Int32")) + .Add("ConceptoContable", Type.GetType("System.String")) .Add("CveCuenta", Type.GetType("System.Int32")) - .Add("ContadoTipoTransaccion", Type.GetType("System.Int32")) - .Add("ContadoCuenta", Type.GetType("System.Int32")) - .Add("ContadoNumeroFolio", Type.GetType("System.String")) - .Add("ContadoImporte", Type.GetType("System.Double")) - .Add("ContadoBeneficiario", Type.GetType("System.String")) + .Add("ContadoTipoTransaccion", Type.GetType("System.Int32")) + .Add("ContadoCuenta", Type.GetType("System.Int32")) + .Add("ContadoNumeroFolio", Type.GetType("System.String")) + .Add("ContadoImporte", Type.GetType("System.Double")) + .Add("ContadoBeneficiario", Type.GetType("System.String")) .Add("ContadoObservaciones", Type.GetType("System.String")) - .Add("PorcentajeImpuesto", Type.GetType("System.Double")) - .Add("Modificado", Type.GetType("System.Boolean")) - .Add("EsComplementaria", Type.GetType("System.Boolean")) - .Add("TC", Type.GetType("System.Decimal")) - - - - End With - End Sub - - 'Private Sub CargaNomina() - ' Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero - ' Dim ObjNomina As New ClsNominas - ' Dim ObjConta As New ClsContabilidad - - ' Dim Dt As DataTable = Nothing - ' Dim Cuenta As String = "" - ' Dim Concepto As String = "" - ' Dim IdCuenta As Integer = 0 - ' Dim TipoMovto As Integer - ' Dim CveConcepto As Integer - ' Dim CodigoCuenta As String = "" - ' Dim NombreCuenta As String = "" - ' Dim Referencia As String = "" - ' Dim EsComodin As Integer = 0 - ' DtMovimientos.Clear() - - ' If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then - ' Dt = ObjNomina.DtResultados - - ' For Each drt As DataRow In Dt.Rows - ' Dim dr As DataRow = DtMovimientos.NewRow - - ' If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then - ' CveConcepto = 98 - ' Cuenta = "Nominas por Pagar" - ' IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero - ' Concepto = "Pago Nomina" - ' Referencia = "Pago Nomina" - ' Else - ' Concepto = drt("NombreCompleto") - ' Referencia = "" - ' CveConcepto = drt("CveConceptoContable").ToString.ToEntero - ' Cuenta = drt("ConceptoContable").ToString - ' IdCuenta = drt("IdCtaContable").ToString.ToEntero - ' End If - - ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") - ' CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "") - ' NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "") - - ' TipoMovto = drt("TipoMovto") - - ' If TipoMovto = 0 Then - ' dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) - ' dr("Abono") = 0 - ' Else - ' dr("Cargo") = 0 - ' dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) - ' End If - - ' dr("IdCuenta") = IdCuenta - ' dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - ' dr("Cuenta") = Cuenta - ' dr("Concepto") = Concepto - ' dr("Descripcion") = Concepto - ' dr("Referencia") = Referencia - ' dr("TipoMovto") = TipoMovto - ' dr("EsComodin") = EsComodin - ' dr("CveConcepto") = CveConcepto - ' dr("CveProveedor") = "-1" - ' dr("CveSubProyecto") = drt("CveSubProyecto") - ' dr("CvePersonal") = drt("CvePersonal") - ' dr("CveClasificacion") = drt("CveClasificacion") - ' dr("CveTipoGasto") = drt("CveTipoGasto") - - ' DtMovimientos.Rows.Add(dr) - ' Next - - ' GvMov.DataSource = DtMovimientos - ' GvMov.DataBind() - ' UPMovs.Update() - ' End If - - 'End Sub - - Private Sub CargaPrePoliza() - BtnEliminar.Visible = True - LblEncabezado.Text = "Edición de Póliza" - - Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then - Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("") - If dr IsNot Nothing Then - 'DivAgregarConceptos.Visible = False - DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") - TxtFechaDocumento.Text = dr("Fecha") - TxtConcepto.Text = dr("Concepto") + .Add("PorcentajeImpuesto", Type.GetType("System.Double")) + .Add("Modificado", Type.GetType("System.Boolean")) + .Add("EsComplementaria", Type.GetType("System.Boolean")) + .Add("TC", Type.GetType("System.Decimal")) + + + + End With + End Sub + + 'Private Sub CargaNomina() + ' Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + ' Dim ObjNomina As New ClsNominas + ' Dim ObjConta As New ClsContabilidad + + ' Dim Dt As DataTable = Nothing + ' Dim Cuenta As String = "" + ' Dim Concepto As String = "" + ' Dim IdCuenta As Integer = 0 + ' Dim TipoMovto As Integer + ' Dim CveConcepto As Integer + ' Dim CodigoCuenta As String = "" + ' Dim NombreCuenta As String = "" + ' Dim Referencia As String = "" + ' Dim EsComodin As Integer = 0 + ' DtMovimientos.Clear() + + ' If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then + ' Dt = ObjNomina.DtResultados + + ' For Each drt As DataRow In Dt.Rows + ' Dim dr As DataRow = DtMovimientos.NewRow + + ' If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then + ' CveConcepto = 98 + ' Cuenta = "Nominas por Pagar" + ' IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero + ' Concepto = "Pago Nomina" + ' Referencia = "Pago Nomina" + ' Else + ' Concepto = drt("NombreCompleto") + ' Referencia = "" + ' CveConcepto = drt("CveConceptoContable").ToString.ToEntero + ' Cuenta = drt("ConceptoContable").ToString + ' IdCuenta = drt("IdCtaContable").ToString.ToEntero + ' End If + + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") + ' CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "") + ' NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "") + + ' TipoMovto = drt("TipoMovto") + + ' If TipoMovto = 0 Then + ' dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) + ' dr("Abono") = 0 + ' Else + ' dr("Cargo") = 0 + ' dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) + ' End If + + ' dr("IdCuenta") = IdCuenta + ' dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + ' dr("Cuenta") = Cuenta + ' dr("Concepto") = Concepto + ' dr("Descripcion") = Concepto + ' dr("Referencia") = Referencia + ' dr("TipoMovto") = TipoMovto + ' dr("EsComodin") = EsComodin + ' dr("CveConcepto") = CveConcepto + ' dr("CveProveedor") = "-1" + ' dr("CveSubProyecto") = drt("CveSubProyecto") + ' dr("CvePersonal") = drt("CvePersonal") + ' dr("CveClasificacion") = drt("CveClasificacion") + ' dr("CveTipoGasto") = drt("CveTipoGasto") + + ' DtMovimientos.Rows.Add(dr) + ' Next + + ' GvMov.DataSource = DtMovimientos + ' GvMov.DataBind() + ' UPMovs.Update() + ' End If + + 'End Sub + + Private Sub CargaPrePoliza() + BtnEliminar.Visible = True + LblEncabezado.Text = "Edición de Póliza" + + Dim ObjContabilidad As New ClsContabilidad + If ObjContabilidad.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then + Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("") + If dr IsNot Nothing Then + 'DivAgregarConceptos.Visible = False + DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") + TxtFechaDocumento.Text = dr("Fecha") + TxtConcepto.Text = dr("Concepto") DivDatosPoliza.Visible = True TipoPoliza = DdlTipoPoliza.SelectedItem.Text - Folio = dr("FolioPoliza").ToString - - TxtFolio.Text = dr("FolioPoliza").ToString - TxtUsuarioElaboro.Text = dr("Usuario").ToString + Folio = dr("FolioPoliza").ToString + + TxtFolio.Text = dr("FolioPoliza").ToString + TxtUsuarioElaboro.Text = dr("Usuario").ToString TxtFechaelaboracion.Text = dr("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy") ' TxtEstatus.Text = If(Boolean.Parse(dr("Estatus").ToString), "Activa", "Inactiva") - CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString - - If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then - 'DivAgregarConceptos.Visible = True - LnkAddConcepto.Visible = True - CargaConceptos() - CargaSubProyectos() - CargaCuentasContables() - End If - - ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza) + CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString + + If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then + 'DivAgregarConceptos.Visible = True + LnkAddConcepto.Visible = True + CargaConceptos() + CargaSubProyectos() + CargaCuentasContables() + End If + + ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza) DtMovimientos = ObjContabilidad.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") If dr("Modulo").ToString.Contiene("Banc/FluctuaA", "Banc/FluctuaC", "Banc/FluctuaV", "Banc/FluctuaFilial") Then @@ -518,27 +518,27 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientos.Columns.Add("ContadoImporte", GetType(Decimal)) - End If - - GvPrePoliza.DataBind() - - If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then - GvPrePoliza.Columns(7).Visible = True - End If - - If DtMovimientos.FiltraParametros("CveConceptoContable IN (2,17)").Rows.Count > 0 Then - LnkComplementoPago.Visible = True - End If - - + End If + + GvPrePoliza.DataBind() + + If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then + GvPrePoliza.Columns(7).Visible = True + End If + + If DtMovimientos.FiltraParametros("CveConceptoContable IN (2,17)").Rows.Count > 0 Then + LnkComplementoPago.Visible = True + End If + + If dr("FolioPoliza").ToString = "" Then BtnContabilizar.Visible = True - End If - + End If + If UsuarioActual.Empresa.TipoContabilizacion = 1 Then If dr("FolioPoliza").ToString.ToEntero > 0 Then divContabilizada.Visible = True - Folio = dr("FolioPoliza").ToString + Folio = dr("FolioPoliza").ToString End If Else @@ -552,87 +552,87 @@ Partial Class ContabilidadC_RegPrePolizaS End If End If - 'divDatosPrincipales.Visible = False - 'divObservaciones.Visible = False - UPMovs.Visible = False - UPMovs.Update() - UPPDocumento.Update() - UpPrePoliza.Update() - - RegistraScript("comparar();") - - If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then - 'For Each row As GridViewRow In GvPrePoliza.Rows - ' row.FCTextBox("TxtCargo").Enabled = False - ' row.FCTextBox("TxtAbono").Enabled = False - 'Next + 'divDatosPrincipales.Visible = False + 'divObservaciones.Visible = False + UPMovs.Visible = False + UPMovs.Update() + UPPDocumento.Update() + UpPrePoliza.Update() + + RegistraScript("comparar();") + + If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then + 'For Each row As GridViewRow In GvPrePoliza.Rows + ' row.FCTextBox("TxtCargo").Enabled = False + ' row.FCTextBox("TxtAbono").Enabled = False + 'Next End If - LnkExcel.Visible = False - LnkImprimirPDF.Visible = True - Else - Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnEliminar.Visible = False - End If - - End If - - ObjContabilidad.Dispose() - UpPoliza.Update() - End Sub - - Private Sub GvPrePoliza_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPrePoliza.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - ''Asignamos los Subproyectos - 'e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - 'e.Row.FCDropDownList("DdlSubProyecto").DataBind() - 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) - 'e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) - - 'Asignamos los Tipos de Gasto - 'e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) - 'e.Row.FCDropDownList("DdlTipoGasto").DataBind() - 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) - 'e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto")) - - 'ASignamos las CuentasContables - 'e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas") - 'e.Row.FCDropDownList("DdlCtaContable").DataBind() - 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) - 'e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) - - If e.Row.DataKey("IdCtaContable") > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", e.Row.DataKey("IdCtaContable"))) - If drr IsNot Nothing Then - e.Row.FCLiteral("DdlCtaContable").Text = drr("CuentaFormato").ToString() + " - " + drr("Nombre").ToString() - End If - End If - - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCLiteral("TxtCargo").Text.ToDouble).ToString.FormatoNumero - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCLiteral("TxtAbono").Text.ToDouble).ToString.FormatoNumero - - Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero - - If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63, 4, 291, 292) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) - If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235, 240, 305, 306, 307, 308, 309, 310, 311, 312) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) - If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen")) + LnkExcel.Visible = False + LnkImprimirPDF.Visible = True + Else + Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnEliminar.Visible = False + End If + + End If + + ObjContabilidad.Dispose() + UpPoliza.Update() + End Sub + + Private Sub GvPrePoliza_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPrePoliza.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + ''Asignamos los Subproyectos + 'e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlSubProyecto").DataBind() + 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + 'e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) + + 'Asignamos los Tipos de Gasto + 'e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlTipoGasto").DataBind() + 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) + 'e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto")) + + 'ASignamos las CuentasContables + 'e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas") + 'e.Row.FCDropDownList("DdlCtaContable").DataBind() + 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) + 'e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) + + If e.Row.DataKey("IdCtaContable") > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", e.Row.DataKey("IdCtaContable"))) + If drr IsNot Nothing Then + e.Row.FCLiteral("DdlCtaContable").Text = drr("CuentaFormato").ToString() + " - " + drr("Nombre").ToString() + End If + End If + + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCLiteral("TxtCargo").Text.ToDouble).ToString.FormatoNumero + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCLiteral("TxtAbono").Text.ToDouble).ToString.FormatoNumero + + Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero + + If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63, 4, 291, 292) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) + If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235, 240, 305, 306, 307, 308, 309, 310, 311, 312) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) + If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen")) If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) - - 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable + + 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable If e.Row.DBCampo("Modificado") Then e.Row.FCCheckBox("chkModificado").Checked = True - End If - End If - - If e.Row.RowType = DataControlRowType.Header Then - 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataBind() - 'e.Row.FCDropDownList("DdlSubProyectoFiltro").Items.Insert(0, New ListItem("Todos", "-1")) - End If - - End Sub - + End If + End If + + If e.Row.RowType = DataControlRowType.Header Then + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataBind() + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").Items.Insert(0, New ListItem("Todos", "-1")) + End If + + End Sub + Private Sub CargaPlantillas(TipoPlantilla As Integer) 'GvPlantillas.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla) @@ -656,57 +656,57 @@ Partial Class ContabilidadC_RegPrePolizaS DdlPlantilla2.Items.Insert(0, New ListItem("Plantilla Personalizada", "53")) End Sub - Private Sub CargaConceptos() - DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1) - DdlConceptosContables.DataBind() - End Sub - + Private Sub CargaConceptos() + DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1) + DdlConceptosContables.DataBind() + End Sub + Private Sub DdlConceptosContables_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContables.SelectedIndexChanged - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then - CargaProveedores() - DdlProveedores.Visible = True - DdlCompras.Visible = True - Else - DdlProveedores.Visible = False - DdlCompras.Visible = False - End If - - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(28, 29) Then - CargaPersonal() - DdlPersonal.Visible = True - Else - DdlPersonal.Visible = False - End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then - CargaClientes() - DdlClientes.Visible = True - DdlVentas.Visible = True - Else - DdlClientes.Visible = False - DdlVentas.Visible = False - End If - End Sub - - Private Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedores.SelectedIndexChanged - CargaCompras(DdlProveedores.SelectedValue.ToEntero) - End Sub - - Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange - CargaVentas(DdlClientes.SelectedValue.ToEntero) - End Sub - - Private Sub CargaSubProyectos() - DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - DdlSubProyecto.DataBind() - DdlSubProyecto.Items.Insert(0, New ListItem(" - ", "-1")) - DdlSubProyectoFiltroMov.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - DdlSubProyectoFiltroMov.DataBind() - DdlSubProyectoFiltroMov.Items.Insert(0, New ListItem("Todos", "-1")) - End Sub - - Private Sub CargaCuentasContables() + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then + CargaProveedores() + DdlProveedores.Visible = True + DdlCompras.Visible = True + Else + DdlProveedores.Visible = False + DdlCompras.Visible = False + End If + + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(28, 29) Then + CargaPersonal() + DdlPersonal.Visible = True + Else + DdlPersonal.Visible = False + End If + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then + CargaClientes() + DdlClientes.Visible = True + DdlVentas.Visible = True + Else + DdlClientes.Visible = False + DdlVentas.Visible = False + End If + End Sub + + Private Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedores.SelectedIndexChanged + CargaCompras(DdlProveedores.SelectedValue.ToEntero) + End Sub + + Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange + CargaVentas(DdlClientes.SelectedValue.ToEntero) + End Sub + + Private Sub CargaSubProyectos() + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem(" - ", "-1")) + DdlSubProyectoFiltroMov.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoFiltroMov.DataBind() + DdlSubProyectoFiltroMov.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub CargaCuentasContables() Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then DdlCuentaContableE.DataSource = ObjConta.DtResultados @@ -714,10 +714,10 @@ Partial Class ContabilidadC_RegPrePolizaS DtCuentasContables = ObjConta.DtResultados End If ObjConta.Dispose() - DdlCuentaContable.DataBind() - DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0")) - DdlCuentaContableE.DataBind() - DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + DdlCuentaContable.DataBind() + DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0")) + DdlCuentaContableE.DataBind() + DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) End Sub Private Function CargaCuentasContpaq(CveCuenta As Integer) As Integer @@ -731,256 +731,256 @@ Partial Class ContabilidadC_RegPrePolizaS End If Return Retorno - End Function - Private Sub CargaTiposGasto() - DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) - DdlTipoGasto.DataBind() - DdlTipoGasto.Items.Insert(0, New ListItem("Sin Asignar", "0")) - End Sub - - Private Sub CargaProveedores() - DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedores.DataBind() - DdlProveedores.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - - Private Sub CargaCompras(CveProveedor As Integer) - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 305, 308, 310, 311, 312) Then - Dim ObjCompras As New ClsCompras - - DdlCompras.ClearSelection() - If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then - DdlCompras.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") - DdlCompras.DataBind() - DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) - Else - DdlCompras.DataSource = Nothing - DdlCompras.DataBind() - DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) - End If - ObjCompras.Dispose() - End If - End Sub - - Private Sub CargaClientes() - DdlClientes.setEsWebService(True) - DdlClientes.Attributes.Add("data-metodo", "getcliente") - DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - DdlClientes.DataBind() - ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - - Private Sub CargaVentas(CveCliente As Integer) - Dim ObjVentas As New ClsVentas - - DdlVentas.ClearSelection() - If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then - DdlVentas.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") - DdlVentas.DataBind() - DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) - Else - DdlVentas.DataSource = Nothing - DdlVentas.DataBind() - DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) - End If - ObjVentas.Dispose() - End Sub - - Private Sub CargaPersonal() - DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) - DdlPersonal.DataBind() - DdlPersonal.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - - - Protected Sub DdlPlantilla_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantilla.SelectedIndexChanged - - TxtTotalAbonos.Text = "" - TxtTotalCargos.Text = "" - - If DdlPlantilla.SelectedValue.ToEntero <= 0 Then - Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia) - DdlPlantilla.SelectedValue = "-1" - Exit Sub - End If - - If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada - DivAgregarConceptos.Visible = True - Else - DivAgregarConceptos.Visible = False - End If - - - + End Function + Private Sub CargaTiposGasto() + DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + DdlTipoGasto.DataBind() + DdlTipoGasto.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + + Private Sub CargaProveedores() + DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedores.DataBind() + DdlProveedores.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + Private Sub CargaCompras(CveProveedor As Integer) + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 305, 308, 310, 311, 312) Then + Dim ObjCompras As New ClsCompras + + DdlCompras.ClearSelection() + If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then + DdlCompras.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") + DdlCompras.DataBind() + DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlCompras.DataSource = Nothing + DdlCompras.DataBind() + DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjCompras.Dispose() + End If + End Sub + + Private Sub CargaClientes() + DdlClientes.setEsWebService(True) + DdlClientes.Attributes.Add("data-metodo", "getcliente") + DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + DdlClientes.DataBind() + ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + Private Sub CargaVentas(CveCliente As Integer) + Dim ObjVentas As New ClsVentas + + DdlVentas.ClearSelection() + If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + DdlVentas.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") + DdlVentas.DataBind() + DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlVentas.DataSource = Nothing + DdlVentas.DataBind() + DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjVentas.Dispose() + End Sub + + Private Sub CargaPersonal() + DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonal.DataBind() + DdlPersonal.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + + Protected Sub DdlPlantilla_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantilla.SelectedIndexChanged + + TxtTotalAbonos.Text = "" + TxtTotalCargos.Text = "" + + If DdlPlantilla.SelectedValue.ToEntero <= 0 Then + Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia) + DdlPlantilla.SelectedValue = "-1" + Exit Sub + End If + + If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + DivAgregarConceptos.Visible = True + Else + DivAgregarConceptos.Visible = False + End If + + + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") 'Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla, UsuarioActual.CveEmpresa) - Dim Cuenta As String = "" - Dim IdCuenta As Integer = 0 - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - Dim EsComodin As Integer = 0 - DtMovimientos.Clear() - - For Each drt As DataRow In Dt.Rows - - Cuenta = drt("ConceptoContable").ToString - IdCuenta = 0 - CodigoCuenta = "" - NombreCuenta = "" - 'If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables - ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) - ' If drr IsNot Nothing Then - ' IdCuenta = drt("IdCtaContable").ToString.ToEntero - ' CodigoCuenta = drr("CuentaFormato").ToString() - ' NombreCuenta = drr("Nombre").ToString() - ' 'Cuenta = drr("Nombre").ToString() - ' End If - ' EsComodin = 0 - 'End If - + Dim Cuenta As String = "" + Dim IdCuenta As Integer = 0 + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + Dim EsComodin As Integer = 0 + DtMovimientos.Clear() + + For Each drt As DataRow In Dt.Rows + + Cuenta = drt("ConceptoContable").ToString + IdCuenta = 0 + CodigoCuenta = "" + NombreCuenta = "" + 'If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) + ' If drr IsNot Nothing Then + ' IdCuenta = drt("IdCtaContable").ToString.ToEntero + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' 'Cuenta = drr("Nombre").ToString() + ' End If + ' EsComodin = 0 + 'End If + Dim dr As DataRow = DtMovimientos.NewRow - dr("CodigoCuenta") = drt("Codigo").ToString & "
" & drt("Nombre").ToString - dr("Cuenta") = Cuenta 'TxtCuentaContable.Text - dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) - dr("Concepto") = TxtConcepto.Text - dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1) - dr("EsComodin") = EsComodin - dr("CveConcepto") = drt("CveConcepto") - dr("CveSubProyecto") = drt("CveSubProyectoNegativo") - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("CveProveedor") = drt("CveProveedor") - dr("CvePersonal") = drt("CvePersonal") - dr("CveClasificacion") = -1 + dr("CodigoCuenta") = drt("Codigo").ToString & "
" & drt("Nombre").ToString + dr("Cuenta") = Cuenta 'TxtCuentaContable.Text + dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) + dr("Concepto") = TxtConcepto.Text + dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1) + dr("EsComodin") = EsComodin + dr("CveConcepto") = drt("CveConcepto") + dr("CveSubProyecto") = drt("CveSubProyectoNegativo") + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("CveProveedor") = drt("CveProveedor") + dr("CvePersonal") = drt("CvePersonal") + dr("CveClasificacion") = -1 dr("MultipleSubProyecto") = drt("MultipleSubProyecto") dr("CveCuenta") = drt("CveCuenta") - dr("EsComplementaria") = drt("EsComplementaria") + dr("EsComplementaria") = drt("EsComplementaria") 'dr("FolioPoliza") = 0 'drt("FolioPoliza") - DtMovimientos.Rows.Add(dr) - Next - - - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - UPMovs.Update() - - End Sub - - Protected Sub GvMov_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvMov.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - e.Row.Height = Unit.Pixel(1) - e.Row.Cells(0).ToolTip = e.Row.DBCampo("CveCuenta") - - If e.Row.DBCampo("TipoMovto") = "1" Then - e.Row.FCTextBox("TxtAbono").Visible = True - Else - e.Row.FCTextBox("TxtCargo").Visible = True - End If - - e.Row.FCTextBox("TxtAbono").Text = If(e.Row.DBCampo("Abono") = 0, "", e.Row.DBCampo("Abono")) - e.Row.FCTextBox("TxtCargo").Text = If(e.Row.DBCampo("Cargo") = 0, "", e.Row.DBCampo("Cargo")) - e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Descripcion") - - If CvePeriodo > 0 Then - e.Row.FCTextBox("TxtCargo").Enabled = False - e.Row.FCTextBox("TxtAbono").Enabled = False - End If - - e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlSubProyecto").DataBind() - e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) - e.Row.FCDropDownList("DdlSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto") - - 'Asignamos los Tipos de Gasto - e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlTipoGasto").DataBind() - e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) - e.Row.FCDropDownList("DdlTipoGasto").SelectedValue = e.Row.DBCampo("CveTipoGasto") - - If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada - e.Row.FCDropDownList("DdlSubProyecto").Enabled = True - e.Row.FCLinkButton("imgD").Visible = True - Else - e.Row.FCDropDownList("DdlSubProyecto").Enabled = False - End If - - If e.Row.DBCampo("MultipleSubProyecto") = "True" Then - e.Row.FCDropDownList("DdlSubProyecto").Enabled = True - End If - - If e.Row.DBCampo("EsComplementaria") = "True" Then + DtMovimientos.Rows.Add(dr) + Next + + + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + UPMovs.Update() + + End Sub + + Protected Sub GvMov_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvMov.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + e.Row.Height = Unit.Pixel(1) + e.Row.Cells(0).ToolTip = e.Row.DBCampo("CveCuenta") + + If e.Row.DBCampo("TipoMovto") = "1" Then + e.Row.FCTextBox("TxtAbono").Visible = True + Else + e.Row.FCTextBox("TxtCargo").Visible = True + End If + + e.Row.FCTextBox("TxtAbono").Text = If(e.Row.DBCampo("Abono") = 0, "", e.Row.DBCampo("Abono")) + e.Row.FCTextBox("TxtCargo").Text = If(e.Row.DBCampo("Cargo") = 0, "", e.Row.DBCampo("Cargo")) + e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Descripcion") + + If CvePeriodo > 0 Then + e.Row.FCTextBox("TxtCargo").Enabled = False + e.Row.FCTextBox("TxtAbono").Enabled = False + End If + + e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlSubProyecto").DataBind() + e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + e.Row.FCDropDownList("DdlSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto") + + 'Asignamos los Tipos de Gasto + e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlTipoGasto").DataBind() + e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) + e.Row.FCDropDownList("DdlTipoGasto").SelectedValue = e.Row.DBCampo("CveTipoGasto") + + If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + e.Row.FCDropDownList("DdlSubProyecto").Enabled = True + e.Row.FCLinkButton("imgD").Visible = True + Else + e.Row.FCDropDownList("DdlSubProyecto").Enabled = False + End If + + If e.Row.DBCampo("MultipleSubProyecto") = "True" Then + e.Row.FCDropDownList("DdlSubProyecto").Enabled = True + End If + + If e.Row.DBCampo("EsComplementaria") = "True" Then If e.Row.DBCampo("TipoMovto") = "0" Then e.Row.FindControl("divCargoME").Visible = True If e.Row.DBCampo("TipoMovto") = "1" Then e.Row.FindControl("divAbonoME").Visible = True - End If - - - 'Agregamos la opcion para vincular los movimientos bancarios - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then - Dim ObjMovimientos As New ClsMovimientos - Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos") - - Select Case e.Row.DataKey("CveConcepto").ToEntero - - 'Acreedores - Case 41 - If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1, CveMoneda, UsuarioActual.CveEmpresa)) Then - DdlSaldos.Visible = True - DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}") - DdlSaldos.DataBind() - DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - - End Select - - ObjMovimientos.Dispose() - End If - - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then - e.Row.FCLinkButton("ImgBancos").Visible = True - + End If + + + 'Agregamos la opcion para vincular los movimientos bancarios + If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then + Dim ObjMovimientos As New ClsMovimientos + Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos") + + Select Case e.Row.DataKey("CveConcepto").ToEntero + + 'Acreedores + Case 41 + If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1, CveMoneda, UsuarioActual.CveEmpresa)) Then + DdlSaldos.Visible = True + DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}") + DdlSaldos.DataBind() + DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + End Select + + ObjMovimientos.Dispose() + End If + + If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then + e.Row.FCLinkButton("ImgBancos").Visible = True + If e.Row.DataKey("ContadoTipoTransaccion").ToEntero > 0 And e.Row.DataKey("ContadoCuenta").ToEntero > 0 And e.Row.DataKey("ContadoNumeroFolio").ToString.Length > 0 And e.Row.DataKey("ContadoImporte").ToDecimal > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" End If - End If - End If - End Sub - - Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click - + End If + End If + End Sub + + Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click + Dim FolioPoliza As Integer = -1 - Dim CvePrePolizaInsertada As Integer = -1 - + Dim CvePrePolizaInsertada As Integer = -1 + If CvePrePolizaOrigen > 0 Then CrarPrePolizaApartirDe() Exit Sub - End If - - Dim TotalCargos, TotalAbonos As Decimal - - If CvePrePoliza > 0 Then - TotalCargos = TxtTotalCargos.Text.ToDecimal - TotalAbonos = TxtTotalAbonos.Text.ToDecimal - Else - For Each Gvr As GridViewRow In GvMov.Rows - TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal - TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal - Next - End If - - 'validaciones - - - If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0 Or GvMov.Rows.Count > 0)) AndAlso UsuarioActual.CveRol <> 1 Then - Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) - Exit Sub + End If + + Dim TotalCargos, TotalAbonos As Decimal + + If CvePrePoliza > 0 Then + TotalCargos = TxtTotalCargos.Text.ToDecimal + TotalAbonos = TxtTotalAbonos.Text.ToDecimal + Else + For Each Gvr As GridViewRow In GvMov.Rows + TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal + TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal + Next + End If + + 'validaciones + + + If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0 Or GvMov.Rows.Count > 0)) AndAlso UsuarioActual.CveRol <> 1 Then + Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) + Exit Sub End If @@ -1003,37 +1003,37 @@ Partial Class ContabilidadC_RegPrePolizaS 'terminan validaciones - If CvePrePoliza > 0 Then - ActualizarPrePoliza() - Else - Dim MensajeAlert = New StringBuilder - Dim ObjIE As New ClsBancos() + If CvePrePoliza > 0 Then + ActualizarPrePoliza() + Else + Dim MensajeAlert = New StringBuilder + Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) ' Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL) - Dim Conta As ClsContPAQi = Nothing - Dim IDPoliza As Integer = 0 - Dim MsgError As String = "" - Dim CveIE As Integer - Dim FolioIE As String = "" - + Dim Conta As ClsContPAQi = Nothing + Dim IDPoliza As Integer = 0 + Dim MsgError As String = "" + Dim CveIE As Integer + Dim FolioIE As String = "" + Try - Dim ConceptoPoliza As String = TxtConcepto.Text - CvePrePolizaInsertada = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPoliza.SelectedValue.ToEntero, AgregarFolio:=True) - - If CvePrePolizaInsertada > 0 Then - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" - Dim idCuentaContabilizacion As Long = 1 - Dim Importe As Double = 0 - Dim ImporteME As Decimal = 0 - Dim TipoCambio As Decimal = 1 - Dim TipoMovto As Boolean = False - Dim IdCtaContable As Integer = 0 - - FolioPoliza = ObjMov.FolioPoliza - - - 'inserto las compras que voy a pagarDdlSaldos + Dim ConceptoPoliza As String = TxtConcepto.Text + CvePrePolizaInsertada = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPoliza.SelectedValue.ToEntero, AgregarFolio:=True) + + If CvePrePolizaInsertada > 0 Then + Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" + Dim idCuentaContabilizacion As Long = 1 + Dim Importe As Double = 0 + Dim ImporteME As Decimal = 0 + Dim TipoCambio As Decimal = 1 + Dim TipoMovto As Boolean = False + Dim IdCtaContable As Integer = 0 + + FolioPoliza = ObjMov.FolioPoliza + + + 'inserto las compras que voy a pagarDdlSaldos For Each gvr As GridViewRow In GvMov.Rows 'If gvr.DataKey("IDCuenta").ToEntero > 0 Then ' IdCtaContable = gvr.DataKey("IDCuenta") @@ -1054,21 +1054,21 @@ Partial Class ContabilidadC_RegPrePolizaS 'End If End If - ImporteME = 0 - TipoCambio = 1 - If gvr.DataKey("TipoMovto").ToDouble > 0 Then - Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble + ImporteME = 0 + TipoCambio = 1 + If gvr.DataKey("TipoMovto").ToDouble > 0 Then + Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble TipoMovto = True If gvr.DataKey("EsComplementaria") = "True" Then ImporteME = gvr.FCTextBox("TxtAbonoME").Text.ToDecimal TipoCambio = gvr.FCTextBox("TipoCambio").Text.ToDecimal End If Else - Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble - TipoMovto = False + Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble + TipoMovto = False If gvr.DataKey("EsComplementaria") = "True" Then - ImporteME = gvr.FCTextBox("TxtCargoME").Text.ToDecimal - TipoCambio = gvr.FCTextBox("TxtTC").Text.ToDecimal + ImporteME = gvr.FCTextBox("TxtCargoME").Text.ToDecimal + TipoCambio = gvr.FCTextBox("TxtTC").Text.ToDecimal End If End If @@ -1083,97 +1083,97 @@ Partial Class ContabilidadC_RegPrePolizaS End If - If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then - idCuentaContabilizacion = 0 - End If - If Importe <> 0 Then - Dim tCveCuenta As Integer = gvr.DataKey("CveCuenta").ToEntero - + If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then + idCuentaContabilizacion = 0 + End If + If Importe <> 0 Then + Dim tCveCuenta As Integer = gvr.DataKey("CveCuenta").ToEntero + 'If gvr.datakey("CveConcepto") = "299" Then ' tCveCuenta = gvr.DataKey("CveCuenta").ToEntero - 'End If - - If ObjMov.AddPrePolizasDetalle(CvePrePolizaInsertada, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, - TxtFechaDocumento.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, - CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, - CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, - ImporteMX:=Importe, ImporteME:=ImporteME, TipoCambio:=TipoCambio, - CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, - CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then - Else - MsgError = "No se pudo insertar el detalle de la póliza2" - Exit For + 'End If + + If ObjMov.AddPrePolizasDetalle(CvePrePolizaInsertada, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, + TxtFechaDocumento.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, + CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, + CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, + ImporteMX:=Importe, ImporteME:=ImporteME, TipoCambio:=TipoCambio, + CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, + CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then + Else + MsgError = "No se pudo insertar el detalle de la póliza2" + Exit For End If - End If + End If If CveIE > 0 AndAlso gvr.DataKey("CveConcepto").ToEntero = 30 Then MensajeAlert.AppendFormat("

Folio Bancario: {1}", CveIE, FolioIE) - End If + End If Next - If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaInsertada, 1) Then - If ObjMov.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaInsertada}", "LogPrePolizas") - MsgError = ObjMov.MensajePolizaDescuadre - End If + If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaInsertada, 1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaInsertada}", "LogPrePolizas") + MsgError = ObjMov.MensajePolizaDescuadre + End If End If - Else - MsgError = "No se pudo insertar la póliza" - End If - Catch ex As Exception - MsgError = "Error" - End Try - + Else + MsgError = "No se pudo insertar la póliza" + End If + Catch ex As Exception + MsgError = "Error" + End Try + If MsgError = "" Then 'MENSAJE IE - 'If CveIE Then - ' Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") - 'Else - ' Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()") - 'End If - - Alert(If(MensajeAlert.ToString = "", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}
" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""") - - - ObjIE.Commit() - If Conta IsNot Nothing Then Conta.Commit() - - UPPDocumento.Update() - - TxtConcepto.Text = "" - GvMov.DataBind() + 'If CveIE Then + ' Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") + 'Else + ' Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()") + 'End If + + Alert(If(MensajeAlert.ToString = "", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}
" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""") + + + ObjIE.Commit() + If Conta IsNot Nothing Then Conta.Commit() + + UPPDocumento.Update() + + TxtConcepto.Text = "" + GvMov.DataBind() TxtFechaDocumento.Text = "" Else - Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) - ObjIE.RollBack() - If Conta IsNot Nothing Then Conta.RollBack() - End If - - ObjIE.Dispose() - ObjMov.Dispose() - If Conta IsNot Nothing Then Conta.Dispose() - End If - End Sub - + Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) + ObjIE.RollBack() + If Conta IsNot Nothing Then Conta.RollBack() + End If + + ObjIE.Dispose() + ObjMov.Dispose() + If Conta IsNot Nothing Then Conta.Dispose() + End If + End Sub + Private Sub ActualizarPrePoliza() - Dim contador As Integer = 0 - Dim OcurrioError As Boolean = False - Dim ObjContabilidad As New ClsContabilidad - ObjContabilidad.IniciaTransacSQL() - + Dim contador As Integer = 0 + Dim OcurrioError As Boolean = False + Dim ObjContabilidad As New ClsContabilidad + ObjContabilidad.IniciaTransacSQL() + ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then OcurrioError = True - End If - - For Each row As GridViewRow In GvPrePoliza.Rows - If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then + End If + + For Each row As GridViewRow In GvPrePoliza.Rows + If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then If row.FCCheckBox("chkModificado").Checked Then contador = contador + 1 If Not ObjContabilidad.UpdatePrePolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero, @@ -1188,14 +1188,14 @@ Partial Class ContabilidadC_RegPrePolizaS End If Else contador = contador + 1 - If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, - row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString, - row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now, - row.DataKey("IdCtaContable").ToEntero, 0, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero, - CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero), - ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, - row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero, - CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, + If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, + row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString, + row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now, + row.DataKey("IdCtaContable").ToEntero, 0, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero, + CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero), + ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, + row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero, + CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, CveCuenta:=row.DataKey("CveCuenta").ToEntero, PorcentajeImpuesto:=row.DataKey("PorcentajeImpuesto").ToDecimal) Then OcurrioError = True Exit For @@ -1210,60 +1210,60 @@ Partial Class ContabilidadC_RegPrePolizaS Else ObjContabilidad.RollBack() Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError) - End If - - ObjContabilidad.Dispose() - CargaPrePoliza() - + End If + + ObjContabilidad.Dispose() + CargaPrePoliza() + If Not OcurrioError Then If IdPoliza > 0 AndAlso contador Then ' BtnContabilizar_Click(Nothing, Nothing) End If - End If - End Sub - Protected Sub LnkAddConcepto_Click(sender As Object, e As EventArgs) - RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) - LtlTitulo.Text = "Agregar Concepto" - BtnAceptar.Text = "Agregar" - LimpiaCampos() - - 'CargaConceptosContablesE() - CargaSubProyectoE() + End If + End Sub + Protected Sub LnkAddConcepto_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) + LtlTitulo.Text = "Agregar Concepto" + BtnAceptar.Text = "Agregar" + LimpiaCampos() + + 'CargaConceptosContablesE() + CargaSubProyectoE() CargaTipoGastoE() - UpModalConcepto.Update() - End Sub - - + UpModalConcepto.Update() + End Sub + + Protected Sub GvPrePoliza_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvPrePoliza.RowUpdating - RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) - LtlTitulo.Text = "Editar Concepto" - BtnAceptar.Text = "Aceptar" - LimpiaCampos() - IndiceGrid = e.RowIndex - - Dim CveConceptoContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveConceptoContable").ToEntero - Dim CveProveedor As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveProveedor").ToEntero - Dim CveCompra As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCompra").ToEntero - Dim CvePersonal As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CvePersonal").ToEntero - Dim CveCliente As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCliente").ToEntero - Dim CveVenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveVenta").ToEntero - 'Dim FolioFactura As String = GvPrePoliza.Rows(IndiceGrid).FCHyperLink("HlReferencia").Text - Dim Concepto As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtConcepto").Text - Dim Referencia As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtRef").Text - Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveSubProyecto").ToString.ToEntero - Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveTipoGasto").ToString.ToEntero - Dim CveCuenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCuenta").ToString.ToEntero - Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtCargo").Text.ToDouble - Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtAbono").Text.ToDouble - Dim PorcentajeImpuesto As Double = GvPrePoliza.Rows(IndiceGrid).DataKey("PorcentajeImpuesto").ToEntero - - 'CargaConceptosContablesE() - 'CargaModalConceptoCuentas() - - DdlConceptosContablesE.SelectedValueExist(CveConceptoContable) + RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) + LtlTitulo.Text = "Editar Concepto" + BtnAceptar.Text = "Aceptar" + LimpiaCampos() + IndiceGrid = e.RowIndex + + Dim CveConceptoContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveConceptoContable").ToEntero + Dim CveProveedor As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveProveedor").ToEntero + Dim CveCompra As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCompra").ToEntero + Dim CvePersonal As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CvePersonal").ToEntero + Dim CveCliente As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCliente").ToEntero + Dim CveVenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveVenta").ToEntero + 'Dim FolioFactura As String = GvPrePoliza.Rows(IndiceGrid).FCHyperLink("HlReferencia").Text + Dim Concepto As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtConcepto").Text + Dim Referencia As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtRef").Text + Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveSubProyecto").ToString.ToEntero + Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveTipoGasto").ToString.ToEntero + Dim CveCuenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCuenta").ToString.ToEntero + Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtCargo").Text.ToDouble + Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtAbono").Text.ToDouble + Dim PorcentajeImpuesto As Double = GvPrePoliza.Rows(IndiceGrid).DataKey("PorcentajeImpuesto").ToEntero + + 'CargaConceptosContablesE() + 'CargaModalConceptoCuentas() + + DdlConceptosContablesE.SelectedValueExist(CveConceptoContable) DdlConceptosContablesE_SelectedIndexChanged(DdlConceptosContablesE, e) TxtModalConceptoTipoCambio.Text = GvPrePoliza.Rows(IndiceGrid).DataKey("TC").ToString.ToDouble.ToString("###,###,###.00") @@ -1286,71 +1286,71 @@ Partial Class ContabilidadC_RegPrePolizaS 'dr("ContadoImporte") = TxtModalConceptoDocumentoImporte.Text.ToDecimal - DdlProveedoresE.SelectedValueExist(CveProveedor) - DdlProveedoresE_SelectedIndexChanged(DdlProveedoresE, e) - DdlComprasE.SelectedValueExist(CveCompra) - - DdlPersonalE.SelectedValueExist(CvePersonal) - + DdlProveedoresE.SelectedValueExist(CveProveedor) + DdlProveedoresE_SelectedIndexChanged(DdlProveedoresE, e) + DdlComprasE.SelectedValueExist(CveCompra) + + DdlPersonalE.SelectedValueExist(CvePersonal) + If CveCliente > 0 Then DdlClientesE.SelectedValue = CveCliente DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("NombreComercial", $"CveCliente={CveCliente}") DdlClientesE_SelectedIndexChanged(DdlClientesE, e) End If - DdlVentasE.SelectedValueExist(CveVenta) - - TxtConceptoE.Text = Concepto - TxtReferenciaE.Text = Referencia - - CargaSubProyectoE() - DdlSubProyectoE.SelectedValueExist(CveSubProyecto) - CargaTipoGastoE() + DdlVentasE.SelectedValueExist(CveVenta) + + TxtConceptoE.Text = Concepto + TxtReferenciaE.Text = Referencia + + CargaSubProyectoE() + DdlSubProyectoE.SelectedValueExist(CveSubProyecto) + CargaTipoGastoE() DdlTipoGastoE.SelectedValueExist(CveTipoGasto) - DdlCuentaContableE.SelectedValueExist(CveCuenta) - - If Cargo <> 0 Then - TxtCargoE.Text = Cargo - End If - - If Abono <> 0 Then - TxtAbonoE.Text = Abono + DdlCuentaContableE.SelectedValueExist(CveCuenta) + + If Cargo <> 0 Then + TxtCargoE.Text = Cargo End If - If Abono = 0 Then - CargaModalConceptoTipoTransaccion("Ing") - Else - CargaModalConceptoTipoTransaccion("Egs") + If Abono <> 0 Then + TxtAbonoE.Text = Abono + End If + + If Abono = 0 Then + CargaModalConceptoTipoTransaccion("Ing") + Else + CargaModalConceptoTipoTransaccion("Egs") End If - UpModalConcepto.Update() - - End Sub - Private Sub LimpiaCampos() - IndiceGrid = -1 - TxtConceptoE.Text = "" - TxtCargoE.Text = "" - TxtAbonoE.Text = "" - TxtReferenciaE.Text = "" - End Sub - Private Sub CargaConceptosContablesE() - DdlConceptosContablesE.DataSource = GlobalDTContaConceptosContables(-1) - DdlConceptosContablesE.DataBind() - End Sub - Private Sub CargaSubProyectoE() - DdlSubProyectoE.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - DdlSubProyectoE.DataBind() - DdlSubProyectoE.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - Private Sub CargaTipoGastoE() - DdlTipoGastoE.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) - DdlTipoGastoE.DataBind() - DdlTipoGastoE.Items.Insert(0, New ListItem("Sin Asignar", "0")) - End Sub + UpModalConcepto.Update() + + End Sub + Private Sub LimpiaCampos() + IndiceGrid = -1 + TxtConceptoE.Text = "" + TxtCargoE.Text = "" + TxtAbonoE.Text = "" + TxtReferenciaE.Text = "" + End Sub + Private Sub CargaConceptosContablesE() + DdlConceptosContablesE.DataSource = GlobalDTContaConceptosContables(-1) + DdlConceptosContablesE.DataBind() + End Sub + Private Sub CargaSubProyectoE() + DdlSubProyectoE.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoE.DataBind() + DdlSubProyectoE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaTipoGastoE() + DdlTipoGastoE.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + DdlTipoGastoE.DataBind() + DdlTipoGastoE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub Private Sub CargaCtaContableE() Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then @@ -1358,13 +1358,13 @@ Partial Class ContabilidadC_RegPrePolizaS End If ObjConta.Dispose() - DdlCuentaContableE.DataBind() - DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) - End Sub - - - - + DdlCuentaContableE.DataBind() + DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + + + + Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged 'Aquii hay que consultar el concepto y determinar que es lo que se vba aplicar @@ -1549,196 +1549,196 @@ Partial Class ContabilidadC_RegPrePolizaS UpModalConcepto.Update() - End Sub - Private Sub CargaProveedoresE() - DdlProveedoresE.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedoresE.DataBind() - DdlProveedoresE.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - Private Sub CargaComprasE(CveProveedor As Integer) - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 305, 308, 310, 311, 312) Then - Dim ObjCompras As New ClsCompras - - DdlComprasE.ClearSelection() - If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then - DdlComprasE.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") - DdlComprasE.DataBind() - DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) - Else - DdlComprasE.DataSource = Nothing - DdlComprasE.DataBind() - DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) - End If - ObjCompras.Dispose() - End If - End Sub - Private Sub CargaClientesE() - DdlClientesE.setEsWebService(True) - DdlClientesE.Attributes.Add("data-metodo", "getcliente") - DdlClientesE.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - DdlClientesE.DataBind() - ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - Private Sub CargaVentasE(CveCliente As Integer) - Dim ObjVentas As New ClsVentas - - DdlVentasE.ClearSelection() - If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then - DdlVentasE.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") - DdlVentasE.DataBind() - DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) - Else - DdlVentasE.DataSource = Nothing - DdlVentasE.DataBind() - DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) - End If - ObjVentas.Dispose() - End Sub - Private Sub CargaPersonalE() - DdlPersonalE.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) - DdlPersonalE.DataBind() - DdlPersonalE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaProveedoresE() + DdlProveedoresE.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedoresE.DataBind() + DdlProveedoresE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaComprasE(CveProveedor As Integer) + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 305, 308, 310, 311, 312) Then + Dim ObjCompras As New ClsCompras + + DdlComprasE.ClearSelection() + If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then + DdlComprasE.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") + DdlComprasE.DataBind() + DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlComprasE.DataSource = Nothing + DdlComprasE.DataBind() + DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjCompras.Dispose() + End If + End Sub + Private Sub CargaClientesE() + DdlClientesE.setEsWebService(True) + DdlClientesE.Attributes.Add("data-metodo", "getcliente") + DdlClientesE.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + DdlClientesE.DataBind() + ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaVentasE(CveCliente As Integer) + Dim ObjVentas As New ClsVentas + + DdlVentasE.ClearSelection() + If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + DdlVentasE.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") + DdlVentasE.DataBind() + DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlVentasE.DataSource = Nothing + DdlVentasE.DataBind() + DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjVentas.Dispose() + End Sub + Private Sub CargaPersonalE() + DdlPersonalE.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonalE.DataBind() + DdlPersonalE.Items.Insert(0, New ListItem(" - ", "-1")) End Sub - Private Sub CargaClasificacionesE() - DdlClasificacionesE.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacionesE.DataBind() - DdlClasificacionesE.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - Private Sub DdlProveedoresE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedoresE.SelectedIndexChanged - CargaComprasE(DdlProveedoresE.SelectedValue.ToEntero) - End Sub - Private Sub DdlClientesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientesE.selectedindexchange - CargaVentasE(DdlClientesE.SelectedValue.ToEntero) - End Sub - - - + Private Sub CargaClasificacionesE() + DdlClasificacionesE.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionesE.DataBind() + DdlClasificacionesE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub DdlProveedoresE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedoresE.SelectedIndexChanged + CargaComprasE(DdlProveedoresE.SelectedValue.ToEntero) + End Sub + Private Sub DdlClientesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientesE.selectedindexchange + CargaVentasE(DdlClientesE.SelectedValue.ToEntero) + End Sub + + + Protected Sub BtnAceptar_Click(sender As Object, e As EventArgs) Handles BtnAceptar.Click - 'asdasdasd - - If IndiceGrid = -1 Then - - If DtMovimientos Is Nothing Then CreaDT() - + 'asdasdasd + + If IndiceGrid = -1 Then + + If DtMovimientos Is Nothing Then CreaDT() + If CvePrePoliza > 0 Then Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero) - Dim dr As DataRow = DtMovimientos.NewRow + Dim dr As DataRow = DtMovimientos.NewRow dr("IdCtaContable") = IdCtaContable dr("CveCuenta") = DdlCuentaContableE.SelectedValue 'dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text - dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text - dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue - dr("Concepto") = TxtConceptoE.Text - dr("Referencia") = TxtReferenciaE.Text - dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) - dr("Cargo") = TxtCargoE.Text.ToDouble - dr("Abono") = TxtAbonoE.Text.ToDouble - dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) - dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue - dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text - dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero - dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero - dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero - dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero - If DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlComprasE.SelectedItem.ToString() - If DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlVentasE.SelectedItem.ToString() - dr("Modificado") = True - + dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text + dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + dr("Concepto") = TxtConceptoE.Text + dr("Referencia") = TxtReferenciaE.Text + dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + dr("Cargo") = TxtCargoE.Text.ToDouble + dr("Abono") = TxtAbonoE.Text.ToDouble + dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text + dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + If DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlComprasE.SelectedItem.ToString() + If DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlVentasE.SelectedItem.ToString() + dr("Modificado") = True + If DdlPorcentajeIVAE.Visible Then dr("PorcentajeImpuesto") = DdlPorcentajeIVAE.SelectedValue.ToDecimal End If - DtMovimientos.Rows.Add(dr) - DtMovimientos.AcceptChanges() - - If CvePrePoliza > 0 Or CvePrePolizaOrigen Then - GvPrePoliza.DataSource = DtMovimientos - GvPrePoliza.DataBind() - UpPrePoliza.Update() + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + If CvePrePoliza > 0 Or CvePrePolizaOrigen Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() End If TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero - TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero - UpTotalCargo.Update() - UpTotalAbono.Update() - Else - 'Dim dr As DataRow = DtMovimientos.NewRow - 'Dim CodigoCuenta As String = "" - 'Dim NombreCuenta As String = "" - - 'dr("IdCuenta") = DdlCtaContableE.SelectedValue - - 'If DdlCtaContableE.SelectedValue.ToEntero > 0 Then - ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContableE.SelectedValue)) - ' If drr IsNot Nothing Then - ' CodigoCuenta = drr("CuentaFormato").ToString() - ' NombreCuenta = drr("Nombre").ToString() - ' End If - 'End If - - 'dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - 'dr("Cuenta") = DdlConceptosContablesE.SelectedItem.Text - 'dr("Referencia") = TxtReferenciaE.Text - 'dr("Concepto") = TxtConceptoE.Text - 'dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) - 'dr("EsComodin") = 0 - 'dr("CveConcepto") = DdlConceptosContablesE.SelectedValue - 'dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue - 'dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text - 'dr("Cargo") = TxtCargoE.Text.ToDouble - 'dr("Abono") = TxtAbonoE.Text.ToDouble - ''dr("Descripcion") = TxtDescripcionE.Text - 'dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue - 'dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero - 'dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero - 'dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero - 'dr("CveClasificacion") = -1 - 'dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero - 'dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero - - 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbonoE.Text.ToDouble).ToString.FormatoNumero - 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargoE.Text.ToDouble).ToString.FormatoNumero - 'DtMovimientos.Rows.Add(dr) - 'DtMovimientos.AcceptChanges() - - 'GvMov.DataSource = DtMovimientos - 'GvMov.DataBind() - 'UPMovs.Update() - 'Actualizar = False - - End If - Else - Dim CvePrePolizaDetalle As Integer = GvPrePoliza.DataKeys(IndiceGrid).Value.ToString.ToEntero - Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle) - - If Rows.Count > 0 Then + TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero + UpTotalCargo.Update() + UpTotalAbono.Update() + Else + 'Dim dr As DataRow = DtMovimientos.NewRow + 'Dim CodigoCuenta As String = "" + 'Dim NombreCuenta As String = "" + + 'dr("IdCuenta") = DdlCtaContableE.SelectedValue + + 'If DdlCtaContableE.SelectedValue.ToEntero > 0 Then + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContableE.SelectedValue)) + ' If drr IsNot Nothing Then + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' End If + 'End If + + 'dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + 'dr("Cuenta") = DdlConceptosContablesE.SelectedItem.Text + 'dr("Referencia") = TxtReferenciaE.Text + 'dr("Concepto") = TxtConceptoE.Text + 'dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + 'dr("EsComodin") = 0 + 'dr("CveConcepto") = DdlConceptosContablesE.SelectedValue + 'dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + 'dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + 'dr("Cargo") = TxtCargoE.Text.ToDouble + 'dr("Abono") = TxtAbonoE.Text.ToDouble + ''dr("Descripcion") = TxtDescripcionE.Text + 'dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + 'dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + 'dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + 'dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + 'dr("CveClasificacion") = -1 + 'dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + 'dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbonoE.Text.ToDouble).ToString.FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargoE.Text.ToDouble).ToString.FormatoNumero + 'DtMovimientos.Rows.Add(dr) + 'DtMovimientos.AcceptChanges() + + 'GvMov.DataSource = DtMovimientos + 'GvMov.DataBind() + 'UPMovs.Update() + 'Actualizar = False + + End If + Else + Dim CvePrePolizaDetalle As Integer = GvPrePoliza.DataKeys(IndiceGrid).Value.ToString.ToEntero + Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle) + + If Rows.Count > 0 Then Dim dr As DataRow = Rows(0) - Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero) + Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero) dr("IdCtaContable") = IdCtaContable dr("CveCuenta") = DdlCuentaContableE.SelectedValue dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text - dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text - dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue - dr("Concepto") = TxtConceptoE.Text - dr("Referencia") = TxtReferenciaE.Text - dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) - dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) - dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue - dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text - dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero - dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero - dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero - dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + dr("Concepto") = TxtConceptoE.Text + dr("Referencia") = TxtReferenciaE.Text + dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text + dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero dr("FolioFactura") = If(DdlComprasE.Visible = True, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True, DdlVentasE.SelectedItem.ToString, "")) dr("Modificado") = True @@ -1766,207 +1766,207 @@ Partial Class ContabilidadC_RegPrePolizaS 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnTipoGasto").Value = DdlTipoGastoE.SelectedValue.ToEntero 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnCtaContable").Value = DdlCtaContableE.SelectedValue.ToEntero - If TxtCargoE.Text <> "" Then - dr("Cargo") = TxtCargoE.Text.ToDouble - dr("Abono") = "".ToDouble - Else - dr("Abono") = TxtAbonoE.Text.ToDouble - dr("Cargo") = "".ToDouble - End If - - - DtMovimientos.AcceptChanges() - GvPrePoliza.EditIndex = -1 - - If CvePrePoliza > 0 Or CvePrePolizaOrigen > 0 Then - GvPrePoliza.DataSource = DtMovimientos - GvPrePoliza.DataBind() - UpPrePoliza.Update() + If TxtCargoE.Text <> "" Then + dr("Cargo") = TxtCargoE.Text.ToDouble + dr("Abono") = "".ToDouble + Else + dr("Abono") = TxtAbonoE.Text.ToDouble + dr("Cargo") = "".ToDouble + End If + + + DtMovimientos.AcceptChanges() + GvPrePoliza.EditIndex = -1 + + If CvePrePoliza > 0 Or CvePrePolizaOrigen > 0 Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() End If GvPrePoliza.Columns(11).Visible = True GvPrePoliza.Rows(IndiceGrid).FCCheckBox("chkModificado").Checked = True TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero - TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero - UpTotalCargo.Update() - UpTotalAbono.Update() - + TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero + UpTotalCargo.Update() + UpTotalAbono.Update() + End If - RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal") + RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal") End If - - + + UpPrePoliza.Update() - End Sub - Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting - - Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero - - Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov) - If Rows.Count > 0 Then - DtMovimientos.Rows.Remove(Rows(0)) - DtMovimientos.AcceptChanges() - End If - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - - TxtTotalAbonos.Text = DtMovimientos.SUM("Abono").FormatoNumero - TxtTotalCargos.Text = DtMovimientos.SUM("Cargo").FormatoNumero - - 'saco de la póliza el importe del cheque, que coincida la cuenta contable con la bancaria - - End Sub - - Private Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click - - If DtMovimientos Is Nothing Then CreaDT() - - If Actualizar Then - - Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & HdnCve.Value) - - If Rows.Count > 0 Then - Dim dr As DataRow = Rows(0) - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - dr("CveCuenta") = DdlCuentaContable.SelectedValue - - If DdlCuentaContable.SelectedValue.ToEntero > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) - If drr IsNot Nothing Then - CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - End If - End If - - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - dr("Cuenta") = DdlConceptosContables.SelectedItem - dr("Referencia") = TxtReferencia.Text - dr("Concepto") = TxtConcepto.Text - dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) - dr("EsComodin") = 0 - dr("CveConcepto") = DdlConceptosContables.SelectedValue - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("Descripcion") = TxtDescripcion.Text - dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - dr("CveClasificacion") = -1 - dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + End Sub + Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting + + Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero + + Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov) + If Rows.Count > 0 Then + DtMovimientos.Rows.Remove(Rows(0)) + DtMovimientos.AcceptChanges() + End If + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + + TxtTotalAbonos.Text = DtMovimientos.SUM("Abono").FormatoNumero + TxtTotalCargos.Text = DtMovimientos.SUM("Cargo").FormatoNumero + + 'saco de la póliza el importe del cheque, que coincida la cuenta contable con la bancaria + + End Sub + + Private Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click + + If DtMovimientos Is Nothing Then CreaDT() + + If Actualizar Then + + Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & HdnCve.Value) + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + dr("CveCuenta") = DdlCuentaContable.SelectedValue + + If DdlCuentaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) + If drr IsNot Nothing Then + CodigoCuenta = drr("CuentaFormato").ToString() + NombreCuenta = drr("Nombre").ToString() + End If + End If + + dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + dr("Cuenta") = DdlConceptosContables.SelectedItem + dr("Referencia") = TxtReferencia.Text + dr("Concepto") = TxtConcepto.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("EsComodin") = 0 + dr("CveConcepto") = DdlConceptosContables.SelectedValue + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("Descripcion") = TxtDescripcion.Text + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveClasificacion") = -1 + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero End If GvMov.DataSource = DtMovimientos GvMov.DataBind() - UPMovs.Update() - LbCancelarEdicion.Visible = False - LbAgregar.Text = "Agregar" - - Else - - If CvePrePoliza > 0 Then - Dim dr As DataRow = DtMovimientos.NewRow + UPMovs.Update() + LbCancelarEdicion.Visible = False + LbAgregar.Text = "Agregar" + + Else + + If CvePrePoliza > 0 Then + Dim dr As DataRow = DtMovimientos.NewRow dr("IdCtaContable") = -1 'DdlCtaContable.SelectedValue - dr("CveCuenta") = DdlCuentaContable.SelectedValue - dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text - dr("CveConceptoContable") = DdlConceptosContables.SelectedValue - dr("Concepto") = TxtDescripcion.Text - dr("Referencia") = TxtReferencia.Text - dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("ImporteMN") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, TxtCargo.Text.ToDouble, TxtAbono.Text.ToDouble) - dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - dr("SubProyecto") = DdlSubProyecto.SelectedItem.Text - dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - dr("CveVenta") = DdlVentas.SelectedValue.ToEntero - - - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero - DtMovimientos.Rows.Add(dr) - DtMovimientos.AcceptChanges() - - If CvePrePoliza > 0 Then - GvPrePoliza.DataSource = DtMovimientos - GvPrePoliza.DataBind() - UpPrePoliza.Update() - End If - Else - Dim dr As DataRow = DtMovimientos.NewRow - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - - dr("CveCuenta") = DdlCuentaContable.SelectedValue - - If DdlCuentaContable.SelectedValue.ToEntero > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) - If drr IsNot Nothing Then - CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - End If - End If - - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - dr("Cuenta") = DdlConceptosContables.SelectedItem.Text - dr("Referencia") = TxtReferencia.Text - dr("Concepto") = TxtConcepto.Text - dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) - dr("EsComodin") = 0 - dr("CveConcepto") = DdlConceptosContables.SelectedValue - dr("CveConceptoContable") = DdlConceptosContables.SelectedValue - dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("Descripcion") = TxtDescripcion.Text - dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - dr("CveClasificacion") = -1 - dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - dr("CveVenta") = DdlVentas.SelectedValue.ToEntero - - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero - DtMovimientos.Rows.Add(dr) - DtMovimientos.AcceptChanges() - - 'If CvePrePoliza > 0 Then - ' GvPrePoliza.DataSource = DtMovimientos - ' GvPrePoliza.DataBind() - ' UpPrePoliza.Update() - 'End If - - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - UPMovs.Update() - Actualizar = False - - End If - - End If - - TxtCargo.Text = "" - TxtAbono.Text = "" - TxtReferencia.Text = "" - TxtDescripcion.Text = "" + dr("CveCuenta") = DdlCuentaContable.SelectedValue + dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContables.SelectedValue + dr("Concepto") = TxtDescripcion.Text + dr("Referencia") = TxtReferencia.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("ImporteMN") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, TxtCargo.Text.ToDouble, TxtAbono.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("SubProyecto") = DdlSubProyecto.SelectedItem.Text + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + If CvePrePoliza > 0 Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() + End If + Else + Dim dr As DataRow = DtMovimientos.NewRow + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + + dr("CveCuenta") = DdlCuentaContable.SelectedValue + + If DdlCuentaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) + If drr IsNot Nothing Then + CodigoCuenta = drr("CuentaFormato").ToString() + NombreCuenta = drr("Nombre").ToString() + End If + End If + + dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + dr("Cuenta") = DdlConceptosContables.SelectedItem.Text + dr("Referencia") = TxtReferencia.Text + dr("Concepto") = TxtConcepto.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("EsComodin") = 0 + dr("CveConcepto") = DdlConceptosContables.SelectedValue + dr("CveConceptoContable") = DdlConceptosContables.SelectedValue + dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("Descripcion") = TxtDescripcion.Text + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveClasificacion") = -1 + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + 'If CvePrePoliza > 0 Then + ' GvPrePoliza.DataSource = DtMovimientos + ' GvPrePoliza.DataBind() + ' UpPrePoliza.Update() + 'End If + + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + UPMovs.Update() + Actualizar = False + + End If + + End If + + TxtCargo.Text = "" + TxtAbono.Text = "" + TxtReferencia.Text = "" + TxtDescripcion.Text = "" End Sub -#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE" - Public Sub Bancos_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - RowIndex = GvRow.RowIndex - - If GvRow.FCTextBox("TxtAbono").Text = "" Then - CargaTipoTransaccion("Ing") - Else - CargaTipoTransaccion("Egs") +#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE" + Public Sub Bancos_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + RowIndex = GvRow.RowIndex + + If GvRow.FCTextBox("TxtAbono").Text = "" Then + CargaTipoTransaccion("Ing") + Else + CargaTipoTransaccion("Egs") End If Dim IdMov As Integer = GvRow.DataKey("IdMov").ToString.ToEntero @@ -1981,23 +1981,23 @@ Partial Class ContabilidadC_RegPrePolizaS TxtDocumentoObservaciones.Text = dr("ContadoObservaciones").ToString TxtDocumentoBeneficiario.Text = dr("ContadoBeneficiario").ToString End If - - TxtDocumentoImporte.Text = If(GvRow.FCTextBox("TxtAbono").Text = "", GvRow.FCTextBox("TxtCargo").Text.FormatoNumero, GvRow.FCTextBox("TxtAbono").Text.FormatoNumero) - UpBancos.Update() - RegistraScript(String.Format("$('#{0}').modal();", "DivContadoModal")) - End Sub - Private Sub CargaTipoTransaccion(Tipo As String) - DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}' AND Estatus = 1 ") - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - End Sub - Private Sub CargaCuentas() - DdlCuenta.Items.Clear() - DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) - DdlCuenta.DataBind() - DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub + + TxtDocumentoImporte.Text = If(GvRow.FCTextBox("TxtAbono").Text = "", GvRow.FCTextBox("TxtCargo").Text.FormatoNumero, GvRow.FCTextBox("TxtAbono").Text.FormatoNumero) + UpBancos.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivContadoModal")) + End Sub + Private Sub CargaTipoTransaccion(Tipo As String) + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}' AND Estatus = 1 ") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + End Sub + Private Sub CargaCuentas() + DdlCuenta.Items.Clear() + DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) + DdlCuenta.DataBind() + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub Private Sub BtnContado_Click(sender As Object, e As EventArgs) Handles BtnContado.Click Dim Rows As DataRow() = DtMovimientos.Select("IdMov = " & IDMovEditar) @@ -2015,239 +2015,239 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientos.AcceptChanges() GvMov.DataSource = DtMovimientos GvMov.DataBind() - 'CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero - 'CveCuenta = DdlCuenta.SelectedValue.ToEntero - 'Folio = TxtDocumentoFolio.Text - 'ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal - 'Observaciones = TxtDocumentoObservaciones.Text - 'Beneficiario = TxtDocumentoBeneficiario.Text - - - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) - GvMov.Rows(RowIndex).FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" - UPMovs.Update() - End Sub - - Private Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click - Dim ObjContabilidad As New ClsContabilidad - - If ObjContabilidad.RemovePrePolizas(CvePrePoliza, UsuarioActual.CveEmpresa) Then - Alert("La Prepóliza ha sido eliminada", TipoMensaje.MsgInformacion) - Else - Alert("La Prepóliza ha podido ser eliminada", TipoMensaje.MsgError) - End If - - ObjContabilidad.Dispose() - End Sub -#End Region + 'CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero + 'CveCuenta = DdlCuenta.SelectedValue.ToEntero + 'Folio = TxtDocumentoFolio.Text + 'ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal + 'Observaciones = TxtDocumentoObservaciones.Text + 'Beneficiario = TxtDocumentoBeneficiario.Text - Protected Sub DdlTipoGasto_SelectedIndexChanged(sender As Object, e As EventArgs) - If UpPrePoliza.Visible Then - For Each Gvr As GridViewRow In GvPrePoliza.Rows - Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) - Next - UpPrePoliza.Update() - End If - If UPMovs.Visible Then - For Each Gvr As GridViewRow In GvMov.Rows - Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) - Next - UPMovs.Update() - End If - End Sub - Protected Sub DdlSubProyectoFiltro_SelectedIndexChanged(sender As Object, e As EventArgs) - Dim Ddl As DropDownList = CType(sender, DropDownList) - For Each Gvr As GridViewRow In GvPrePoliza.Rows - If Ddl.SelectedValue.ToEntero > 0 Then - If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = Ddl.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then - Gvr.Visible = True - Else - Gvr.Visible = False - End If - Else - Gvr.Visible = True - End If - Next - UpPrePoliza.Update() - RegistraScript("calculateAbono()", "cargo") - RegistraScript("calculateCargo()", "abono") - RegistraScript("comparar()", "compara") - End Sub - Protected Sub DdlSubProyectoFiltroMov_SelectedIndexChanged(sender As Object, e As EventArgs) - For Each Gvr As GridViewRow In GvMov.Rows - If DdlSubProyectoFiltroMov.SelectedValue.ToEntero > 0 Then - If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = DdlSubProyectoFiltroMov.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then - Gvr.Visible = True - Else - Gvr.Visible = False - End If - Else - Gvr.Visible = True - End If - Next - UpPrePoliza.Update() - RegistraScript("calculateAbono()", "cargo") - RegistraScript("calculateCargo()", "abono") - RegistraScript("comparar()", "compara") - End Sub - - Private Sub GvMov_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvMov.RowEditing - Actualizar = True - GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero - Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero - - Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex) - - If DrM IsNot Nothing Then - HdnCve.Value = idMov.ToString - - DdlCuentaContable.SelectedValueExist(DrM("CveCuenta").ToString) - TxtReferencia.Text = DrM("Referencia").ToString - TxtConcepto.Text = DrM("Concepto") - ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto") - DrM("EsComodin") = 0 - DdlConceptosContables.SelectedValueExist(DrM("CveConcepto").ToString) - TxtCargo.Text = DrM("Cargo").ToString - TxtAbono.Text = DrM("Abono").ToString - TxtDescripcion.Text = DrM("Descripcion").ToString - DdlSubProyecto.SelectedValueExist(DrM("CveSubProyecto").ToString) - DdlProveedores.SelectedValueExist(DrM("CveProveedor").ToString) - DdlCompras.SelectedValueExist(DrM("CveCompra").ToString) + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) + GvMov.Rows(RowIndex).FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" + UPMovs.Update() + End Sub + + Private Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click + Dim ObjContabilidad As New ClsContabilidad + + If ObjContabilidad.RemovePrePolizas(CvePrePoliza, UsuarioActual.CveEmpresa) Then + Alert("La Prepóliza ha sido eliminada", TipoMensaje.MsgInformacion) + Else + Alert("La Prepóliza ha podido ser eliminada", TipoMensaje.MsgError) + End If + + ObjContabilidad.Dispose() + End Sub +#End Region + + Protected Sub DdlTipoGasto_SelectedIndexChanged(sender As Object, e As EventArgs) + If UpPrePoliza.Visible Then + For Each Gvr As GridViewRow In GvPrePoliza.Rows + Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) + Next + UpPrePoliza.Update() + End If + If UPMovs.Visible Then + For Each Gvr As GridViewRow In GvMov.Rows + Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) + Next + UPMovs.Update() + End If + End Sub + Protected Sub DdlSubProyectoFiltro_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim Ddl As DropDownList = CType(sender, DropDownList) + For Each Gvr As GridViewRow In GvPrePoliza.Rows + If Ddl.SelectedValue.ToEntero > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = Ddl.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then + Gvr.Visible = True + Else + Gvr.Visible = False + End If + Else + Gvr.Visible = True + End If + Next + UpPrePoliza.Update() + RegistraScript("calculateAbono()", "cargo") + RegistraScript("calculateCargo()", "abono") + RegistraScript("comparar()", "compara") + End Sub + Protected Sub DdlSubProyectoFiltroMov_SelectedIndexChanged(sender As Object, e As EventArgs) + For Each Gvr As GridViewRow In GvMov.Rows + If DdlSubProyectoFiltroMov.SelectedValue.ToEntero > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = DdlSubProyectoFiltroMov.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then + Gvr.Visible = True + Else + Gvr.Visible = False + End If + Else + Gvr.Visible = True + End If + Next + UpPrePoliza.Update() + RegistraScript("calculateAbono()", "cargo") + RegistraScript("calculateCargo()", "abono") + RegistraScript("comparar()", "compara") + End Sub + + Private Sub GvMov_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvMov.RowEditing + Actualizar = True + GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + + Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex) + + If DrM IsNot Nothing Then + HdnCve.Value = idMov.ToString + + DdlCuentaContable.SelectedValueExist(DrM("CveCuenta").ToString) + TxtReferencia.Text = DrM("Referencia").ToString + TxtConcepto.Text = DrM("Concepto") + ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto") + DrM("EsComodin") = 0 + DdlConceptosContables.SelectedValueExist(DrM("CveConcepto").ToString) + TxtCargo.Text = DrM("Cargo").ToString + TxtAbono.Text = DrM("Abono").ToString + TxtDescripcion.Text = DrM("Descripcion").ToString + DdlSubProyecto.SelectedValueExist(DrM("CveSubProyecto").ToString) + DdlProveedores.SelectedValueExist(DrM("CveProveedor").ToString) + DdlCompras.SelectedValueExist(DrM("CveCompra").ToString) DdlPersonal.SelectedValueExist(DrM("CvePersonal").ToString) ' DrM("CveClasificacion") = -1 - DdlClientes.txtValue.Value = DrM("CveCliente").ToString - 'DdlClientes.txtText.Value = DrM("CveCliente").ToString - - DdlVentas.SelectedValueExist(DrM("CveVenta").ToString) - LbCancelarEdicion.Visible = True - LbAgregar.Text = "Actualizar" - - End If - - UPPDocumento.Update() - DivAgregarConceptos.Visible = True - - 'If DtMovimientos Is Nothing Then CreaDT() - - 'Dim dr As DataRow = DtMovimientos.NewRow - 'Dim CodigoCuenta As String = "" - 'Dim NombreCuenta As String = "" - - 'dr("IdCuenta") = DdlCtaContable.SelectedValue - - 'If DdlCtaContable.SelectedValue.ToEntero > 0 Then - ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) - ' If drr IsNot Nothing Then - ' CodigoCuenta = drr("CuentaFormato").ToString() - ' NombreCuenta = drr("Nombre").ToString() - ' End If - 'End If - - 'dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - 'dr("Cuenta") = DdlConceptosContables.SelectedItem - 'dr("Referencia") = TxtReferencia.Text - 'dr("Concepto") = TxtObservaciones.Text - 'dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) - 'dr("EsComodin") = 0 - 'dr("CveConcepto") = DdlConceptosContables.SelectedValue - 'dr("Cargo") = TxtCargo.Text.ToDouble - 'dr("Abono") = TxtAbono.Text.ToDouble - 'dr("Descripcion") = TxtDescripcion.Text - 'dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - 'dr("CveClasificacion") = -1 - 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero - - 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero - 'DtMovimientos.Rows.Add(dr) - - 'If CvePrePoliza > 0 Then - ' GvPrePoliza.DataSource = DtMovimientos - ' GvPrePoliza.DataBind() - 'End If - - - 'GvMov.DataSource = DtMovimientos - 'GvMov.DataBind() - 'UPMovs.Update() - - - End Sub - - Private Sub LbCancelarEdicion_Click(sender As Object, e As EventArgs) Handles LbCancelarEdicion.Click - LbCancelarEdicion.Visible = False - TxtConcepto.Text = "" - Actualizar = False - LbAgregar.Text = "Agregar" + DdlClientes.txtValue.Value = DrM("CveCliente").ToString + 'DdlClientes.txtText.Value = DrM("CveCliente").ToString + + DdlVentas.SelectedValueExist(DrM("CveVenta").ToString) + LbCancelarEdicion.Visible = True + LbAgregar.Text = "Actualizar" + + End If + + UPPDocumento.Update() + DivAgregarConceptos.Visible = True + + 'If DtMovimientos Is Nothing Then CreaDT() + + 'Dim dr As DataRow = DtMovimientos.NewRow + 'Dim CodigoCuenta As String = "" + 'Dim NombreCuenta As String = "" + + 'dr("IdCuenta") = DdlCtaContable.SelectedValue + + 'If DdlCtaContable.SelectedValue.ToEntero > 0 Then + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) + ' If drr IsNot Nothing Then + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' End If + 'End If + + 'dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + 'dr("Cuenta") = DdlConceptosContables.SelectedItem + 'dr("Referencia") = TxtReferencia.Text + 'dr("Concepto") = TxtObservaciones.Text + 'dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + 'dr("EsComodin") = 0 + 'dr("CveConcepto") = DdlConceptosContables.SelectedValue + 'dr("Cargo") = TxtCargo.Text.ToDouble + 'dr("Abono") = TxtAbono.Text.ToDouble + 'dr("Descripcion") = TxtDescripcion.Text + 'dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + 'dr("CveClasificacion") = -1 + 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + 'DtMovimientos.Rows.Add(dr) + + 'If CvePrePoliza > 0 Then + ' GvPrePoliza.DataSource = DtMovimientos + ' GvPrePoliza.DataBind() + 'End If + + + 'GvMov.DataSource = DtMovimientos + 'GvMov.DataBind() + 'UPMovs.Update() + + + End Sub + + Private Sub LbCancelarEdicion_Click(sender As Object, e As EventArgs) Handles LbCancelarEdicion.Click + LbCancelarEdicion.Visible = False + TxtConcepto.Text = "" + Actualizar = False + LbAgregar.Text = "Agregar" End Sub -#Region "COMPLEMENTO DE PAGO" +#Region "COMPLEMENTO DE PAGO" - Private Sub GeneraTimbre(CvePrePoliza As Integer) - Dim Str As New StringBuilder - Dim Banco As New ClsBancos - Banco.IniciaTransacSQL() - If Banco.GeneraTimbrePago(-1, -1, UsuarioActual, CvePrePoliza:=CvePrePoliza) Then - If Banco.Mensaje = "" Then - Banco.Commit() - PDFReciboDePagos(-1, -1, Banco.CveComplementoPago, False) - Str.AppendFormat("Folio: {0}  ", Banco.ComplementoSerieFolio) - Str.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) - Str.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) - MandaCorreo(Banco.ComplementoSerieFolio, Banco.CobranzaCorreo) - End If - Else - Banco.RollBack() - Str.AppendFormat("No se genero complemento por el siguiente motivo: {0}", Banco.Mensaje) - End If - Banco.Dispose() - Alert(Str.ToString, TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();") - End Sub - - Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) - Try - Dim Msg As String = "" - If NombreArchivo <> "-1" Then ' - Dim ObjMail As New ClsSisMail() - Dim RutaXML As String = String.Format("{0}\XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, NombreArchivo) - Dim RutaPDF As String = String.Format("{0}\PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, NombreArchivo) - Dim Cuerpo As String = "Se hace entrega del comprobante de pago" - Dim Asunto As String = "Entrega de comprobante de pago" - If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) - If ObjMail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Cuerpo, "", LSRutasMail) Then - If ConAlerta Then - 'RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - End If - Else - Msg = "No se pudo enviar el correo electrónico." - End If - Else - Msg = "No se pudo adjuntar el correo electrónico." - End If - End If - If ConAlerta AndAlso Msg <> "" Then - Alert(Msg, TipoMensaje.MsgError) - End If - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - - Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) - GeneraTimbre(CvePrePoliza) + Private Sub GeneraTimbre(CvePrePoliza As Integer) + Dim Str As New StringBuilder + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + If Banco.GeneraTimbrePago(-1, -1, UsuarioActual, CvePrePoliza:=CvePrePoliza) Then + If Banco.Mensaje = "" Then + Banco.Commit() + PDFReciboDePagos(-1, -1, Banco.CveComplementoPago, False) + Str.AppendFormat("Folio: {0}  ", Banco.ComplementoSerieFolio) + Str.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + Str.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + MandaCorreo(Banco.ComplementoSerieFolio, Banco.CobranzaCorreo) + End If + Else + Banco.RollBack() + Str.AppendFormat("No se genero complemento por el siguiente motivo: {0}", Banco.Mensaje) + End If + Banco.Dispose() + Alert(Str.ToString, TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();") End Sub -#End Region + + Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) + Try + Dim Msg As String = "" + If NombreArchivo <> "-1" Then ' + Dim ObjMail As New ClsSisMail() + Dim RutaXML As String = String.Format("{0}\XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim RutaPDF As String = String.Format("{0}\PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim Cuerpo As String = "Se hace entrega del comprobante de pago" + Dim Asunto As String = "Entrega de comprobante de pago" + If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) + If ObjMail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Cuerpo, "", LSRutasMail) Then + If ConAlerta Then + 'RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + End If + Else + Msg = "No se pudo enviar el correo electrónico." + End If + Else + Msg = "No se pudo adjuntar el correo electrónico." + End If + End If + If ConAlerta AndAlso Msg <> "" Then + Alert(Msg, TipoMensaje.MsgError) + End If + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) + GeneraTimbre(CvePrePoliza) + End Sub +#End Region @@ -2571,10 +2571,10 @@ Partial Class ContabilidadC_RegPrePolizaS End If Return CType(ViewState("ArregloCuentasFolios"), DataTable) - End Get - Set(value As DataTable) - ViewState("ArregloCuentasFolios") = value - End Set + End Get + Set(value As DataTable) + ViewState("ArregloCuentasFolios") = value + End Set End Property @@ -2737,37 +2737,37 @@ Partial Class ContabilidadC_RegPrePolizaS End Function - Private Sub CargaPrePolizaOrigen() - BtnEliminar.Visible = True - LblEncabezado.Text = "Crear a partir de" - - Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetPrePoliza(CvePrePolizaOrigen, UsuarioActual.CveEmpresa) Then - Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("") - If dr IsNot Nothing Then - DivAgregarConceptos.Visible = False - DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") - TxtFechaDocumento.Text = dr("Fecha") - TxtConcepto.Text = dr("Concepto") + Private Sub CargaPrePolizaOrigen() + BtnEliminar.Visible = True + LblEncabezado.Text = "Crear a partir de" + + Dim ObjContabilidad As New ClsContabilidad + If ObjContabilidad.GetPrePoliza(CvePrePolizaOrigen, UsuarioActual.CveEmpresa) Then + Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("") + If dr IsNot Nothing Then + DivAgregarConceptos.Visible = False + DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") + TxtFechaDocumento.Text = dr("Fecha") + TxtConcepto.Text = dr("Concepto") DivDatosPoliza.Visible = True TipoPoliza = DdlTipoPoliza.SelectedItem.Text - Folio = dr("FolioPoliza").ToString - - TxtFolio.Text = "" - TxtUsuarioElaboro.Text = dr("Usuario").ToString + Folio = dr("FolioPoliza").ToString + + TxtFolio.Text = "" + TxtUsuarioElaboro.Text = dr("Usuario").ToString TxtFechaelaboracion.Text = dr("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy") ' TxtEstatus.Text = If(Boolean.Parse(dr("Estatus").ToString), "Activa", "Inactiva") - CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString - - If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then - 'DivAgregarConceptos.Visible = True - LnkAddConcepto.Visible = True - CargaConceptos() - CargaSubProyectos() - CargaCuentasContables() - End If - - ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePolizaOrigen) + CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString + + If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then + 'DivAgregarConceptos.Visible = True + LnkAddConcepto.Visible = True + CargaConceptos() + CargaSubProyectos() + CargaCuentasContables() + End If + + ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePolizaOrigen) DtMovimientos = ObjContabilidad.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") @@ -2830,14 +2830,14 @@ Partial Class ContabilidadC_RegPrePolizaS LnkExcel.Visible = False LnkImprimirPDF.Visible = True Else - Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnEliminar.Visible = False - End If - - End If - - ObjContabilidad.Dispose() - UpPoliza.Update() + Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnEliminar.Visible = False + End If + + End If + + ObjContabilidad.Dispose() + UpPoliza.Update() End Sub @@ -2859,57 +2859,57 @@ Partial Class ContabilidadC_RegPrePolizaS 'validaciones - If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0)) Then - Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) - Exit Sub + If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0)) Then + Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) + Exit Sub End If - - 'terminan validaciones - - If CvePrePoliza > 0 Then - ActualizarPrePoliza() - Else - Dim MensajeAlert = New StringBuilder - Dim ObjIE As New ClsBancos() + + 'terminan validaciones + + If CvePrePoliza > 0 Then + ActualizarPrePoliza() + Else + Dim MensajeAlert = New StringBuilder + Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) ' Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL) - Dim Conta As ClsContPAQi = Nothing - Dim IDPoliza As Integer = 0 - Dim MsgError As String = "" - Dim CveIE As Integer - Dim FolioIE As String = "" - + Dim Conta As ClsContPAQi = Nothing + Dim IDPoliza As Integer = 0 + Dim MsgError As String = "" + Dim CveIE As Integer + Dim FolioIE As String = "" + Try - Dim ConceptoPoliza As String = TxtConcepto.Text - - CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePolizaCrear", CvePlantillaPoliza, TotalCargos, TotalAbonos, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPoliza.SelectedValue.ToEntero, AgregarFolio:=True) - - If CvePrePoliza > 0 Then - - FolioPoliza = ObjMov.FolioPoliza - - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" - Dim idCuentaContabilizacion As Long = 1 - Dim Importe As Double = 0 - Dim ImporteME As Decimal = 0 - Dim TipoCambio As Decimal = 1 - Dim TipoMovto As Boolean = False - Dim IdCtaContable As Integer = 0 - - - 'inserto las compras que voy a pagarDdlSaldos + Dim ConceptoPoliza As String = TxtConcepto.Text + + CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePolizaCrear", CvePlantillaPoliza, TotalCargos, TotalAbonos, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPoliza.SelectedValue.ToEntero, AgregarFolio:=True) + + If CvePrePoliza > 0 Then + + FolioPoliza = ObjMov.FolioPoliza + + Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" + Dim idCuentaContabilizacion As Long = 1 + Dim Importe As Double = 0 + Dim ImporteME As Decimal = 0 + Dim TipoCambio As Decimal = 1 + Dim TipoMovto As Boolean = False + Dim IdCtaContable As Integer = 0 + + + 'inserto las compras que voy a pagarDdlSaldos For Each gvr As GridViewRow In GvPrePoliza.Rows - ImporteME = 0 - TipoCambio = 1 - + ImporteME = 0 + TipoCambio = 1 + If Boolean.Parse(gvr.DataKey("TipoMovto")) Then - Importe = gvr.FCLiteral("TxtAbono").Text.ToDouble + Importe = gvr.FCLiteral("TxtAbono").Text.ToDouble TipoMovto = True If gvr.DataKey("EsComplementaria") = "True" Then @@ -2918,12 +2918,12 @@ Partial Class ContabilidadC_RegPrePolizaS End If Else - Importe = gvr.FCLiteral("TxtCargo").Text.ToDouble + Importe = gvr.FCLiteral("TxtCargo").Text.ToDouble TipoMovto = False If gvr.DataKey("EsComplementaria") = "True" Then ImporteME = gvr.FCTextBox("TxtCargo").Text.ToDecimal 'me - TipoCambio = gvr.FCTextBox("TxtModalConceptoDocumentoImporte").Text.ToDecimal + TipoCambio = gvr.FCTextBox("TxtModalConceptoDocumentoImporte").Text.ToDecimal End If End If @@ -2957,54 +2957,54 @@ Partial Class ContabilidadC_RegPrePolizaS End If - If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then - idCuentaContabilizacion = 0 - End If - If Importe <> 0 Then + If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then + idCuentaContabilizacion = 0 + End If + If Importe <> 0 Then Dim tCveCuenta As Integer = gvr.DataKey("CveCuenta").ToEntero - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.DataKey("Referencia"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("Concepto"), - TxtFechaDocumento.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveIE:=CveIE, - CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, - CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, - ImporteMX:=Importe, ImporteME:=ImporteME, TipoCambio:=TipoCambio, CveTipoGasto:=gvr.DataKey("CveTipoGasto").ToEntero, + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.DataKey("Referencia"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("Concepto"), + TxtFechaDocumento.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveIE:=CveIE, + CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, + CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, + ImporteMX:=Importe, ImporteME:=ImporteME, TipoCambio:=TipoCambio, CveTipoGasto:=gvr.DataKey("CveTipoGasto").ToEntero, CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then - Else - MsgError = "No se pudo insertar el detalle de la póliza2" - Exit For + Else + MsgError = "No se pudo insertar el detalle de la póliza2" + Exit For End If - End If + End If If CveIE > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero = 30 Then MensajeAlert.AppendFormat("

Folio Bancario: {1}", CveIE, FolioIE) - End If + End If Next - If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then - If ObjMov.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - MsgError = ObjMov.MensajePolizaDescuadre - End If + If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + MsgError = ObjMov.MensajePolizaDescuadre + End If End If - - - Else - MsgError = "No se pudo insertar la póliza" - End If - Catch ex As Exception - MsgError = "Error" + + + Else + MsgError = "No se pudo insertar la póliza" + End If + Catch ex As Exception + MsgError = "Error" End Try If MsgError = "" Then If Not ObjMov.UpdatePrePolizasOrdenamiento(CvePrePoliza, UsuarioActual.CveEmpresa) Then MsgError = "Orror al ordenar polzia" End If - End If - + End If + If MsgError = "" Then @@ -3022,14 +3022,14 @@ Partial Class ContabilidadC_RegPrePolizaS TxtFechaDocumento.Text = "" Else - Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) - ObjIE.RollBack() - If Conta IsNot Nothing Then Conta.RollBack() - End If - - ObjIE.Dispose() - ObjMov.Dispose() - If Conta IsNot Nothing Then Conta.Dispose() + Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) + ObjIE.RollBack() + If Conta IsNot Nothing Then Conta.RollBack() + End If + + ObjIE.Dispose() + ObjMov.Dispose() + If Conta IsNot Nothing Then Conta.Dispose() End If @@ -3058,16 +3058,16 @@ Partial Class ContabilidadC_RegPrePolizaS DdlModalConceptoTipoTransaccion.SelectedIndex = -1 DdlModalConceptoTipoTransaccion.ClearSelection() DdlModalConceptoTipoTransaccion.SelectedValue = Nothing - DdlModalConceptoTipoTransaccion.DataBind() - DdlModalConceptoTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - - End Sub - Private Sub CargaModalConceptoCuentas() + DdlModalConceptoTipoTransaccion.DataBind() + DdlModalConceptoTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + + End Sub + Private Sub CargaModalConceptoCuentas() DdlModalConceptoCuenta.Items.Clear() DdlModalConceptoCuenta.ClearSelection() - DdlModalConceptoCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) - DdlModalConceptoCuenta.SelectedValue = Nothing - DdlModalConceptoCuenta.DataBind() + DdlModalConceptoCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) + DdlModalConceptoCuenta.SelectedValue = Nothing + DdlModalConceptoCuenta.DataBind() DdlModalConceptoCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -3081,5 +3081,5 @@ Partial Class ContabilidadC_RegPrePolizaS -End Class - +End Class + diff --git a/Contratos/ContratoObraAutorizacion.aspx b/Contratos/ContratoObraAutorizacion.aspx index 2b0eece80..e4cb59a81 100644 --- a/Contratos/ContratoObraAutorizacion.aspx +++ b/Contratos/ContratoObraAutorizacion.aspx @@ -160,8 +160,7 @@
- - +
diff --git a/Contratos/ContratoObraAutorizacion.aspx.vb b/Contratos/ContratoObraAutorizacion.aspx.vb index 3c2a32cd5..881aaeac4 100644 --- a/Contratos/ContratoObraAutorizacion.aspx.vb +++ b/Contratos/ContratoObraAutorizacion.aspx.vb @@ -221,11 +221,9 @@ Partial Class Contratos_ContratoObraAutorizacion If DTEstimaciones.Rows.Count > 0 Then GvEstimaciones.DataSource = DTEstimaciones - 'BtnGuardarEstimacion.Visible = True BtnAutoriza.Visible = True Else GvEstimaciones.DataSource = Nothing - BtnGuardarEstimacion.Visible = False End If GvEstimaciones.DataBind() @@ -271,56 +269,6 @@ Partial Class Contratos_ContratoObraAutorizacion End Sub - Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click - - CveEstimacionNueva = -1 - NuemeroEstimacionNuevo = -1 - - Dim ObjContratos As New ClsContratos() - Dim ErrorProceso As Boolean = False - - ObjContratos.IniciaTransacSQL() - - - If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - - CveEstimacionNueva = ObjContratos.CveEstimacionNueva - NuemeroEstimacionNuevo = ObjContratos.NumeroEstimacionNueva - - For Each GvRow As GridViewRow In GvEstimaciones.Rows - - If GvRow.DataKey("CveContratoAvance").ToEntero > 0 Then - If Not ObjContratos.UpdateContratosAvanceEstimacion(GvRow.DataKey("CveContratoAvance").ToEntero, ObjContratos.CveEstimacionNueva, UsuarioActual.CveEmpresa) Then - ErrorProceso = True - Exit For - End If - End If - Next - - Else - ErrorProceso = True - End If - - 'AddContratosAvanceEstimacion - 'UpdateContratosAvanceEstimacion - - - - If Not ErrorProceso Then - ObjContratos.Commit() - Alert($"Estimación {NuemeroEstimacionNuevo} agregada correctamente.") - - BtnGuardarEstimacion.Visible = False - BtnDescargarGenerado.Visible = True - - Else - ObjContratos.RollBack() - End If - - ObjContratos.Dispose() - - UpEstimaciones.Update() - End Sub Private Sub BtnDescargarGenerado_Click(sender As Object, e As EventArgs) Handles BtnDescargarGenerado.Click diff --git a/Empresas/119/Formatos/RepIVAAcreditable.rpt b/Empresas/119/Formatos/RepIVAAcreditable.rpt index ce9d8faf0..cad593981 100644 Binary files a/Empresas/119/Formatos/RepIVAAcreditable.rpt and b/Empresas/119/Formatos/RepIVAAcreditable.rpt differ diff --git a/Empresas/Grales/Formatos/RepIVA.rpt b/Empresas/Grales/Formatos/RepIVA.rpt index cdd0ad6c0..1ff221782 100644 Binary files a/Empresas/Grales/Formatos/RepIVA.rpt and b/Empresas/Grales/Formatos/RepIVA.rpt differ diff --git a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt index e7e29a232..5d6ac0536 100644 Binary files a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt and b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt differ diff --git a/Inventarios/CartaPorteManual.aspx b/Inventarios/CartaPorteManual.aspx index 005b104b9..7f8b36fde 100644 --- a/Inventarios/CartaPorteManual.aspx +++ b/Inventarios/CartaPorteManual.aspx @@ -237,7 +237,7 @@
<%----%> - + diff --git a/Inventarios/CartaPorteManual.aspx.vb b/Inventarios/CartaPorteManual.aspx.vb index 08826db65..8c47ee8c4 100644 --- a/Inventarios/CartaPorteManual.aspx.vb +++ b/Inventarios/CartaPorteManual.aspx.vb @@ -562,7 +562,7 @@ Partial Class Inventarios_CartaPorteManual Dim FechallegadaMM As DateTime = (FechaLlegada.ToString("dd/MM/yyyy") & " 23:59:59").ToDateTime Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(DdlSubProyecto.SelectedValue.ToEntero, CveDireccionOrigen, CveDireccionDestino, -1, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, FechaSalida, FechallegadaMM, "T", "-1", "-1", FechaLlegada, 1, 1, TxtDistancia.Text.ToEntero, - ConfigCartaPorte:=DdlConfigAuto.SelectedValue, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero) + CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero) If CveEntregaAlmacen > 0 Then @@ -1398,7 +1398,7 @@ Partial Class Inventarios_CartaPorteManual Using ObjInv As New ClsInventarios If ObjInv.GetCamiones(DdlUnidadCamion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 1) Then - DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("ConfigCartaPorte")) + DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("CveConfigAutoTransporte")) DdlConfigAuto_SelectedIndexChanged(Nothing, Nothing) End If @@ -1454,11 +1454,11 @@ Partial Class Inventarios_CartaPorteManual DdlRemolque1.SelectedValueExist(-1) DdlRemolque2.SelectedValueExist(-1) - If DdlConfigAuto.SelectedIndex > 0 Then + If DdlConfigAuto.SelectedValue.ToEntero > 0 Then Using ObjGrales As New ClsGenerales If ObjGrales.GetCartaPorteConfigAutoTransportes() Then - Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" ClaveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'") + Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'") If Remolque = "1" Then diff --git a/Inventarios/CatUnidades.aspx b/Inventarios/CatUnidades.aspx index 04ecf1df0..a2d03dac5 100644 --- a/Inventarios/CatUnidades.aspx +++ b/Inventarios/CatUnidades.aspx @@ -31,12 +31,12 @@ - - + @@ -124,7 +124,7 @@
- + diff --git a/Inventarios/CatUnidades.aspx.vb b/Inventarios/CatUnidades.aspx.vb index 25af2d857..7faeba751 100644 --- a/Inventarios/CatUnidades.aspx.vb +++ b/Inventarios/CatUnidades.aspx.vb @@ -125,7 +125,7 @@ Partial Class Inventarios_CatUnidades TxtPlacaNuevo.Text = GvRow.DataKey("Placa") TxtEspecificacionNuevo.Text = GvRow.DataKey("Especificacion") - DdlConfigAuto.SelectedValueExist(GvRow.DataKey("ConfigCartaPorte")) + DdlConfigAuto.SelectedValueExist(GvRow.DataKey("CveConfigAutoTransporte")) TxtAnio.Text = GvRow.DataKey("Anio") DdlTipoPermisoSCT.SelectedValueExist(GvRow.DataKey("CveTipoPermisoSCT")) @@ -197,14 +197,14 @@ Partial Class Inventarios_CatUnidades Using ObjInventarios As New ClsInventarios If CveCamion <= 0 Then - If ObjInventarios.AddCamiones(TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, UsuarioActual.CveEmpresa, DdlConfigAuto.SelectedValue, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, + If ObjInventarios.AddCamiones(TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, UsuarioActual.CveEmpresa, DdlConfigAuto.SelectedValue.ToEntero, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, TxtNombreAseguradoraMedioAmbiente.Text, TxtNumPolizaSeguroMedioAmbiente.Text, TxtNombreAseguradoraCarga.Text, TxtNumPolizaSeguroCarga.Text, CveTipoCamion, TxtLongitudCaja.Text, TxtLineaTransportacion.Text, TxtSCAC.Text, TxtCAAT.Text, DdlTiposRemolque.SelectedValue.ToEntero(), TxtNumeroTrailer.Text) Then Alert("Unidad agregada correctamente") Else ErrorPrceso = True End If Else - If ObjInventarios.UpdateCamiones(CveCamion, TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, DdlConfigAuto.SelectedValue, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + If ObjInventarios.UpdateCamiones(CveCamion, TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, DdlConfigAuto.SelectedValue.ToEntero, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtNombreAseguradoraMedioAmbiente.Text, TxtNumPolizaSeguroMedioAmbiente.Text, TxtNombreAseguradoraCarga.Text, TxtNumPolizaSeguroCarga.Text, CveTipoCamion, TxtLongitudCaja.Text, TxtLineaTransportacion.Text, TxtSCAC.Text, TxtCAAT.Text, DdlTiposRemolque.SelectedValue.ToEntero(), TxtNumeroTrailer.Text) Then Alert("Unidad actualizada correctamente") Else diff --git a/Inventarios/RepEntregaAlmacenRuta.aspx b/Inventarios/RepEntregaAlmacenRuta.aspx index 99c34b4b8..cf78c0eb9 100644 --- a/Inventarios/RepEntregaAlmacenRuta.aspx +++ b/Inventarios/RepEntregaAlmacenRuta.aspx @@ -99,7 +99,7 @@ " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
@@ -165,7 +165,12 @@ - + + + + + + @@ -216,7 +221,7 @@
<%----%> - + diff --git a/Inventarios/RepEntregaAlmacenRuta.aspx.cs b/Inventarios/RepEntregaAlmacenRuta.aspx.cs index 8a8337a05..563bbfe86 100644 --- a/Inventarios/RepEntregaAlmacenRuta.aspx.cs +++ b/Inventarios/RepEntregaAlmacenRuta.aspx.cs @@ -333,7 +333,7 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas { ClsGenerales ObjGeneral = new ClsGenerales(); - if (ObjGeneral.GetInvEntregaAlmacenRutaRep(DdlSucursales.SelectedValue.ToEntero(),UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero(), TxtFechaI.Text.ToDate(), TxtFechaF.Text.ToDate(), DdlChofer.SelectedValue.ToEntero())) + if (ObjGeneral.GetInvEntregaAlmacenRutaRep(DdlSucursales.SelectedValue.ToEntero(),UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero(), TxtFechaI.Text.ToDate(), TxtFechaF.Text.ToDate(), DdlChofer.SelectedValue.ToEntero(),UsuarioActual.CveUsuario)) { DTDatos = ObjGeneral.DtResultados; GVDatos.DataSource = DTDatos; @@ -370,7 +370,7 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas TxtFechaEntrega.Text = GvRow.DataKey("FechaEntrega").ToDate().ToString("dd/MM/yyyy"); TxtFechaLlegada.Text = GvRow.DataKey("FechaLlegada").ToDate().ToString("dd/MM/yyyy"); TxtDistancia.Text = GvRow.DataKey("Distancia"); - DdlConfigAuto.SelectedValueExist(GvRow.DataKey("ConfigCartaPorte")); + DdlConfigAuto.SelectedValueExist(GvRow.DataKey("CveConfigAutoTransporte")); DdlConfigAuto_SelectedIndexChanged(null, null); if (GvRow.DataKey("CveCamionRemolque1").ToEntero() > 0) @@ -393,17 +393,17 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas ModalActualizaDirecciones( CveTimbre); - //if( CveDireccionOrigen > 0) - //{ - // DVDireccionOrigen.Visible = true; + if (CveDireccionOrigen > 0) + { + DVDireccionOrigen.Visible = true; - // LnkDireccionOrigen.Text = GvRow.DataKey("DireccionOrigen") + " "; - //} - //if (CveDireccionDestino > 0) - //{ - // DVDireccionDestino.Visible = true; - // LnkDireccionDestino.Text = GvRow.DataKey("Direccion") + " "; - //} + LnkDireccionOrigen.Text = GvRow.DataKey("DireccionOrigen") + " "; + } + if (CveDireccionDestino > 0) + { + DVDireccionDestino.Visible = true; + LnkDireccionDestino.Text = GvRow.DataKey("Direccion") + " "; + } UpModalEditarentrega.Update(); @@ -586,8 +586,8 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas ClsGenerales ObjGral = new ClsGenerales(); if(!ObjGral.UpdateInvEntregaAlmacenRuta(CveEntregaAlmacen,-1,-1, DdlModalChofer.SelectedValue.ToEntero(), DdlModalCamion.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), UsuarioActual.CveEmpresa, - TxtFechaLlegada.Text.ToDate(), CveCamionRemolque1: DdlRemolque1.SelectedValue.ToEntero(), CveCamionRemolque2: DdlRemolque2.SelectedValue.ToEntero(), Distancia: TxtDistancia.Text.ToEntero(), - ConfigCartaPorte: DdlConfigAuto.SelectedValue)) + TxtFechaLlegada.Text.ToDate(), CveCamionRemolque1: DdlRemolque1.SelectedValue.ToEntero(), CveCamionRemolque2: DdlRemolque2.SelectedValue.ToEntero(), Distancia: TxtDistancia.Text.ToEntero(), + CveConfigAutoTransporte: DdlConfigAuto.SelectedValue.ToEntero())) { ProcesoOK = false; } @@ -651,7 +651,7 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas e.Row.FCHyperLink("HplPDF").NavigateUrl = "/Compras/PopUpVerFactura.aspx?P=" + Extensiones.ModExtensiones.Encripta(String.Format("OP=CARPO&CVETIMBRE={0}", e.Row.DataKey("CveTimbre"))); } - //string ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, e.Row.DataKey("TimbreTipoDocto"), e.Row.DataKey("SerieFolio")); + string ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, e.Row.DataKey("TimbreTipoDocto"), e.Row.DataKey("SerieFolio")); //if (File.Exists(ArchivoXML)) //{ @@ -661,7 +661,9 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas } else { - e.Row.Cells[11].Text = ""; + //e.Row.Cells[11].Text = ""; + e.Row.Cells[12].Text = ""; + e.Row.Cells[13].Text = ""; } if (e.Row.DataKey("Estatus").ToEntero() == 2) @@ -733,7 +735,7 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas { if (ObjInv.GetCamiones(DdlModalCamion.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, 1)) { - DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("ConfigCartaPorte")); + DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("CveConfigAutoTransporte")); DdlConfigAuto_SelectedIndexChanged(null, null); } } @@ -789,13 +791,13 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas DdlRemolque1.SelectedValueExist(-1); DdlRemolque2.SelectedValueExist(-1); - if (DdlConfigAuto.SelectedIndex > 0) + if (DdlConfigAuto.SelectedValue.ToEntero() > 0) { using (ClsGenerales ObjGrales = new ClsGenerales()) { if (ObjGrales.GetCartaPorteConfigAutoTransportes()) { - string Remolque = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" ClaveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'"); + string Remolque = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue.ToEntero()}'"); if (Remolque == "1") diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index 9a2231966..dc13d3ed7 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -234,7 +234,7 @@
<%----%> - + diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 04ceface6..93b8d5dc5 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1237,7 +1237,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim Fechallegada As DateTime = (TxtFechaLlegada.Text & " 23:59:59").ToDateTime Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(CveSubProyectoTimbre, -1, -1, CveMovimientoSalida, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, TxtFechaEntrega.Text.ToDate, TxtFechaLlegada.Text.ToDate, "T", "", "", MinFecha, 1, 1, TxtDistancia.Text.ToEntero, - ConfigCartaPorte:=DdlConfigAuto.SelectedValue, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero) + CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero) If CveEntregaAlmacen > 0 Then CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked) @@ -3188,7 +3188,7 @@ Partial Class Inventarios_TraspasoAlmacen Using ObjInv As New ClsInventarios If ObjInv.GetCamiones(DdlUnidadCamion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 1) Then - DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("ConfigCartaPorte")) + DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("CveConfigAutoTransporte")) DdlConfigAuto_SelectedIndexChanged(Nothing, Nothing) End If @@ -3244,11 +3244,11 @@ Partial Class Inventarios_TraspasoAlmacen DdlRemolque1.SelectedValueExist(-1) DdlRemolque2.SelectedValueExist(-1) - If DdlConfigAuto.SelectedIndex > 0 Then + If DdlConfigAuto.SelectedValue.ToEntero > 0 Then Using ObjGrales As New ClsGenerales If ObjGrales.GetCartaPorteConfigAutoTransportes() Then - Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" ClaveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'") + Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue.ToEntero}'") If Remolque = "1" Then