-- limpieza de código de mandar idcta de contpaq
This commit is contained in:
@@ -338,24 +338,12 @@ Partial Class Bancos_PolizaCheque
|
||||
DdlPersonal.Visible = False
|
||||
End If
|
||||
|
||||
Dim IdCtaFondoGarantia As Integer
|
||||
If ViewState("CveProveedor").ToString.ToEntero > 0 Then
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores()
|
||||
If ObjProv.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, ViewState("CveProveedor"), "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
|
||||
IdCtaFondoGarantia = ObjProv.DtResultados.Rows(0)("IdCtaContFondoGarantia").ToString.ToEntero
|
||||
End If
|
||||
ObjProv.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
If DdlCuenta.SelectedValue.ToEntero <= 0 Then
|
||||
If UsuarioActual.CveEmpresa <> 126 Then
|
||||
Alert("Seleccione la Cuenta Bancaria", TipoMensaje.MsgAdvertencia)
|
||||
DdlPlantilla.SelectedValue = "-1"
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If DdlPlantilla.SelectedValue.ToEntero <= 0 Then
|
||||
@@ -396,45 +384,6 @@ Partial Class Bancos_PolizaCheque
|
||||
End If
|
||||
EsComodin = 0
|
||||
End If
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
||||
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()
|
||||
|
||||
End If
|
||||
EsComodin = 0
|
||||
|
||||
|
||||
ElseIf drt("CveConcepto").ToString = "30" Then
|
||||
'saco la clave de la cuenta bancaria seleccionada
|
||||
If DdlCuenta.SelectedValue.ToEntero > 0 And drt("CveConcepto").ToString = "30" Then 'DtCuentasContables
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCuentaBancos(DdlCuenta.SelectedValue.ToEntero)))
|
||||
If drr IsNot Nothing Then
|
||||
IdCuenta = drr("Id").ToString.ToEntero
|
||||
CodigoCuenta = drr("CuentaFormato").ToString()
|
||||
NombreCuenta = drr("Nombre").ToString()
|
||||
EsComodin = 1
|
||||
End If
|
||||
End If
|
||||
ElseIf drt("CveConcepto").ToString.ToEntero = 135 And IdCtaFondoGarantia > 0 Then
|
||||
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCtaFondoGarantia))
|
||||
|
||||
IdCuenta = IdCtaFondoGarantia
|
||||
CodigoCuenta = drr("CuentaFormato").ToString()
|
||||
NombreCuenta = drr("Nombre").ToString()
|
||||
|
||||
|
||||
EsComodin = 0
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
Dim dr As DataRow = DtMovimientos.NewRow
|
||||
dr("IdCuenta") = IdCuenta
|
||||
@@ -453,12 +402,8 @@ Partial Class Bancos_PolizaCheque
|
||||
dr("Personal") = drt("Personal")
|
||||
dr("CvePersonal") = drt("CvePersonal")
|
||||
|
||||
|
||||
|
||||
DtMovimientos.Rows.Add(dr)
|
||||
Next
|
||||
|
||||
|
||||
Next
|
||||
GvMov.DataSource = DtMovimientos
|
||||
GvMov.DataBind()
|
||||
UPMovs.Update()
|
||||
@@ -469,7 +414,6 @@ Partial Class Bancos_PolizaCheque
|
||||
Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero
|
||||
Dim ObjNomina As New ClsNominas
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
|
||||
trAjuste.Visible = True
|
||||
|
||||
Dim Dt As DataTable = Nothing
|
||||
@@ -491,7 +435,7 @@ Partial Class Bancos_PolizaCheque
|
||||
Dim dr As DataRow = DtMovimientos.NewRow
|
||||
|
||||
If drt("CveNomina").ToString.ToEntero > 0 Then
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", If(ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa), ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero, -1)))
|
||||
Dim drr As DataRow = Nothing ' DtCuentasContables.FiltroPrimero(String.Format("Id={0}", If(ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa), ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero, -1)))
|
||||
TipoMovto = 0
|
||||
CveConcepto = 31
|
||||
IdCuenta = If(drr IsNot Nothing, drr("Id").ToString.ToEntero, -1)
|
||||
@@ -500,13 +444,8 @@ Partial Class Bancos_PolizaCheque
|
||||
Concepto = drt("NombreCompleto")
|
||||
dr("Cargo") = drt("Total").ToString.ToDecimal.FormatoNumero(2)
|
||||
TotalProceso += drt("Total").ToString.ToDecimal.FormatoNumero(2)
|
||||
Else
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCuentaBancos(DdlCuenta.SelectedValue.ToEntero)))
|
||||
TipoMovto = 1
|
||||
CveConcepto = 30
|
||||
IdCuenta = If(drr IsNot Nothing, drr("Id").ToString.ToEntero, -1)
|
||||
CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "")
|
||||
NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "")
|
||||
Else TipoMovto = 1
|
||||
CveConcepto = 30
|
||||
Concepto = "Pago Nómina"
|
||||
dr("Abono") = TotalProceso
|
||||
EsComodin = 1
|
||||
@@ -865,17 +804,10 @@ Partial Class Bancos_PolizaCheque
|
||||
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
|
||||
|
||||
Dim Importe As Double = 0
|
||||
Dim TipoMovto As Boolean = False
|
||||
Dim IdCtaContable As Integer = 0
|
||||
'Dim CveProveedor As Integer = -1
|
||||
|
||||
'inserto las compras que voy a pagar
|
||||
For Each gvr As GridViewRow In GvMov.Rows
|
||||
|
||||
If gvr.DataKey("IDCuenta").ToEntero > 0 Then
|
||||
IdCtaContable = gvr.DataKey("IDCuenta")
|
||||
End If
|
||||
|
||||
Dim TipoMovto As Boolean = False
|
||||
'inserto las compras que voy a pagar
|
||||
For Each gvr As GridViewRow In GvMov.Rows
|
||||
|
||||
If gvr.DataKey("TipoMovto").ToDouble > 0 Then
|
||||
Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble
|
||||
TipoMovto = True
|
||||
@@ -892,15 +824,9 @@ Partial Class Bancos_PolizaCheque
|
||||
CvePersonalSeleccionado = gvr.DataKey("CvePersonal").ToEntero
|
||||
End If
|
||||
|
||||
If Importe <> 0 Then
|
||||
|
||||
|
||||
If MsgError = "" Then
|
||||
|
||||
If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
'aplica el ajuste en el concepto 30
|
||||
If Importe <> 0 Then
|
||||
If MsgError = "" Then
|
||||
'aplica el ajuste en el concepto 30
|
||||
Dim Referencia As String = gvr.FCTextBox("TxtConcepto").Text
|
||||
If gvr.DataKey("CveConcepto").ToEntero = 30 Then
|
||||
Importe = Importe - TxtAjuste.Text.ToDecimal
|
||||
@@ -909,14 +835,14 @@ Partial Class Bancos_PolizaCheque
|
||||
Importe = Importe * TC
|
||||
End If
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Referencia, gvr.DataKey("CveConcepto").ToEntero, TxtObservaciones.Text, Now, gvr.DataKey("IDCuenta").ToEntero, -1, CveIE, CveProveedor:=CveProveedorSeleccionado, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=CvePersonalSeleccionado, ImporteMX:=Importe, TipoCambio:=TC, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Referencia, gvr.DataKey("CveConcepto").ToEntero, TxtObservaciones.Text, Now, 0, -1, CveIE, CveProveedor:=CveProveedorSeleccionado, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=CvePersonalSeleccionado, ImporteMX:=Importe, TipoCambio:=TC, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then
|
||||
MsgError = "no se pudo insertar el detalle de la póliza2"
|
||||
End If
|
||||
|
||||
If gvr.DataKey("CveConcepto").ToEntero = 30 Then
|
||||
If CveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then
|
||||
'Agregamos complementaria
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, 0, gvr.FCTextBox("TxtConcepto").Text, 204, TxtObservaciones.Text, Now, dr("IDCtaContableComplementaria").ToString.ToEntero, -1, CveIE:=CveIE, CveProveedor:=CveProveedorSeleccionado, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=CvePersonalSeleccionado, ImporteMX:=Importe * TC - Importe, ImporteME:=Importe, TipoCambio:=TC) Then
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, 0, gvr.FCTextBox("TxtConcepto").Text, 204, TxtObservaciones.Text, Now, 0, -1, CveIE:=CveIE, CveProveedor:=CveProveedorSeleccionado, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=CvePersonalSeleccionado, ImporteMX:=Importe * TC - Importe, ImporteME:=Importe, TipoCambio:=TC) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento del ingreso."
|
||||
End If
|
||||
End If
|
||||
@@ -1055,22 +981,6 @@ Partial Class Bancos_PolizaCheque
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function IdCuentaBancos(CveCuenta As Integer) As Integer
|
||||
Dim Retorno As Integer = 0
|
||||
|
||||
|
||||
'saco de la póliza el importe del cheque, que coincida la cuenta contable con la bancaria
|
||||
If CveCuenta > 0 Then
|
||||
Dim drr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta=" & CveCuenta)
|
||||
If drr IsNot Nothing Then
|
||||
Retorno = drr("IdCtaContable").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Protected Sub CargaDDLPersonal()
|
||||
DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
|
||||
|
||||
Reference in New Issue
Block a user