-- mejora en póliza contable

This commit is contained in:
2023-04-20 19:05:46 -07:00
parent a05fff5204
commit 49b1c44aa2
2 changed files with 34 additions and 34 deletions

View File

@@ -108,7 +108,7 @@
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Notas de Crédito" OnRowDataBound="GvDatos_RowDataBound"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None"
DataKeyNames="CveCompra,Saldo,CveIE,CveProveedor,CvePersonal,CveMoneda,CveTipoConcepto,IdCtaContProveedores,IdCtaContExtranjera,IdCtaContComplementaria,TipoCambio,CveSubProyecto">
DataKeyNames="CveCompra,Saldo,CveIE,CveProveedor,CvePersonal,CveMoneda,CveTipoConcepto,IdCtaContProveedores,IdCtaContExtranjera,IdCtaContComplementaria,TipoCambio,CveSubProyecto,SerieFolio">
<Columns>
<asp:TemplateField ItemStyle-Width="2%">
<ItemTemplate>

View File

@@ -156,20 +156,19 @@ Partial Class Compras_RepNotasCredito
'Dim CveCon As Integer = ObtConceptoContableProvisionCompra(CveTipoConcepto, DdlTipoComprobante.SelectedValue, DdlMoneda.SelectedValue.ToEntero, False)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, gr.DataKey("SerieFolio"), 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra, CveSubProyecto:=gr.DataKey("CveSubProyecto").ToEntero) Then
MsgError = "Ocurrio un Error al saldar el movimiento"
End If
If UsaComplementaria AndAlso CveMoneda > 1 Then
ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL
IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-Importe, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveSubProyecto:=gr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-Importe, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then
MsgError = "Ocurrio un Error al saldar el movimiento"
End If
End If
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(266).ToString.ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveSubProyecto:=gr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, gr.DataKey("SerieFolio"), 211, Concepto, TxtFechaSaldar.Text.ToDate, 0, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveSubProyecto:=gr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then
MsgError = "Ocurrio un Error al saldar el movimiento"
End If
@@ -191,44 +190,45 @@ Partial Class Compras_RepNotasCredito
MsgError = "Ocurrio un Error al saldar el movimiento"
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
MsgError = ObjConta.MensajePolizaDescuadre
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If
End If
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
If MensajeAlert.ToString = "" Then
MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>")
End If
MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
End If
End If
If MsgError <> "" Then Exit For
End If
Next
If MsgError = "" Then
ObjConta.Commit()
If MensajeAlert.ToString <> "" Then
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
MsgError = ObjConta.MensajePolizaDescuadre
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If
End If
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
If MensajeAlert.ToString = "" Then
MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>")
End If
MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
End If
End If
If MsgError = "" Then
ObjConta.Commit()
If MensajeAlert.ToString <> "" Then
Alert(MensajeAlert.ToString)
Else
Alert("Los movimientos fueron saldados correctamente.")
End If
Alert(MensajeAlert.ToString)
CargaDatos()
HLSaldar.Visible = False
RegistraScript("$('#DivSaldar').modal('hide')")
LnkHabilitarSaldar.Visible = True
Else
Alert("Los movimientos fueron saldados correctamente.")
ObjConta.RollBack()
Alert(MsgError, TipoMensaje.MsgError)
End If
Alert(MensajeAlert.ToString)
CargaDatos()
HLSaldar.Visible = False
RegistraScript("$('#DivSaldar').modal('hide')")
LnkHabilitarSaldar.Visible = True
Else
ObjConta.RollBack()
Alert(MsgError, TipoMensaje.MsgError)
End If
ObjConta.Dispose()
End Sub