cambios en registro de nómina AC

This commit is contained in:
2021-05-03 08:51:25 -07:00
parent 50204be187
commit 9979c4613f
2 changed files with 110 additions and 85 deletions

View File

@@ -96,13 +96,15 @@
</tr><tr> <td>Crédito al Salario</td> </tr><tr> <td>Crédito al Salario</td>
<td> <td>
<asp:TextBox ID="TxtCredSalario" runat="server" Width="75px"></asp:TextBox></td></tr></table> <asp:TextBox ID="TxtCredSalario" runat="server" Width="75px"></asp:TextBox></td>
</tr></table>
</asp:Panel> </asp:Panel>
<asp:Panel ID="PnlFiniquito" runat="server" Visible="false"> <asp:Panel ID="PnlFiniquito" runat="server" Visible="true">
<table> <table border="0" id="TbIEPersonal" runat="server" Visible="false" >
<tr><td>Personal:</td><td><asp:DropDownList CssClass="select2me" ID="DdlNominaPersonal" DataTextField="Nombre" DataValueField="CvePersonal" runat="server" Width="200px"> </asp:DropDownList></td></tr> <tr><td>Personal:</td><td><asp:DropDownList CssClass="select2me" ID="DdlNominaPersonal" DataTextField="Nombre" DataValueField="CvePersonal" runat="server" Width="200px"> </asp:DropDownList></td></tr>
</table> </table>
<table border="0" id="TbIE" runat="server" visible="false"> <table border="0" id="TbIE" runat="server" visible="true">
<tr><td>Movimiento:</td><td><asp:DropDownList ID="DdlTipoTransaccion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="TipoTransaccion" DataValueField="CveTipoTransaccion" ValidationGroup="GrpGuardar" Width="250px"></asp:DropDownList></td></tr> <tr><td>Movimiento:</td><td><asp:DropDownList ID="DdlTipoTransaccion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="TipoTransaccion" DataValueField="CveTipoTransaccion" ValidationGroup="GrpGuardar" Width="250px"></asp:DropDownList></td></tr>
<tr><td>Cuenta Bancaria:</td><td><asp:DropDownList ID="DdlCuenta" CssClass="form-control input-sm select2me" Width="250px" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" ValidationGroup="GrpGuardar"></asp:DropDownList></td></tr> <tr><td>Cuenta Bancaria:</td><td><asp:DropDownList ID="DdlCuenta" CssClass="form-control input-sm select2me" Width="250px" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" ValidationGroup="GrpGuardar"></asp:DropDownList></td></tr>
<tr><td>Folio:</td><td><asp:TextBox ID="TxtFolio" runat="server" MaxLength="14" class="form-control input-sm" Width="70px"></asp:TextBox></td></tr> <tr><td>Folio:</td><td><asp:TextBox ID="TxtFolio" runat="server" MaxLength="14" class="form-control input-sm" Width="70px"></asp:TextBox></td></tr>

View File

@@ -51,6 +51,7 @@ Partial Class AC_RegNomina
CargaPresupuestos() CargaPresupuestos()
CargaMeta() CargaMeta()
CargaCombosIE()
TxtImporte.Enabled = False TxtImporte.Enabled = False
CreaDTDetalles() CreaDTDetalles()
BtnAgregar.Enabled = False BtnAgregar.Enabled = False
@@ -232,6 +233,10 @@ Partial Class AC_RegNomina
Dim total As Double = LbTotal.Text.ToDouble Dim total As Double = LbTotal.Text.ToDouble
LbTotal.Text = (total + dr("Importe").ToString.ToDouble).ToString.FormatoNumero LbTotal.Text = (total + dr("Importe").ToString.ToDouble).ToString.FormatoNumero
If RBLPago.selectedvalue = "1" Then
txttotal.text = LbTotal.Text.todecimal.FormatoNumero
End If
CboMeta.SelectedIndex = -1 CboMeta.SelectedIndex = -1
CboUnidadAdministrativa.Items.Clear() CboUnidadAdministrativa.Items.Clear()
CboFuenteFinanciamiento.Items.Clear() CboFuenteFinanciamiento.Items.Clear()
@@ -241,6 +246,8 @@ Partial Class AC_RegNomina
TxtImporte.Text = "" TxtImporte.Text = ""
TxtImporte.Enabled = False TxtImporte.Enabled = False
BtnAgregar.Enabled = False BtnAgregar.Enabled = False
Else Else
Alert("El importe supera el capital disponible. Por favor de revisar y modificar", TipoMensaje.MsgAdvertencia) Alert("El importe supera el capital disponible. Por favor de revisar y modificar", TipoMensaje.MsgAdvertencia)
End If End If
@@ -270,6 +277,9 @@ Partial Class AC_RegNomina
ChkDevengar.Checked = True : ChkEjercer.Checked = True : ChkPagar.Checked = True ChkDevengar.Checked = True : ChkEjercer.Checked = True : ChkPagar.Checked = True
ChkEjercer.Enabled = True : ChkPagar.Enabled = True ChkEjercer.Enabled = True : ChkPagar.Enabled = True
tbGeneral.Visible = True tbGeneral.Visible = True
TbIEPersonal.visible = False
PnlFiniquito.visible = True
CargaCombosIE()
Case "2" Case "2"
PnlNomina.Visible = False : PnlFiniquito.Visible = True PnlNomina.Visible = False : PnlFiniquito.Visible = True
ChkEjercer.Checked = False : ChkEjercer.Enabled = False ChkEjercer.Checked = False : ChkEjercer.Enabled = False
@@ -278,7 +288,7 @@ Partial Class AC_RegNomina
ChkDevengar.Checked = True ChkDevengar.Checked = True
trGasto.Visible = True trGasto.Visible = True
tbGeneral.Visible = True tbGeneral.Visible = True
TbIEPersonal.visible = True
DdlNominaPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("IdCtaContPersonal > 0") DdlNominaPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("IdCtaContPersonal > 0")
DdlNominaPersonal.DataBind() DdlNominaPersonal.DataBind()
TbIE.Visible = False TbIE.Visible = False
@@ -287,19 +297,7 @@ Partial Class AC_RegNomina
ChkDevengar.Checked = True : ChkEjercer.Checked = True : ChkPagar.Checked = True ChkDevengar.Checked = True : ChkEjercer.Checked = True : ChkPagar.Checked = True
trGasto.Visible = False trGasto.Visible = False
tbGeneral.Visible = False tbGeneral.Visible = False
CargaCombosIE()
DdlTipoTransaccion.Items.Clear()
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros(String.Format("Tipo = '{0}'", If(RBLPago.SelectedValue = "3", "Ing", "Egs")))
DdlTipoTransaccion.DataBind()
DdlNominaPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("IdCtaContPersonal > 0")
DdlNominaPersonal.DataBind()
DdlCuenta.Items.Clear()
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas
DdlCuenta.DataSource = dt
DdlCuenta.DataBind()
TbIE.Visible = True
If RBLPago.SelectedValue = "4" Then If RBLPago.SelectedValue = "4" Then
trGasto.Visible = True trGasto.Visible = True
@@ -311,6 +309,23 @@ Partial Class AC_RegNomina
End Sub End Sub
Public Sub CargaCombosIE()
DdlTipoTransaccion.Items.Clear()
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros(String.Format("Tipo = '{0}' and Estatus = 1", If(RBLPago.SelectedValue = "3", "Ing", "Egs")))
DdlTipoTransaccion.DataBind()
DdlNominaPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("IdCtaContPersonal > 0")
DdlNominaPersonal.DataBind()
DdlNominaPersonal.items.insert(0, New listitem("-", "-1"))
DdlCuenta.Items.Clear()
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas
DdlCuenta.DataSource = dt
DdlCuenta.DataBind()
TbIE.Visible = True
End Sub
Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged
'Dim valor As Integer = DirectCast(sender, DropDownList).SelectedValue.ToEntero 'Dim valor As Integer = DirectCast(sender, DropDownList).SelectedValue.ToEntero
'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing 'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
@@ -351,6 +366,8 @@ Partial Class AC_RegNomina
Dim Total As Decimal = DtDetalle.SUMD("Importe") Dim Total As Decimal = DtDetalle.SUMD("Importe")
Dim Fecha As Date = TxtFecha.Text.ToDate Dim Fecha As Date = TxtFecha.Text.ToDate
Dim Concepto As String = TxtConcepto.Text.Trim Dim Concepto As String = TxtConcepto.Text.Trim
Dim GeneraIE As Boolean = False
Dim IdCtaISPT As Integer = 640 Dim IdCtaISPT As Integer = 640
Dim IdCtaCreditoSalario As Integer = 635 Dim IdCtaCreditoSalario As Integer = 635
@@ -379,10 +396,15 @@ Partial Class AC_RegNomina
If dr IsNot Nothing Then If dr IsNot Nothing Then
IdCtaPersonal = dr("IdCtaContPersonal").ToString.ToEntero IdCtaPersonal = dr("IdCtaContPersonal").ToString.ToEntero
End If End If
Else
If Seleccion = "1" Then
CtaPuente = 0
GeneraIE = True
End If
End If End If
If Seleccion.Contiene("3", "4") Then If Seleccion.Contiene("1", "3", "4") Then
Dim dr As DataRow Dim dr As DataRow
dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue)) dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue))
@@ -440,57 +462,57 @@ Partial Class AC_RegNomina
If TieneError Then MensajeError = "Error Tipo 1" If TieneError Then MensajeError = "Error Tipo 1"
If Seleccion.Contiene("1", "2", "3") Then 'If Seleccion.Contiene("1", "2", "3") Then
Total = DtDetalle.SUMD("Importe") ' Total = DtDetalle.SUMD("Importe")
If Seleccion = "3" Then Total = TxtTotal.Text.ToDecimal ' If Seleccion = "3" Then Total = TxtTotal.Text.ToDecimal
Dim objACPI As New ClsAC() ' Dim objACPI As New ClsAC()
If objACPI.GetPresupuestoIngresos(CvePresupuestoIngreso, UsuarioActual.Empresa.EjercicioActual, True, UsuarioActual.CveEmpresa) Then ' If objACPI.GetPresupuestoIngresos(CvePresupuestoIngreso, UsuarioActual.Empresa.EjercicioActual, True, UsuarioActual.CveEmpresa) Then
If objACPI.DtResultados.Rows.Count > 0 Then ' If objACPI.DtResultados.Rows.Count > 0 Then
drt = objACPI.DtResultados.Rows(0) ' drt = objACPI.DtResultados.Rows(0)
If RBLPago.SelectedValue.Contiene("1", "2") Then ' If RBLPago.SelectedValue.Contiene("1", "2") Then
'se debe de registrar el ingreso ' 'se debe de registrar el ingreso
'DEVENGO EL INGRESO ' 'DEVENGO EL INGRESO
If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaPorEjecutar").ToString.ToEntero, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaPorEjecutar").ToString.ToEntero, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaDevengado").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaDevengado").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
'CARGO la deuda del cliente ' 'CARGO la deuda del cliente
'If Not objAC.AddMovimiento(IDPoliza, CtaCliente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' 'If Not objAC.AddMovimiento(IDPoliza, CtaCliente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
'abono, ' 'abono,
If Not objAC.AddMovimiento(IDPoliza, CtaCliente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, CtaCliente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaMatriz").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaMatriz").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
End If ' End If
If RBLPago.SelectedValue.Contiene("1", "3") Then ' If RBLPago.SelectedValue.Contiene("1", "3") Then
'RECAUDO EL INGRESO ' 'RECAUDO EL INGRESO
If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaDevengado").ToString.ToEntero, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaDevengado").ToString.ToEntero, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaRecaudado").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, drt("IdCuentaRecaudado").ToString.ToEntero, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
If Seleccion = "1" AndAlso Not objAC.AddMovimiento(IDPoliza, CtaPuente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Seleccion = "1" AndAlso Not objAC.AddMovimiento(IDPoliza, CtaPuente, False, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
If Not objAC.AddMovimiento(IDPoliza, CtaCliente, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True ' If Not objAC.AddMovimiento(IDPoliza, CtaCliente, True, Total, "", Concepto, 0, Fecha, "") Then TieneError = True
End If ' End If
Else ' Else
TieneError = True ' TieneError = True
End If ' End If
Else ' Else
TieneError = True ' TieneError = True
End If ' End If
objACPI.Dispose() ' objACPI.Dispose()
End If 'End If
If IdCtaPersonal > 0 Then If IdCtaPersonal > 0 Then
@@ -499,52 +521,54 @@ Partial Class AC_RegNomina
'cuando es el pago a personal, se carga, los demas casos se abona 'cuando es el pago a personal, se carga, los demas casos se abona
If Seleccion.Contiene("1", "2", "4") Then If Not objAC.AddMovimiento(IDPoliza, IdCtaPersonal, If(Seleccion = "4", False, True), Importe, "", Concepto, 0, Fecha, "") Then TieneError = True If Seleccion.Contiene("1", "2", "4") Then If Not objAC.AddMovimiento(IDPoliza, IdCtaPersonal, If(Seleccion = "4", False, True), Importe, "", Concepto, 0, Fecha, "") Then TieneError = True
CtaPuente = 0 ' para que no se inserte mas abajo CtaPuente = 0 ' para que no se inserte mas abajo
GeneraIE = True
End If
If Seleccion.Contiene("3", "4") Then If Seleccion.Contiene("1", "3", "4") AndAlso GeneraIE Then
'registro un IE 'registro un IE
ObjIE = New ClsBancos ObjIE = New ClsBancos
ObjIE.IniciaTransacSQL() ObjIE.IniciaTransacSQL()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
Dim CvePrePoliza = ObjMov.AddPrePolizas("Banc", 2, Importe, Importe, 1, Fecha, TxtConcepto.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim CvePrePoliza = ObjMov.AddPrePolizas("Banc/RegNomina", 2, Importe, Importe, 1, Fecha, TxtConcepto.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim Obs As String = TxtConcepto.Text Dim Obs As String = TxtConcepto.Text
Dim Folio As String Dim Folio As String
Folio = TxtFolio.Text.Trim Folio = TxtFolio.Text.Trim
Dim CveConceptoCargo As Integer = 30 Dim CveConceptoCargo As Integer = 30
Dim CveConceptoAbono As Integer = 28 Dim CveConceptoAbono As Integer = 28
Total = TxtTotal.Text.ToDecimal Total = TxtTotal.Text.ToDecimal
If Seleccion = "4" Then Total = DtDetalle.SUMD("Importe") If Seleccion = "4" Then Total = DtDetalle.SUMD("Importe")
'cuando saco el egreso invierto los concepto 'cuando saco el egreso invierto los concepto
If Seleccion = "3" Then If Seleccion = "3" Then
CveConceptoCargo = 29 CveConceptoCargo = 29
CveConceptoAbono = 30 CveConceptoAbono = 30
End If ElseIf Seleccion = "1" Then
CveConceptoCargo = 95
CveConceptoAbono = 30
Obs = "NOMINA PAGADA"
End If
'lo envia como transferencia recibida 'lo envia como transferencia recibida
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, Folio, Obs, Total, 1, 1.0, Obs, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, Folio, Obs, Total, 1, 1.0, Obs, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveIE > 0 Then If CveIE > 0 Then
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Total, "", CveConceptoCargo, Obs, Fecha, 0, -1, CveIE, CvePersonal:=DdlNominaPersonal.SelectedValue.ToEntero, ImporteMX:=Total) Then If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Total, "", CveConceptoCargo, Obs, Fecha, 0, -1, CveIE, CvePersonal:=DdlNominaPersonal.SelectedValue.ToEntero, ImporteMX:=Total) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Total, "", CveConceptoAbono, Obs, Fecha, 0, -1, CveIE, CvePersonal:=DdlNominaPersonal.SelectedValue.ToEntero, ImporteMX:=Total) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Total, "", CveConceptoAbono, Obs, Fecha, 0, -1, CveIE, CvePersonal:=DdlNominaPersonal.SelectedValue.ToEntero, ImporteMX:=Total) Then
MsgError = "no se pudo insertar el detalle de la póliza 2" MsgError = "no se pudo insertar el detalle de la póliza 2"
End If
Else
MsgError = "no se pudo insertar el detalle de la póliza"
End If End If
ObjIE.UpdateIEPrePoliza(Fecha, objAC.Folio.ToString, IDPoliza, CvePrePoliza, CveIE, -1)
Else Else
TieneError = True MsgError = "no se pudo insertar el detalle de la póliza"
End If End If
'Registra el movimiento total ObjIE.UpdateIEPrePoliza(Fecha, objAC.Folio.ToString, IDPoliza, CvePrePoliza, CveIE, -1)
If Not objAC.AddMovimiento(IDPoliza, IdCtaBancaria, If(Seleccion = "3", False, True), Total, "", Concepto, 0, Fecha, "") Then TieneError = True Else
TieneError = True
End If End If
'Registra el movimiento total
If Not objAC.AddMovimiento(IDPoliza, IdCtaBancaria, If(Seleccion = "3", False, True), Total, "", Concepto, 0, Fecha, "") Then TieneError = True
End If End If
@@ -566,7 +590,6 @@ Partial Class AC_RegNomina
Importe = TxtISPT.Text.ToDouble - TxtCredSalario.Text.ToDouble Importe = TxtISPT.Text.ToDouble - TxtCredSalario.Text.ToDouble
If Importe <> 0 AndAlso Not objAC.AddMovimiento(IDPoliza, IdCtaDevolucionISPT, If(Importe > 0, False, True), Math.Abs(Importe), "", Concepto, 0, Fecha, "") Then TieneError = True If Importe <> 0 AndAlso Not objAC.AddMovimiento(IDPoliza, IdCtaDevolucionISPT, If(Importe > 0, False, True), Math.Abs(Importe), "", Concepto, 0, Fecha, "") Then TieneError = True
Else Else
TieneError = True TieneError = True
End If End If