From cf181b293eb329547801fc6ad9842abcabd8e2b3 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Sat, 24 Aug 2019 12:13:37 -0700 Subject: [PATCH 1/2] --- Bancos/IE.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index e83e9f36d..fe5ce8ef2 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -689,7 +689,7 @@ Partial Class Bancos_IE LnkAjustarMovimiento.Visible = True End If - If Not VerificaComplementos(True) Then + If UsuarioActual.CveEmpresa = 72 OrElse Not VerificaComplementos(True) Then 'No entrara para la empresa 72 porque tarda mucho el load LnkCancelarComplemento.Visible = False LnkCancelarComplementoImporte.Visible = False From d14c788dc78b087377e136ebca7edad726f12db7 Mon Sep 17 00:00:00 2001 From: Rene Molina Date: Sat, 24 Aug 2019 12:43:34 -0700 Subject: [PATCH 2/2] =?UTF-8?q?cambio=20en=20ventas,=20TC=20no=20editable?= =?UTF-8?q?=20-=20popupaxiliar.=20=20generar=20p=C3=B3liza=20cancelada=20a?= =?UTF-8?q?partir=20de=20otra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsContabilidad.vb | 7 +- Contabilidad/PopUpAuxiliar.aspx.vb | 756 +++++++++++++++-------------- Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 8 +- 4 files changed, 397 insertions(+), 376 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 4ab57dfa8..2b556565a 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -228,9 +228,9 @@ Public Class ClsContabilidad - Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Boolean + Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Integer - Dim Retorno As Boolean = False + Dim Retorno As Integer = -1 DataAdapter("PA_Conta_PrePolizasNegativaAdd") @@ -240,11 +240,12 @@ Public Class ClsContabilidad .Add("@Concepto", SqlDbType.VarChar).Value = Concepto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CvePrePolizaNueva", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@CvePrePolizaNueva").Value.ToString.ToEntero Catch ex As Exception OnError("Ocurrió un error al Guardar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index e283fc11f..115d1b7b7 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -1,371 +1,371 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Imports Microsoft.Reporting.WebForms -Imports System.Data - -Partial Class PopUpAuxiliar - Inherits ClsPaginas - - Private Property Tipo As String - Get - Return ViewState("Tipo").ToString - End Get - Set(value As String) - ViewState("Tipo") = value - End Set - End Property - - Private Property CveCliente As Integer - Get - Return ViewState("CveCliente").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCliente") = value - End Set - End Property - - Private Property CveVenta As Integer - Get - Return ViewState("CveVenta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveVenta") = value - End Set - End Property - - Private Property CveProveedor As Integer - Get - Return ViewState("CveProveedor").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveProveedor") = value - End Set - End Property - - Private Property CveCompra As Integer - Get - Return ViewState("CveCompra").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCompra") = value - End Set - End Property - Private Property DTDatos As DataTable - Get - Return CType(ViewState("DTDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTDatos") = value - End Set - End Property - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - CType(Me.Master, BaseMasterPage).EsPopup = True - CType(Me.Master, BaseMasterPage).PopupWidth = 915 - RegistraScript("$get('tdContenido').style.height='1000'") - - Tipo = Request("Tipo") - CveCliente = 0 - CveProveedor = 0 - CargaDatos() - - End If - End Sub - - Private Sub CargaDatos() - GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94) +Option Explicit On +Option Strict On + +Imports Extensiones +Imports Microsoft.Reporting.WebForms +Imports System.Data + +Partial Class PopUpAuxiliar + Inherits ClsPaginas + + Private Property Tipo As String + Get + Return ViewState("Tipo").ToString + End Get + Set(value As String) + ViewState("Tipo") = value + End Set + End Property + + Private Property CveCliente As Integer + Get + Return ViewState("CveCliente").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCliente") = value + End Set + End Property + + Private Property CveVenta As Integer + Get + Return ViewState("CveVenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVenta") = value + End Set + End Property + + Private Property CveProveedor As Integer + Get + Return ViewState("CveProveedor").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveProveedor") = value + End Set + End Property + + Private Property CveCompra As Integer + Get + Return ViewState("CveCompra").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCompra") = value + End Set + End Property + Private Property DTDatos As DataTable + Get + Return CType(ViewState("DTDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTDatos") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CType(Me.Master, BaseMasterPage).EsPopup = True + CType(Me.Master, BaseMasterPage).PopupWidth = 915 + RegistraScript("$get('tdContenido').style.height='1000'") + + Tipo = Request("Tipo") + CveCliente = 0 + CveProveedor = 0 + CargaDatos() + + End If + End Sub + + Private Sub CargaDatos() + GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94) 'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94) - GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94) - - Select Case Tipo - Case "CxCClientes" - CveCliente = Request("CveCliente").ToEntero - CveVenta = Request("CveVenta").ToEntero - CargaAuxiliarClienteCxC(CveCliente, CveVenta) - LtlTipo1.Text = "Cuentas por Cobrar" - LtlTipo2.Text = "Folio de la Venta" - LtlTipo3.Text = "Fecha de la Venta" - Case "AnticiposClientes" - CveCliente = Request("CveCliente").ToEntero - CveVenta = Request("CveVenta").ToEntero - CargaAuxiliarClienteAnticipos(CveCliente, CveVenta) - LtlTipo1.Text = "Anticipo de Clientes" - LtlTipo2.Text = "Folio de la Venta" - LtlTipo3.Text = "Fecha de la Venta" - Case "CxPProveedor" - CveProveedor = Request("CveProveedor").ToEntero - CveCompra = Request("CveCompra").ToEntero - CargaAuxiliarProveedor(CveProveedor, CveCompra) - LtlTipo1.Text = "Cuentas por Pagar" - LtlTipo2.Text = "Folio de la Compra" - LtlTipo3.Text = "Fecha de la Compra" - End Select - - - UpDatos.Update() - End Sub - - Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer) - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - - Private Sub CargaAuxiliarClienteAnticipos(CveCliente As Integer, CveVenta As Integer) - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposClienteAuxiliar(CveCliente, CveVenta) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - 'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - 'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - - Private Sub CargaAuxiliarProveedor(CveProveedor As Integer, CveCompra As Integer) - Dim ObjMovtos As New ClsContabilidad() - If ObjMovtos.GetProveedorAuxiliar(CveProveedor, CveCompra) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - + GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94) + + Select Case Tipo + Case "CxCClientes" + CveCliente = Request("CveCliente").ToEntero + CveVenta = Request("CveVenta").ToEntero + CargaAuxiliarClienteCxC(CveCliente, CveVenta) + LtlTipo1.Text = "Cuentas por Cobrar" + LtlTipo2.Text = "Folio de la Venta" + LtlTipo3.Text = "Fecha de la Venta" + Case "AnticiposClientes" + CveCliente = Request("CveCliente").ToEntero + CveVenta = Request("CveVenta").ToEntero + CargaAuxiliarClienteAnticipos(CveCliente, CveVenta) + LtlTipo1.Text = "Anticipo de Clientes" + LtlTipo2.Text = "Folio de la Venta" + LtlTipo3.Text = "Fecha de la Venta" + Case "CxPProveedor" + CveProveedor = Request("CveProveedor").ToEntero + CveCompra = Request("CveCompra").ToEntero + CargaAuxiliarProveedor(CveProveedor, CveCompra) + LtlTipo1.Text = "Cuentas por Pagar" + LtlTipo2.Text = "Folio de la Compra" + LtlTipo3.Text = "Fecha de la Compra" + End Select + + + UpDatos.Update() + End Sub + + Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer) + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + + Private Sub CargaAuxiliarClienteAnticipos(CveCliente As Integer, CveVenta As Integer) + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposClienteAuxiliar(CveCliente, CveVenta) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + 'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + 'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + + Private Sub CargaAuxiliarProveedor(CveProveedor As Integer, CveCompra As Integer) + Dim ObjMovtos As New ClsContabilidad() + If ObjMovtos.GetProveedorAuxiliar(CveProveedor, CveCompra) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.BackColor = Drawing.Color.LightGray - e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: " - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(0).ColumnSpan = 2 - e.Row.Cells(1).Visible = False - e.Row.Cells(4).ColumnSpan = 3 - e.Row.Cells(5).Visible = False - e.Row.Cells(6).Visible = False - e.Row.Cells(7).Visible = False - e.Row.Cells(8).Visible = False - e.Row.Cells(12).Visible = False - ElseIf e.Row.RowIndex = 1 Then - e.Row.Cells(0).Width = Unit.Pixel(95) - e.Row.Cells(1).Width = Unit.Pixel(180) - e.Row.Cells(2).Width = Unit.Pixel(80) - e.Row.Cells(3).Width = Unit.Pixel(80) - e.Row.Cells(4).Width = Unit.Pixel(83) - e.Row.Cells(5).Width = Unit.Pixel(93) - e.Row.Cells(6).Width = Unit.Pixel(85) - e.Row.Cells(7).Width = Unit.Pixel(95) - e.Row.Cells(8).Width = Unit.Pixel(70) - End If - - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left - - If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then - Dim Liga As String = String.Format("", e.Row.DBCampo("IdPoliza")) - e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("Poliza")) - End If - - If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then - Dim Liga As String = String.Format("", e.Row.DBCampo("CvePersonal")) - e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - End If - - If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}" - 'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then - ' e.Row.Cells(10).Text = "" - 'End If - ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then - Select Case Tipo - Case "CxCClientes" - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}" - Case "CxPProveedor" - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia").ToEntero}" - End Select - End If - - 'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then - ' Dim Liga As String = String.Format("", e.Row.DBCampo("CveCompraAmortizacion")) - ' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - 'End If - - If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}" - 'Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta")) - 'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - - End If - - End If - End Sub - - Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GVAuxiliar.RowDeleting - - Dim ObjContPaq As ClsContPAQi = Nothing - Dim Conta As New ClsContabilidad() - Conta.IniciaTransacSQL() - - Dim ClavePrePoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("CvePrePolizaOriginal").ToEntero - Dim IdPoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("IdPoliza").ToEntero - - Dim TieneError = False - - If Not TieneError Then - If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then - TieneError = True - End If - End If - - If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then - TieneError = True - End If - - If Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then - If Conta.ValorPolizaDescuadre > 0 Then - TieneError = True - End If - End If - - If Not TieneError Then - If IdPoliza > 0 Then - If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then - ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) - ObjContPaq.IniciaTransacSQL() - - If Not ObjContPaq.RemovePoliza(IdPoliza) Then - TieneError = True - End If - - End If - End If - End If - - If Not TieneError Then - Alert("Movimiento Eliminado", TipoMensaje.MsgInformacion, "window.opener.location.reload(); window.close();") - If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() - Conta.Commit() - Else - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - Conta.RollBack() - End If - If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() - Conta.Dispose() - CargaDatos() - End Sub - - Private Sub GVAuxiliar_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVAuxiliar.RowUpdating - Dim CvePrePoliza As Integer - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim CvePlantillaPoliza As Integer = 0 - Dim Importe As Decimal - Dim MsgError As String = "" - - If GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal > GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal Then - Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal - Else - Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal - End If - - If CveCliente > 0 Then CvePlantillaPoliza = 11 - If CveProveedor > 0 Then CvePlantillaPoliza = 2 - - CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/PopUpAuxiliar", CvePlantillaPoliza, Importe, Importe, 1, Now, "Cancelacion de Pago", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If CvePlantillaPoliza = 2 Then - If Not ObjConta.CancelarPagoCompraConAnticipo(CvePrePoliza, CveCompra, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then - MsgError = "Ocurrió un error al cancelar el pago de la compra" - End If - End If - - If CvePlantillaPoliza = 11 Then - If Not ObjConta.CancelarPagoVentaConAnticipo(CvePrePoliza, CveVenta, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then - MsgError = "Ocurrió un error al cancelar el pago de la venta" - End If - End If - - If MsgError = "" Then - ObjConta.Commit() - Alert("El movimiento se canceló exitosamente.") - Else - ObjConta.RollBack() - Alert(MsgError, TipoMensaje.MsgError) - End If - - - ObjConta.Dispose() - End Sub - Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click - GenerarPDF("Excel") - End Sub - Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click - GenerarPDF() - End Sub - Private Sub GenerarPDF(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - If DTDatos IsNot Nothing And DTDatos.Rows.Count > 0 Then - - Dim params As New List(Of ReportParameter) - - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("Tipo", LtlTipo1.Text)) - params.Add(New ReportParameter("Folio", LtlFolio.Text)) - params.Add(New ReportParameter("Fecha", LtlFechaVenta.Text)) - params.Add(New ReportParameter("Importe", LtlImporte.Text)) - params.Add(New ReportParameter("Saldo", LtlSaldo.Text)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - ImprimirPDF("Empresas\Grales\Formatos\RepAuxiliarContable.rdlc", DTDatos, params, "RepAuxiliarContable_" & LtlFolio.Text, Formato:=Formato) - - Else - Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia) - End If - + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.BackColor = Drawing.Color.LightGray + e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: " + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(0).ColumnSpan = 2 + e.Row.Cells(1).Visible = False + e.Row.Cells(4).ColumnSpan = 3 + e.Row.Cells(5).Visible = False + e.Row.Cells(6).Visible = False + e.Row.Cells(7).Visible = False + e.Row.Cells(8).Visible = False + e.Row.Cells(12).Visible = False + ElseIf e.Row.RowIndex = 1 Then + e.Row.Cells(0).Width = Unit.Pixel(95) + e.Row.Cells(1).Width = Unit.Pixel(180) + e.Row.Cells(2).Width = Unit.Pixel(80) + e.Row.Cells(3).Width = Unit.Pixel(80) + e.Row.Cells(4).Width = Unit.Pixel(83) + e.Row.Cells(5).Width = Unit.Pixel(93) + e.Row.Cells(6).Width = Unit.Pixel(85) + e.Row.Cells(7).Width = Unit.Pixel(95) + e.Row.Cells(8).Width = Unit.Pixel(70) + End If + + e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left + + If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then + Dim Liga As String = String.Format("", e.Row.DBCampo("IdPoliza")) + e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("Poliza")) + End If + + If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then + Dim Liga As String = String.Format("", e.Row.DBCampo("CvePersonal")) + e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + End If + + If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}" + 'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then + ' e.Row.Cells(10).Text = "" + 'End If + ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then + Select Case Tipo + Case "CxCClientes" + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}" + Case "CxPProveedor" + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia").ToEntero}" + End Select + End If + + 'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then + ' Dim Liga As String = String.Format("", e.Row.DBCampo("CveCompraAmortizacion")) + ' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + 'End If + + If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}" + 'Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta")) + 'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + + End If + + End If + End Sub + + Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GVAuxiliar.RowDeleting + + Dim ObjContPaq As ClsContPAQi = Nothing + Dim Conta As New ClsContabilidad() + Conta.IniciaTransacSQL() + + Dim ClavePrePoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("CvePrePolizaOriginal").ToEntero + Dim IdPoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("IdPoliza").ToEntero + + Dim TieneError = False + + If Not TieneError Then + If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then + TieneError = True + End If + End If + + If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + If Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then + If Conta.ValorPolizaDescuadre > 0 Then + TieneError = True + End If + End If + + If Not TieneError Then + If IdPoliza > 0 Then + If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then + ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) + ObjContPaq.IniciaTransacSQL() + + If Not ObjContPaq.RemovePoliza(IdPoliza) Then + TieneError = True + End If + + End If + End If + End If + + If Not TieneError Then + Alert("Movimiento Eliminado", TipoMensaje.MsgInformacion, "window.opener.location.reload(); window.close();") + If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() + Conta.Commit() + Else + If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() + Conta.RollBack() + End If + If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() + Conta.Dispose() + CargaDatos() + End Sub + + Private Sub GVAuxiliar_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVAuxiliar.RowUpdating + Dim CvePrePoliza As Integer + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim CvePlantillaPoliza As Integer = 0 + Dim Importe As Decimal + Dim MsgError As String = "" + + If GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal > GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal Then + Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal + Else + Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal + End If + + If CveCliente > 0 Then CvePlantillaPoliza = 11 + If CveProveedor > 0 Then CvePlantillaPoliza = 2 + + CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/PopUpAuxiliar", CvePlantillaPoliza, Importe, Importe, 1, Now, "Cancelacion de Pago", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePlantillaPoliza = 2 Then + If Not ObjConta.CancelarPagoCompraConAnticipo(CvePrePoliza, CveCompra, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then + MsgError = "Ocurrió un error al cancelar el pago de la compra" + End If + End If + + If CvePlantillaPoliza = 11 Then + If Not ObjConta.CancelarPagoVentaConAnticipo(CvePrePoliza, CveVenta, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then + MsgError = "Ocurrió un error al cancelar el pago de la venta" + End If + End If + + If MsgError = "" Then + ObjConta.Commit() + Alert("El movimiento se canceló exitosamente.") + Else + ObjConta.RollBack() + Alert(MsgError, TipoMensaje.MsgError) + End If + + + ObjConta.Dispose() + End Sub + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click + GenerarPDF("Excel") + End Sub + Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click + GenerarPDF() + End Sub + Private Sub GenerarPDF(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + If DTDatos IsNot Nothing And DTDatos.Rows.Count > 0 Then + + Dim params As New List(Of ReportParameter) + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Tipo", LtlTipo1.Text)) + params.Add(New ReportParameter("Folio", LtlFolio.Text)) + params.Add(New ReportParameter("Fecha", LtlFechaVenta.Text)) + params.Add(New ReportParameter("Importe", LtlImporte.Text)) + params.Add(New ReportParameter("Saldo", LtlSaldo.Text)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + ImprimirPDF("Empresas\Grales\Formatos\RepAuxiliarContable.rdlc", DTDatos, params, "RepAuxiliarContable_" & LtlFolio.Text, Formato:=Formato) + + Else + Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia) + End If + End Sub Property CvePrePolizaNegativa As Integer @@ -390,23 +390,37 @@ Partial Class PopUpAuxiliar Dim TieneError As Boolean = False ObjContabilidad.IniciaTransacSQL() - If ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate) Then - Alert("Se agrego polzia negativa correctamente.") - Else + Dim CvePrePolizaNueva As Integer = ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate) + + If Not CvePrePolizaNueva > 0 Then + + TieneError = True End If - If TieneError Then - ObjContabilidad.RollBack() - Else + If Not TieneError Then + ObjContabilidad.Commit() + Dim Str As New StringBuilder + Str.Append("Se agrego la póliza de cancelación correctamente.
") RegistraScript(" $('#DivCancelar').modal('hide'); ") - CargaDatos() + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If ObjContabilidad.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Str.AppendFormat("Ver Poliza", ObjContabilidad.ContaIdPoliza) + + End If + End If + Alert(Str.ToString) + Else + ObjContabilidad.RollBack() + End If - ObjContabilidad.Dispose() + ObjContabilidad.Dispose() + CargaDatos() + End Sub @@ -424,4 +438,4 @@ Partial Class PopUpAuxiliar -End Class +End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 83040ea12..f4a3c6cc4 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1419,7 +1419,7 @@ T.C.: - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f4a9a4008..6566789d8 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -20758,13 +20758,19 @@ Partial Class Ventas CalculaTotalesVenta(True) + 'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00 If Not AplicaNCMasiva Then Dim TT As Decimal = TxtNCImporte.Text.ToDecimal If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal CargaNCDT(CveVenta, TT) - End If + End If + 'verifica el tipo de cambio que se actualice + If DdlMoneda.SelectedValue <> "1" Then + TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString + End If + LblTCValuacion.Visible = False UpPS.Update() LBNotaCredito.Visible = False