From d28fdc06d1cad2b134de1ed34889220dddc8673c Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Thu, 22 Aug 2019 19:35:38 -0700 Subject: [PATCH] Generar prepolzias en negativo Ventas --- App_Code/ClsContabilidad.vb | 28 +++++++++++ Bancos/IE.aspx.vb | 4 +- Contabilidad/PopUpAuxiliar.aspx | 80 +++++++++++++++++++++++++++++- Contabilidad/PopUpAuxiliar.aspx.vb | 72 +++++++++++++++++++++++++-- 4 files changed, 178 insertions(+), 6 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index df4235f7b..4ab57dfa8 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -127,6 +127,7 @@ Public Class ClsContabilidad Return Retorno End Function + Public Function AddPrePolizas(Modulo As String, CvePlantillaPoliza As Integer, Cargos As Double, Abonos As Double, CveMoneda As Integer, Fecha As Date, Concepto As String, CveUsuario As Integer, CveEmpresa As Integer, Optional FolioFijo As Integer = 0, Optional ReglaFolioPoliza As String = "", Optional CveTipoPoliza As Integer = -1) As Integer Dim Retorno As Integer = -1 @@ -225,6 +226,33 @@ Public Class ClsContabilidad Return Retorno End Function + + + Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_PrePolizasNegativaAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Concepto", SqlDbType.VarChar).Value = Concepto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Fecha", SqlDbType.Date).Value = Fecha + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Guardar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + Public Function GetProveedorAuxiliar(CveProveedor As Integer, CveCompra As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 82bb5f3a3..992eadfb5 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4887,7 +4887,9 @@ Partial Class Bancos_IE e.Row.Cells(4).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) If e.Row.DataKey("Estatus").Contiene("1", "3") Then - e.Row.FCLinkButton("LnkCancelarComplemetno").Visible = True + e.Row.FCLinkButton("LnkCancelarComplemetno").Visible = True + Else + e.Row.FCLinkButton("LnkCancelarComplemetno").Visible = False End If End If diff --git a/Contabilidad/PopUpAuxiliar.aspx b/Contabilidad/PopUpAuxiliar.aspx index 047e0473a..fd8deccef 100644 --- a/Contabilidad/PopUpAuxiliar.aspx +++ b/Contabilidad/PopUpAuxiliar.aspx @@ -78,7 +78,10 @@
- + + + + Fecha @@ -142,21 +145,34 @@ + + + + + + + + + - + + + + +
@@ -168,6 +184,66 @@ + + + + + + + + + + + + + + + diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index 1c0755987..1eaef6527 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -77,7 +77,8 @@ Partial Class PopUpAuxiliar Private Sub CargaDatos() GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94) - 'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94) + 'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94) + GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94) Select Case Tipo Case "CxCClientes" @@ -102,6 +103,9 @@ Partial Class PopUpAuxiliar 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) @@ -158,7 +162,11 @@ Partial Class PopUpAuxiliar GVAuxiliar.DataBind() End Sub - Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound + 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 @@ -171,6 +179,7 @@ Partial Class PopUpAuxiliar 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) @@ -350,5 +359,62 @@ Partial Class PopUpAuxiliar Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia) End If - End Sub + End Sub + + Property CvePrePolizaNegativa As Integer + Get + If ViewState("CvePrePolizaNegativa") Is Nothing Then + Return -1 + Else + Return ViewState("CvePrePolizaNegativa").ToString.ToEntero + End If + + End Get + Set(value As Integer) + ViewState("CvePrePolizaNegativa") = value + End Set + End Property + + + + Private Sub AgregaPolizaNegativo(CvePrePoliza As Integer) + + Dim ObjContabilidad As New ClsContabilidad + 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 + TieneError = True + End If + + If TieneError Then + ObjContabilidad.RollBack() + Else + ObjContabilidad.Commit() + RegistraScript(" $('#DivCancelar').modal('hide'); ") + CargaDatos() + End If + + ObjContabilidad.Dispose() + + + End Sub + + + Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs) + AgregaPolizaNegativo(CvePrePolizaNegativa) + End Sub + + + Protected Sub imgCancelar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + CvePrePolizaNegativa = GvRow.DataKey("CvePrePoliza").ToString.ToEntero + + RegistraScript(" $('#DivCancelar').modal('show'); ") + End Sub + + + End Class