diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx
index 11d26abf9..f579a6d2d 100644
--- a/Contabilidad/RegPrePolizaS.aspx
+++ b/Contabilidad/RegPrePolizaS.aspx
@@ -206,7 +206,7 @@
-
+
|
@@ -519,8 +519,6 @@
Cuenta
- <%----%>
- <%-- --%>
@@ -740,7 +738,7 @@
Cuenta:
diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb
index e9f305103..4042bfc7b 100644
--- a/Contabilidad/RegPrePolizaS.aspx.vb
+++ b/Contabilidad/RegPrePolizaS.aspx.vb
@@ -1,5 +1,4 @@
-
-
+
Imports System.Data
Imports Extensiones
Imports System.Linq
@@ -625,12 +624,12 @@ Partial Class ContabilidadC_RegPrePolizaS
Private Sub CargaCuentasContables()
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
- DdlCtaContable.DataSource = ObjConta.DtResultados
+ DdlCuentaContableE.DataSource = ObjConta.DtResultados
DtCuentasContables = ObjConta.DtResultados
End If
ObjConta.Dispose()
- DdlCtaContable.DataBind()
- DdlCtaContable.Items.Insert(0, New ListItem("Sin Asignar", "0"))
+ DdlCuentaContableE.DataBind()
+ DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End Sub
Private Sub CargaTiposGasto()
@@ -729,20 +728,20 @@ Partial Class ContabilidadC_RegPrePolizaS
IdCuenta = 0
CodigoCuenta = ""
NombreCuenta = ""
- 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()
- 'Cuenta = drr("Nombre").ToString()
- End If
- EsComodin = 0
- End If
+ '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()
+ ' 'Cuenta = drr("Nombre").ToString()
+ ' End If
+ ' EsComodin = 0
+ 'End If
Dim dr As DataRow = DtMovimientos.NewRow
- dr("CodigoCuenta") = CodigoCuenta & " " & NombreCuenta
+ dr("CodigoCuenta") = drt("Codigo").ToString & " " & drt("Nombre").ToString
dr("Cuenta") = Cuenta 'TxtCuentaContable.Text
dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
dr("Concepto") = TxtObservaciones.Text
@@ -838,7 +837,7 @@ Partial Class ContabilidadC_RegPrePolizaS
e.Row.FCLinkButton("ImgBancos").Visible = True
If e.Row.DataKey("ContadoTipoTransaccion").ToEntero > 0 And e.Row.DataKey("ContadoCuenta").ToEntero > 0 And e.Row.DataKey("ContadoNumeroFolio").ToString.Length > 0 And
- e.Row.DataKey("ContadoImporte").ToEntero > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then
+ e.Row.DataKey("ContadoImporte").ToDecimal > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then
e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green"
End If
End If
@@ -902,10 +901,13 @@ Partial Class ContabilidadC_RegPrePolizaS
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
+ If CveIE < 0 Then
+ MsgError = "No se pudo registrar movimiento bancario"
+ Exit For
End If
+ '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
@@ -1045,7 +1047,7 @@ Partial Class ContabilidadC_RegPrePolizaS
ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero,
CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero,
- CvePersonal:=row.DataKey("CvePersonal").ToEntero) Then
+ CvePersonal:=row.DataKey("CvePersonal").ToEntero, CveCuenta:=row.DataKey("CveCuenta").ToEntero) Then
OcurrioError = True
Exit For
End If
@@ -1123,7 +1125,7 @@ Partial Class ContabilidadC_RegPrePolizaS
CargaTipoGastoE()
DdlTipoGastoE.SelectedValueExist(CveTipoGasto)
CargaCtaContableE()
- DdlCtaContableE.SelectedValueExist(CveCuenta)
+ DdlCuentaContableE.SelectedValueExist(CveCuenta)
If Cargo <> 0 Then
TxtCargoE.Text = Cargo
@@ -1160,12 +1162,12 @@ Partial Class ContabilidadC_RegPrePolizaS
Private Sub CargaCtaContableE()
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
- DdlCtaContableE.DataSource = ObjConta.DtResultados
+ DdlCuentaContableE.DataSource = ObjConta.DtResultados
End If
ObjConta.Dispose()
- DdlCtaContableE.DataBind()
- DdlCtaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
+ DdlCuentaContableE.DataBind()
+ DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End Sub
Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged
If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then
@@ -1266,7 +1268,8 @@ Partial Class ContabilidadC_RegPrePolizaS
If DtMovimientos Is Nothing Then CreaDT()
If CvePrePoliza > 0 Then
Dim dr As DataRow = DtMovimientos.NewRow
- dr("IdCtaContable") = DdlCtaContableE.SelectedValue
+ dr("IdCtaContable") = DdlCuentaContableE.SelectedValue
+ dr("CveCuenta") = DdlCuentaContableE.SelectedValue
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
dr("Concepto") = TxtConceptoE.Text
@@ -1351,7 +1354,9 @@ Partial Class ContabilidadC_RegPrePolizaS
If Rows.Count > 0 Then
Dim dr As DataRow = Rows(0)
- dr("IdCtaContable") = DdlCtaContableE.SelectedValue
+ dr("IdCtaContable") = DdlCuentaContableE.SelectedValue
+ dr("CveCuenta") = DdlCuentaContableE.SelectedValue
+ dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
dr("Concepto") = TxtConceptoE.Text
@@ -1366,8 +1371,6 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero
dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero
dr("FolioFactura") = If(DdlComprasE.Visible = True, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True, DdlVentasE.SelectedItem.ToString, ""))
- dr("CveCuenta") = DdlCtaContableE.SelectedValue.ToEntero
- dr("CodigoNombreCuenta") = DdlCtaContableE.SelectedItem.Text
dr("Modificado") = True
@@ -1445,10 +1448,10 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim dr As DataRow = Rows(0)
Dim CodigoCuenta As String = ""
Dim NombreCuenta As String = ""
- dr("CveCuenta") = DdlCtaContable.SelectedValue
+ dr("CveCuenta") = DdlCuentaContable.SelectedValue
- If DdlCtaContable.SelectedValue.ToEntero > 0 Then
- Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
+ If DdlCuentaContable.SelectedValue.ToEntero > 0 Then
+ Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue))
If drr IsNot Nothing Then
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
@@ -1472,7 +1475,6 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CveClasificacion") = -1
dr("CveCliente") = DdlClientes.SelectedValue.ToEntero
dr("CveVenta") = DdlVentas.SelectedValue.ToEntero
- dr("CveCuenta") = DdlCtaContable.SelectedValue.ToEntero
End If
GvMov.DataSource = DtMovimientos
GvMov.DataBind()
@@ -1484,7 +1486,8 @@ Partial Class ContabilidadC_RegPrePolizaS
If CvePrePoliza > 0 Then
Dim dr As DataRow = DtMovimientos.NewRow
- dr("IdCtaContable") = -1 'DdlCtaContable.SelectedValue
+ dr("IdCtaContable") = -1 'DdlCtaContable.SelectedValue
+ dr("CveCuenta") = DdlCuentaContable.SelectedValue
dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text
dr("CveConceptoContable") = DdlConceptosContables.SelectedValue
dr("Concepto") = TxtDescripcion.Text
@@ -1517,10 +1520,10 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim CodigoCuenta As String = ""
Dim NombreCuenta As String = ""
- dr("CveCuenta") = DdlCtaContable.SelectedValue
+ dr("CveCuenta") = DdlCuentaContable.SelectedValue
- If DdlCtaContable.SelectedValue.ToEntero > 0 Then
- Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
+ If DdlCuentaContable.SelectedValue.ToEntero > 0 Then
+ Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue))
If drr IsNot Nothing Then
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
@@ -1716,7 +1719,7 @@ Partial Class ContabilidadC_RegPrePolizaS
If DrM IsNot Nothing Then
HdnCve.Value = idMov.ToString
- DdlCtaContable.SelectedValue = DrM("CveCuenta")
+ DdlCuentaContable.SelectedValue = DrM("CveCuenta")
TxtReferencia.Text = DrM("Referencia")
TxtObservaciones.Text = DrM("Concepto")
' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto")
@@ -2024,7 +2027,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim CveClasificacion As Integer = -1
Dim CveCuentaExcel As Integer = -1
Dim ObjConta2 As New ClsContabilidad
- Dim FolioExcel As Integer = -1
+ Dim FolioExcel As Long = -1
Dim TipoMov As Integer = -1
Dim CveBancoCuenta As Integer = -1
If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString.Replace("-", "").Trim, 1, UsuarioActual.CveEmpresa) Then
@@ -2040,17 +2043,34 @@ Partial Class ContabilidadC_RegPrePolizaS
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
+ Else
+ CveBancoCuenta = 0
End If
+ objconta3.Dispose()
+
+ If CveBancoCuenta = 0 Then
+ Alert(String.Format("La cuenta {0} no está vinculada a una cuenta bancaria administrativa favor de verificar el archivo.", Row("Cuenta").ToString), TipoMensaje.MsgAdvertencia)
+ DtMovimientos.Clear()
+ Exit For
+ End If
+
TipoMov = GlobalDTTipoTransacciones.FiltroPrimeroValor("CveTipoTransaccion", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero
- FolioExcel = Row("Folio").ToString
+ FolioExcel = Row("Folio").ToString.ToEntero
CveTipoTransaccion = TipoMov
CveCuenta = CveBancoCuenta
+ 'carga el consecutivo
+
+ If FolioExcel = 0 Then
+ FolioExcel = SiguienteFolioBancos(CveBancoCuenta, TipoMov)
+ End If
+
Folio = FolioExcel
ImporteDocumento = IIf(Row("Abono").ToString.ToEntero > 0, Row("Abono").ToString, Row("Cargo").ToString)
Observaciones = Row("Referencia").ToString
@@ -2062,7 +2082,6 @@ Partial Class ContabilidadC_RegPrePolizaS
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")))
@@ -2110,8 +2129,8 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CveCuenta") = CveCuentaExcel
dr("ContadoTipoTransaccion") = CveTipoTransaccion
- dr("ContadoCuenta") = CveCuenta
- dr("ContadoNumeroFolio") = Folio
+ dr("ContadoCuenta") = CveBancoCuenta
+ dr("ContadoNumeroFolio") = FolioExcel
dr("ContadoImporte") = ImporteDocumento
dr("ContadoBeneficiario") = Beneficiario
dr("ContadoObservaciones") = Observaciones
@@ -2135,6 +2154,63 @@ Partial Class ContabilidadC_RegPrePolizaS
#End Region
+#Region "Siguiente Folio"
+ Public Property ArregloCuentasFolios As DataTable
+ Get
+
+ If ViewState("ArregloCuentasFolios") Is Nothing Then
+ Dim dt = New DataTable("CuentasBancos")
+ With dt.Columns
+ .Add("CveCuenta", Type.GetType("System.Int32"))
+ .Add("CveTipoTransaccion", Type.GetType("System.Int32"))
+ .Add("Folio", Type.GetType("System.Double"))
+ End With
+ ViewState("ArregloCuentasFolios") = dt
+ End If
+
+ Return CType(ViewState("ArregloCuentasFolios"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("ArregloCuentasFolios") = value
+ End Set
+ End Property
+
+
+
+ Public Function SiguienteFolioBancos(CveCuentaBancos As Integer, CveTipoTransaccionBancos As Integer) As String
+ Dim Retorno As String = "0"
+
+ Dim Folio As Long = ArregloCuentasFolios.FiltroPrimeroValor("Folio", String.Format("CveCuenta = {0} and CveTipoTransaccion = {1}", CveCuentaBancos, CveTipoTransaccionBancos)).ToLong
+
+ If Folio = 0 Then
+ Dim Banco As New ClsBancos
+ Folio = Banco.GetNextFolio(CveCuentaBancos, CveTipoTransaccionBancos)
+ Banco.Dispose()
+ End If
+
+ Folio += 1
+
+ Dim a As DataRow() = ArregloCuentasFolios.Select(String.Format("CveCuenta = {0} and CveTipoTransaccion = {1}", CveCuentaBancos, CveTipoTransaccionBancos))
+
+ If a.Count = 0 Then
+ Dim dr As DataRow = ArregloCuentasFolios.NewRow
+ dr("Folio") = Folio
+ dr("CveCuenta") = CveCuentaBancos
+ dr("CveTipoTransaccion") = CveTipoTransaccionBancos
+ ArregloCuentasFolios.Rows.Add(dr)
+ Else
+ a(0)("Folio") = Folio 'actualizo el folio
+ End If
+
+ ArregloCuentasFolios.AcceptChanges()
+
+ Return Folio
+ End Function
+#End Region
+
+
+
+
#Region "Paquete Egresos"
Protected Sub LnkImprimirPDF_Click(sender As Object, e As EventArgs)
ImprimirPolizaPDF(IdPoliza)
|