From ca84fd9749a48b675ee98827416027a932220ead Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Tue, 15 Jun 2021 15:29:26 -0700 Subject: [PATCH] Llenar desde plantilla los conceptos de banco --- Contabilidad/RegPrePolizaS.aspx | 3 +- Contabilidad/RegPrePolizaS.aspx.vb | 126 ++++++++++++++++++++++------- 2 files changed, 99 insertions(+), 30 deletions(-) diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index fa0bebecb..7b4aa0184 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -343,7 +343,8 @@
+ DataKeyNames="IdMov,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta,CveCuenta, ContadoTipoTransaccion, ContadoCuenta, ContadoNumeroFolio, ContadoImporte, ContadoBeneficiario, ContadoObservaciones" + 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 136e3c504..8f2befccb 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -318,6 +318,14 @@ Partial Class ContabilidadC_RegPrePolizaS .Add("IdCtaContable", Type.GetType("System.Int32")) .Add("ConceptoContable", Type.GetType("System.String")) .Add("CveCuenta", Type.GetType("System.Int32")) + + .Add("ContadoTipoTransaccion", Type.GetType("System.Int32")) + .Add("ContadoCuenta", Type.GetType("System.Int32")) + .Add("ContadoNumeroFolio", Type.GetType("System.Int32")) + .Add("ContadoImporte", Type.GetType("System.Int32")) + .Add("ContadoBeneficiario", Type.GetType("System.String")) + .Add("ContadoObservaciones", Type.GetType("System.String")) + End With End Sub @@ -870,22 +878,24 @@ Partial Class ContabilidadC_RegPrePolizaS Dim TipoMovto As Boolean = False Dim IdCtaContable As Integer = 0 - 'Registra movimieno bancario - If CveConcepto = 30 Then - CveIE = ObjIE.AddBancos_IE(CveCuenta, CveTipoTransaccion, TxtFecha.Text, Folio, Beneficiario, ImporteDocumento, CveMoneda, 0, Observaciones, "", False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" - If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then - FolioIE = ObjIE.Folio - End If - End If - - '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 + For Each gvr As GridViewRow In GvMov.Rows + 'If gvr.DataKey("IDCuenta").ToEntero > 0 Then + ' IdCtaContable = gvr.DataKey("IDCuenta") + 'End If + + 'Registra movimieno bancario + If gvr.DataKey("CveConcepto").ToEntero = 30 Then + CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFecha.Text, gvr.DataKey("ContadoNumeroFolio").ToString, + gvr.DataKey("ContadoBeneficiario").ToString, gvr.DataKey("ContadoImporte").ToString.ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "", + False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" + If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + FolioIE = ObjIE.Folio + End If + End If + If gvr.DataKey("TipoMovto").ToDouble > 0 Then Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble @@ -895,9 +905,9 @@ Partial Class ContabilidadC_RegPrePolizaS TipoMovto = False End If - If CveConcepto <> 30 Then + If gvr.DataKey("CveConcepto").ToEntero <> 30 Then - If CveConcepto = 41 Then + If gvr.DataKey("CveConcepto").ToEntero = 41 Then CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero Else CveIE = -1 @@ -927,6 +937,9 @@ Partial Class ContabilidadC_RegPrePolizaS Exit For End If End If + If CveIE > 0 AndAlso gvr.DataKey("CveConcepto").ToEntero = 30 Then + MensajeAlert.AppendFormat("

Folio Bancario: {1}", CveIE, FolioIE) + End If Next If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then @@ -965,7 +978,6 @@ Partial Class ContabilidadC_RegPrePolizaS If MsgError = "" Then 'MENSAJE IE If CveIE Then - MensajeAlert.AppendFormat("

Folio Bancario: {1}", CveIE, FolioIE) Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") Else Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()") @@ -1242,7 +1254,7 @@ Partial Class ContabilidadC_RegPrePolizaS If DtMovimientos Is Nothing Then CreaDT() If CvePrePoliza > 0 Then Dim dr As DataRow = DtMovimientos.NewRow - dr("IdCtaContable") = -1 'DdlCtaContableE.SelectedValue + dr("IdCtaContable") = DdlCtaContableE.SelectedValue dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue dr("Concepto") = TxtConceptoE.Text @@ -1323,7 +1335,7 @@ Partial Class ContabilidadC_RegPrePolizaS If Rows.Count > 0 Then Dim dr As DataRow = Rows(0) - dr("IdCtaContable") = -1 'DdlCtaContableE.SelectedValue + dr("IdCtaContable") = DdlCtaContableE.SelectedValue dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue dr("Concepto") = TxtConceptoE.Text @@ -1547,9 +1559,21 @@ Partial Class ContabilidadC_RegPrePolizaS CargaTipoTransaccion("Ing") Else CargaTipoTransaccion("Egs") - End If - - + End If + + Dim IdMov As Integer = GvRow.DataKey("IdMov").ToString.ToEntero + Dim Rows As DataRow() = DtMovimientos.Select("IdMov = " & IdMov) + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + Dim folio As Integer = dr("ContadoTipoTransaccion").ToString.ToEntero + DdlTipoTransaccion.SelectedValueExist(dr("ContadoTipoTransaccion").ToString.ToEntero) + DdlCuenta.SelectedValueExist(dr("ContadoCuenta").ToString.ToEntero) + TxtDocumentoFolio.Text = dr("ContadoNumeroFolio").ToString.ToEntero + TxtDocumentoObservaciones.Text = dr("ContadoObservaciones").ToString + TxtDocumentoBeneficiario.Text = dr("ContadoBeneficiario").ToString + End If + TxtDocumentoImporte.Text = If(GvRow.FCTextBox("TxtAbono").Text = "", GvRow.FCTextBox("TxtCargo").Text.FormatoNumero, GvRow.FCTextBox("TxtAbono").Text.FormatoNumero) UpBancos.Update() RegistraScript(String.Format("$('#{0}').modal();", "DivContadoModal")) @@ -1842,6 +1866,8 @@ Partial Class ContabilidadC_RegPrePolizaS .Referencia = "", .Concepto = "", .SubProyecto = row.Item("SubProyecto"), + .Folio = "", + .TipoTransferencia = "", .CveConceptoContable = row.Item("CveConcepto"), .CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString.ToEntero > 0, row.Item("CveSubProyecto"), -1), .IdCtaContable = IIf(row.Item("IdCtaContable").ToString.ToEntero > 0, row.Item("IdCtaContable"), -1), @@ -1859,10 +1885,10 @@ Partial Class ContabilidadC_RegPrePolizaS For i = 0 To columnCount worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) Next - worksheet.Columns("I").Hidden = True - worksheet.Columns("J").Hidden = True worksheet.Columns("K").Hidden = True worksheet.Columns("L").Hidden = True + worksheet.Columns("M").Hidden = True + worksheet.Columns("N").Hidden = True NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString @@ -1926,6 +1952,14 @@ Partial Class ContabilidadC_RegPrePolizaS Alert("El nombre de la octava columna debe ser 'SubProyecto'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If + If Not dt.Columns(8).ColumnName = "Folio" Then + Alert("El nombre de la novena columna debe ser 'Folio'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(9).ColumnName = "TipoTransferencia" Then + Alert("El nombre de la decima columna debe ser 'TipoTransferencia'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If End If If Not ErrorArchivo Then @@ -1948,20 +1982,47 @@ Partial Class ContabilidadC_RegPrePolizaS Dim CveConceptoContable As Integer = GlobalDTContaConceptosContables(-1).FiltroPrimeroValor("CveConceptoContable", String.Format("ConceptoContable ='{0}'", Row("ConceptoAdministrativo"))).ToEntero ' Row("CveConceptoContable").ToString.ToEntero 'Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero Dim CveClasificacion As Integer = -1 - Dim CveCuenta As Integer = -1 + Dim CveCuentaExcel As Integer = -1 Dim ObjConta2 As New ClsContabilidad - If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString.Replace("-", ""), 1, UsuarioActual.CveEmpresa) Then - CveCuenta = ObjConta2.DtResultados.FiltroPrimeroValor("CveCuenta", "").ToEntero + Dim FolioExcel As Integer = -1 + Dim TipoMov As Integer = -1 + Dim CveBancoCuenta As Integer = -1 + If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString.Replace("-", "").Trim, 1, UsuarioActual.CveEmpresa) Then + CveCuentaExcel = ObjConta2.DtResultados.FiltroPrimeroValor("CveCuenta", "").ToEntero NombreCuenta = ObjConta2.DtResultados.FiltroPrimeroValor("CtaCodigo", "") End If ObjConta2.Dispose() - If CveCuenta <= 0 AndAlso CveConceptoContable <> 30 Then ' concepto 30-Bancos, tomará la cuetna de las especificaciones que se hagan enel modal + If CveCuentaExcel <= 0 AndAlso CveConceptoContable <> 30 Then ' concepto 30-Bancos, tomará la cuetna de las especificaciones que se hagan enel modal Alert(String.Format("La cuenta {0} no se reconoció, favor de verificar el archivo.", Row("Cuenta").ToString)) DtMovimientos.Clear() Exit For End If + If CveConceptoContable = 30 Then + Dim objconta3 As New ClsContabilidad + objconta3.GetConta_CuentasDataContabilidad(CveCuentaExcel, UsuarioActual.CveEmpresa) + If objconta3.DtResultados.Rows.Count > 0 Then + Dim rowcc As DataRow = objconta3.DtResultados.Rows(0) + CveBancoCuenta = rowcc("CveBancoCuenta").ToString().ToEntero() + DdlCuenta.SelectedValue = CveBancoCuenta + End If + TipoMov = GlobalDTTipoTransacciones.FiltroPrimeroValor("CveTipoTransaccion", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero + FolioExcel = Row("Folio").ToString.ToEntero + CveTipoTransaccion = TipoMov + CveCuenta = CveBancoCuenta + Folio = Row("Folio").ToString.ToEntero + ImporteDocumento = IIf(Row("Abono").ToString.ToEntero > 0, Row("Abono").ToString, Row("Cargo").ToString) + Observaciones = Row("Referencia").ToString + Beneficiario = Row("Concepto").ToString + If Not TipoMov > 0 Then + Alert(String.Format("El Tipo de Transferencia no fue encontrado:
Tipo Transferencia: {0}
Folio: {1}
Importe: {2} ", Row("TipoTransferencia").ToString(), FolioExcel, ImporteDocumento), TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If + + 'sino viene el cveconcepto, busca por le nombre del concepto If CveConceptoContable = 0 Then Alert(String.Format("El concepto {0} no se reconoció, favor de verificar el archivo.", Row("ConceptoAdministrativo"))) @@ -2006,8 +2067,14 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveClasificacion") = CveClasificacion dr("CveCliente") = -1 dr("CveVenta") = -1 - dr("CveCuenta") = CveCuenta + dr("CveCuenta") = CveCuentaExcel + dr("ContadoTipoTransaccion") = CveTipoTransaccion + dr("ContadoCuenta") = CveCuenta + dr("ContadoNumeroFolio") = Folio + dr("ContadoImporte") = ImporteDocumento + dr("ContadoBeneficiario") = Beneficiario + dr("ContadoObservaciones") = Observaciones DtMovimientos.Rows.Add(dr) DtMovimientos.AcceptChanges() @@ -2025,6 +2092,7 @@ Partial Class ContabilidadC_RegPrePolizaS End Try End If End Sub + #End Region #Region "Paquete Egresos"