diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index 858da02e8..c626daa83 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -342,7 +342,7 @@
+ DataKeyNames="IdMov,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta,CveCuenta" Width="100%" CssClass=" GvMov GvSize table table-striped table-advance table-hover mysmallbtn" GridLines="None"> Cuenta diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index a12253b63..00bbf137e 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -261,23 +261,23 @@ Partial Class ContabilidadC_RegPrePolizaS CargaCuentas() - If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then - ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero - ViewState("CveProyecto") = Request("CveProyecto").ToEntero - ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero - ViewState("CveTurno") = Request("CveTurno").ToEntero + 'If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then + ' ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero + ' ViewState("CveProyecto") = Request("CveProyecto").ToEntero + ' ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero + ' ViewState("CveTurno") = Request("CveTurno").ToEntero - DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61")) - DdlPlantilla.SelectedValue = "61" - DdlPlantilla.Enabled = False - DivAgregarConceptos.Visible = False + ' DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61")) + ' DdlPlantilla.SelectedValue = "61" + ' DdlPlantilla.Enabled = False + ' DivAgregarConceptos.Visible = False - CargaNomina() + ' CargaNomina() - RegistraScript("$(document).ready(function () { calculateCargo(); Sys.Application.add_load(function (s, e) { calculateCargo(); }); } );", 1) - RegistraScript("$(document).ready(function () { calculateAbono(); Sys.Application.add_load(function (s, e) { calculateAbono(); }); } );", 2) - RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3) - End If + ' RegistraScript("$(document).ready(function () { calculateCargo(); Sys.Application.add_load(function (s, e) { calculateCargo(); }); } );", 1) + ' RegistraScript("$(document).ready(function () { calculateAbono(); Sys.Application.add_load(function (s, e) { calculateAbono(); }); } );", 2) + ' RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3) + 'End If If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then GvPrePoliza.Columns(4).Visible = False @@ -293,8 +293,7 @@ Partial Class ContabilidadC_RegPrePolizaS Private Sub CreaDT() DtMovimientos = New DataTable("Movimientos") Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True - With DtMovimientos.Columns - .Add("IdCuenta", Type.GetType("System.Int32")) + With DtMovimientos.Columns .Add("CodigoCuenta", Type.GetType("System.String")) .Add("Cuenta", Type.GetType("System.String")) .Add("Referencia", Type.GetType("System.String")) @@ -318,84 +317,85 @@ Partial Class ContabilidadC_RegPrePolizaS .Add("CveConceptoContable", Type.GetType("System.Int32")) .Add("IdCtaContable", Type.GetType("System.Int32")) .Add("ConceptoContable", Type.GetType("System.String")) + .Add("CveCuenta", Type.GetType("System.Int32")) End With End Sub - Private Sub CargaNomina() - Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero - Dim ObjNomina As New ClsNominas - Dim ObjConta As New ClsContabilidad + 'Private Sub CargaNomina() + ' Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + ' Dim ObjNomina As New ClsNominas + ' Dim ObjConta As New ClsContabilidad - Dim Dt As DataTable = Nothing - Dim Cuenta As String = "" - Dim Concepto As String = "" - Dim IdCuenta As Integer = 0 - Dim TipoMovto As Integer - Dim CveConcepto As Integer - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - Dim Referencia As String = "" - Dim EsComodin As Integer = 0 - DtMovimientos.Clear() + ' Dim Dt As DataTable = Nothing + ' Dim Cuenta As String = "" + ' Dim Concepto As String = "" + ' Dim IdCuenta As Integer = 0 + ' Dim TipoMovto As Integer + ' Dim CveConcepto As Integer + ' Dim CodigoCuenta As String = "" + ' Dim NombreCuenta As String = "" + ' Dim Referencia As String = "" + ' Dim EsComodin As Integer = 0 + ' DtMovimientos.Clear() - If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then - Dt = ObjNomina.DtResultados + ' If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then + ' Dt = ObjNomina.DtResultados - For Each drt As DataRow In Dt.Rows - Dim dr As DataRow = DtMovimientos.NewRow + ' For Each drt As DataRow In Dt.Rows + ' Dim dr As DataRow = DtMovimientos.NewRow - If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then - CveConcepto = 98 - Cuenta = "Nominas por Pagar" - IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero - Concepto = "Pago Nomina" - Referencia = "Pago Nomina" - Else - Concepto = drt("NombreCompleto") - Referencia = "" - CveConcepto = drt("CveConceptoContable").ToString.ToEntero - Cuenta = drt("ConceptoContable").ToString - IdCuenta = drt("IdCtaContable").ToString.ToEntero - End If + ' If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then + ' CveConcepto = 98 + ' Cuenta = "Nominas por Pagar" + ' IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero + ' Concepto = "Pago Nomina" + ' Referencia = "Pago Nomina" + ' Else + ' Concepto = drt("NombreCompleto") + ' Referencia = "" + ' CveConcepto = drt("CveConceptoContable").ToString.ToEntero + ' Cuenta = drt("ConceptoContable").ToString + ' IdCuenta = drt("IdCtaContable").ToString.ToEntero + ' End If - Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") - CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "") - NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "") + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") + ' CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "") + ' NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "") - TipoMovto = drt("TipoMovto") + ' TipoMovto = drt("TipoMovto") - If TipoMovto = 0 Then - dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) - dr("Abono") = 0 - Else - dr("Cargo") = 0 - dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) - End If + ' If TipoMovto = 0 Then + ' dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) + ' dr("Abono") = 0 + ' Else + ' dr("Cargo") = 0 + ' dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) + ' End If - dr("IdCuenta") = IdCuenta - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta - dr("Cuenta") = Cuenta - dr("Concepto") = Concepto - dr("Descripcion") = Concepto - dr("Referencia") = Referencia - dr("TipoMovto") = TipoMovto - dr("EsComodin") = EsComodin - dr("CveConcepto") = CveConcepto - dr("CveProveedor") = "-1" - dr("CveSubProyecto") = drt("CveSubProyecto") - dr("CvePersonal") = drt("CvePersonal") - dr("CveClasificacion") = drt("CveClasificacion") - dr("CveTipoGasto") = drt("CveTipoGasto") + ' dr("IdCuenta") = IdCuenta + ' dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + ' dr("Cuenta") = Cuenta + ' dr("Concepto") = Concepto + ' dr("Descripcion") = Concepto + ' dr("Referencia") = Referencia + ' dr("TipoMovto") = TipoMovto + ' dr("EsComodin") = EsComodin + ' dr("CveConcepto") = CveConcepto + ' dr("CveProveedor") = "-1" + ' dr("CveSubProyecto") = drt("CveSubProyecto") + ' dr("CvePersonal") = drt("CvePersonal") + ' dr("CveClasificacion") = drt("CveClasificacion") + ' dr("CveTipoGasto") = drt("CveTipoGasto") - DtMovimientos.Rows.Add(dr) - Next + ' DtMovimientos.Rows.Add(dr) + ' Next - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - UPMovs.Update() - End If + ' GvMov.DataSource = DtMovimientos + ' GvMov.DataBind() + ' UPMovs.Update() + ' End If - End Sub + 'End Sub Private Sub CargaPrePoliza() BtnEliminar.Visible = True @@ -723,8 +723,8 @@ Partial Class ContabilidadC_RegPrePolizaS EsComodin = 0 End If - Dim dr As DataRow = DtMovimientos.NewRow - dr("IdCuenta") = IdCuenta + Dim dr As DataRow = DtMovimientos.NewRow + dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta dr("Cuenta") = Cuenta 'TxtCuentaContable.Text dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) @@ -738,7 +738,8 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveProveedor") = drt("CveProveedor") dr("CvePersonal") = drt("CvePersonal") dr("CveClasificacion") = -1 - dr("MultipleSubProyecto") = drt("MultipleSubProyecto") + dr("MultipleSubProyecto") = drt("MultipleSubProyecto") + dr("CveCuenta") = drt("CveCuenta") 'dr("FolioPoliza") = 0 'drt("FolioPoliza") DtMovimientos.Rows.Add(dr) @@ -756,7 +757,7 @@ Partial Class ContabilidadC_RegPrePolizaS e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left e.Row.Height = Unit.Pixel(1) - e.Row.Cells(0).ToolTip = e.Row.DBCampo("IdCuenta") + e.Row.Cells(0).ToolTip = e.Row.DBCampo("CveCuenta") If e.Row.DBCampo("TipoMovto") = "1" Then e.Row.FCTextBox("TxtAbono").Visible = True @@ -851,8 +852,8 @@ Partial Class ContabilidadC_RegPrePolizaS Else Dim MensajeAlert = New StringBuilder Dim ObjIE As New ClsBancos() - Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL) + Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) + ' Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL) Dim Conta As ClsContPAQi = Nothing Dim IDPoliza As Integer = 0 Dim MsgError As String = "" @@ -884,9 +885,9 @@ Partial Class ContabilidadC_RegPrePolizaS 'inserto las compras que voy a pagarDdlSaldos For Each gvr As GridViewRow In GvMov.Rows - If gvr.DataKey("IDCuenta").ToEntero > 0 Then - IdCtaContable = gvr.DataKey("IDCuenta") - End If + 'If gvr.DataKey("IDCuenta").ToEntero > 0 Then + ' IdCtaContable = gvr.DataKey("IDCuenta") + 'End If If gvr.DataKey("TipoMovto").ToDouble > 0 Then Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble @@ -911,12 +912,18 @@ Partial Class ContabilidadC_RegPrePolizaS idCuentaContabilizacion = 0 End If If Importe > 0 Then + Dim tCveCuenta As Integer = -1 + + If gvr.datakey("CveConcepto") = "299" Then + tCveCuenta = gvr.datakey("CveCuenta").toentero + End If + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, - CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero) Then + CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then Else MsgError = "No se pudo insertar el detalle de la póliza2" Exit For @@ -924,11 +931,11 @@ Partial Class ContabilidadC_RegPrePolizaS End If Next - If CvePeriodo > 0 Then - If Not ObjNom.UpdateProvisionNomina(CvePeriodo, CvePrePoliza, UsuarioActual.CveEmpresa) Then - MsgError = "No se pudo actualizar el periodo de la nómina" - End If - End If + 'If CvePeriodo > 0 Then + ' If Not ObjNom.UpdateProvisionNomina(CvePeriodo, CvePrePoliza, UsuarioActual.CveEmpresa) Then + ' MsgError = "No se pudo actualizar el periodo de la nómina" + ' End If + 'End If If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then If ObjMov.ValorPolizaDescuadre > 0 Then @@ -1406,7 +1413,7 @@ Partial Class ContabilidadC_RegPrePolizaS Dim dr As DataRow = Rows(0) Dim CodigoCuenta As String = "" Dim NombreCuenta As String = "" - dr("IdCuenta") = DdlCtaContable.SelectedValue + dr("CveCuenta") = DdlCtaContable.SelectedValue If DdlCtaContable.SelectedValue.ToEntero > 0 Then Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue)) @@ -1433,6 +1440,7 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveClasificacion") = -1 dr("CveCliente") = DdlClientes.SelectedValue.ToEntero dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + dr("CveCuenta") = DdlCtaContable.SelectedValue.ToEntero End If LbCancelarEdicion.Visible = False LbAgregar.Text = "Agregar" @@ -1474,7 +1482,7 @@ Partial Class ContabilidadC_RegPrePolizaS Dim CodigoCuenta As String = "" Dim NombreCuenta As String = "" - dr("IdCuenta") = DdlCtaContable.SelectedValue + dr("CveCuenta") = DdlCtaContable.SelectedValue If DdlCtaContable.SelectedValue.ToEntero > 0 Then Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue)) @@ -1548,7 +1556,7 @@ Partial Class ContabilidadC_RegPrePolizaS End Sub Private Sub CargaTipoTransaccion(Tipo As String) DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}'") + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}' AND Estatus = 1 ") DdlTipoTransaccion.DataBind() DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) End Sub @@ -1644,7 +1652,7 @@ Partial Class ContabilidadC_RegPrePolizaS If DrM IsNot Nothing Then HdnCve.Value = idMov.ToString - DdlCtaContable.SelectedValue = DrM("IdCuenta") + DdlCtaContable.SelectedValue = DrM("CveCuenta") TxtReferencia.Text = DrM("Referencia") TxtObservaciones.Text = DrM("Concepto") ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto")