-- mejoras en TC

This commit is contained in:
2022-05-11 20:09:17 -07:00
parent d5d4f762f6
commit fa3955be63
2 changed files with 141 additions and 62 deletions

View File

@@ -59,15 +59,15 @@ Partial Class ContabilidadC_RegPrePolizaS
End Get
End Property
'PARA CREAR IE
Private Property CveConcepto As Integer
Public Property DrConceptoContable As DataRow
Get
Return ViewState("CveConcepto").ToString.ToEntero
Return CType(ViewState("ArregloMovs"), DataRow)
End Get
Set(value As Integer)
ViewState("CveConcepto") = value
Set(value As DataRow)
ViewState("ArregloMovs") = value
End Set
End Property
Private Property CveTipoTransaccion As Integer
Get
Return ViewState("CveTipoTransaccion").ToString.ToEntero
@@ -244,7 +244,7 @@ Partial Class ContabilidadC_RegPrePolizaS
CveMoneda = 1
ViewState("CvePrePoliza") = 0
ViewState("CvePeriodo") = "0"
CveConcepto = -1
CveTipoTransaccion = -1
CveCuenta = -1
Folio = "-1"
@@ -370,7 +370,6 @@ Partial Class ContabilidadC_RegPrePolizaS
.Add("ImporteMN", Type.GetType("System.Decimal"))
.Add("ImporteME", Type.GetType("System.Decimal"))
.Add("EsComodin", Type.GetType("System.Int32"))
.Add("CveConcepto", Type.GetType("System.Int32"))
.Add("CveSubProyecto", Type.GetType("System.Int32"))
.Add("Descripcion", Type.GetType("System.String"))
.Add("CveProveedor", Type.GetType("System.Int32"))
@@ -402,7 +401,6 @@ Partial Class ContabilidadC_RegPrePolizaS
.Add("EsComplementaria", Type.GetType("System.Boolean"))
.Add("TC", Type.GetType("System.Decimal"))
End With
@@ -901,11 +899,11 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CodigoCuenta") = drt("Codigo").ToString & "<br>" & drt("Nombre").ToString
dr("Cuenta") = Cuenta 'TxtCuentaContable.Text
dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
dr("Referencia") = If(drt("CveConceptoContable").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
dr("Concepto") = TxtConcepto.Text
dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1)
dr("EsComodin") = EsComodin
dr("CveConcepto") = drt("CveConcepto")
dr("CveConceptoContable") = drt("CveConceptoContable")
dr("CveSubProyecto") = drt("CveSubProyectoNegativo")
dr("Cargo") = TxtCargo.Text.ToDouble
dr("Abono") = TxtAbono.Text.ToDouble
@@ -978,11 +976,11 @@ Partial Class ContabilidadC_RegPrePolizaS
'Agregamos la opcion para vincular los movimientos bancarios
If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then
If e.Row.DataKey("CveConceptoContable").ToEntero.Contiene(41) Then
Dim ObjMovimientos As New ClsMovimientos
Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos")
Select Case e.Row.DataKey("CveConcepto").ToEntero
Select Case e.Row.DataKey("CveConceptoContable").ToEntero
'Acreedores
Case 41
@@ -998,7 +996,7 @@ Partial Class ContabilidadC_RegPrePolizaS
ObjMovimientos.Dispose()
End If
If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then
If e.Row.DataKey("CveConceptoContable").ToEntero.Contiene(30) Then
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
@@ -1032,8 +1030,6 @@ Partial Class ContabilidadC_RegPrePolizaS
End If
'validaciones
If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0 Or GvMov.Rows.Count > 0)) AndAlso UsuarioActual.CveRol <> 1 Then
Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -1049,9 +1045,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Exit Sub
End If
End If
Next
End If
'terminan validaciones
@@ -1073,6 +1067,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim TmpCargo As Decimal = 0D
Dim TmpAbono As Decimal = 0D
Dim DifCargoAbono As Decimal = 0D
Dim TipoGrid As Integer = 0 ' 0 - GvMov, 1 - GvPrePoliza
Try
@@ -1090,40 +1085,54 @@ Partial Class ContabilidadC_RegPrePolizaS
FolioPoliza = ObjMov.FolioPoliza
Dim Gv As GridView = GvMov
If DdlPlantilla.SelectedValue = "53" Then
Gv = GvPrePoliza
TipoGrid = 1
End If
'inserto las compras que voy a pagarDdlSaldos
For Each gvr As GridViewRow In GvMov.Rows
For Each gvr As GridViewRow In Gv.Rows
'If gvr.DataKey("IDCuenta").ToEntero > 0 Then
' IdCtaContable = gvr.DataKey("IDCuenta")
'End If
'Registra movimieno bancario
If gvr.DataKey("CveConcepto").ToEntero = 30 AndAlso gvr.DataKey("ContadoImporte").ToString.ToDecimal <> 0 Then
If gvr.DataKey("CveConceptoContable").ToEntero = 30 AndAlso gvr.DataKey("ContadoImporte").ToDecimal <> 0 Then
CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFechaDocumento.Text, gvr.DataKey("ContadoNumeroFolio").ToString,
gvr.DataKey("ContadoBeneficiario").ToString, gvr.DataKey("ContadoImporte").ToString.ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "",
CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFechaDocumento.Text, gvr.DataKey("ContadoNumeroFolio"),
gvr.DataKey("ContadoBeneficiario"), gvr.DataKey("ContadoImporte").ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones"), "",
False, False, 0, CvePrePolizaInsertada, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
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
ImporteME = 0
TipoCambio = 1
If gvr.DataKey("TipoMovto") = "True" Then
Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble
TmpAbono = TmpAbono + Importe
TipoMovto = True
If TipoGrid = "0" Then 'gvprep
Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble
TmpAbono = TmpAbono + Importe
TipoMovto = True
If gvr.DataKey("EsComplementaria") = "True" Then
ImporteME = gvr.FCTextBox("TxtAbonoME").Text.ToDecimal
TipoCambio = gvr.FCTextBox("TipoCambio").Text.ToDecimal
If gvr.DataKey("EsComplementaria") = "True" Then
ImporteME = gvr.FCTextBox("TxtAbonoME").Text.ToDecimal
TipoCambio = gvr.FCTextBox("TipoCambio").Text.ToDecimal
End If
Else
Importe = gvr.DataKey("Abono").ToDecimal
TmpAbono = TmpAbono + Importe
TipoMovto = True
If gvr.DataKey("EsComplementaria") = "True" Then
ImporteME = gvr.DataKey("MonedaExtranjera").ToDecimal
TipoCambio = gvr.DataKey("TipoCambio").ToDecimal
End If
End If
Else
Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble
@@ -1137,9 +1146,9 @@ Partial Class ContabilidadC_RegPrePolizaS
End If
If Not gvr.DataKey("CveConcepto").Contiene("30", "10") Then ' 30-bancos, 10-anticipos proveedores
If Not gvr.DataKey("CveConceptoContable").Contiene("30", "10") Then ' 30-bancos, 10-anticipos proveedores
If gvr.DataKey("CveConcepto").ToEntero = 41 Then
If gvr.DataKey("CveConceptoContable").ToEntero = 41 Then
CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero
Else
CveIE = -1
@@ -1158,7 +1167,7 @@ Partial Class ContabilidadC_RegPrePolizaS
' tCveCuenta = gvr.DataKey("CveCuenta").ToEntero
'End If
If ObjMov.AddPrePolizasDetalle(CvePrePolizaInsertada, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text,
If ObjMov.AddPrePolizasDetalle(CvePrePolizaInsertada, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConceptoContable").ToEntero, gvr.FCTextBox("TxtConcepto").Text,
TxtFechaDocumento.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,
@@ -1172,7 +1181,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Exit For
End If
End If
If CveIE > 0 AndAlso gvr.DataKey("CveConcepto").ToEntero = 30 Then
If CveIE > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero = 30 Then
MensajeAlert.AppendFormat("<br/><br/>Folio Bancario: <b><a href = ""/Bancos/IE.aspx?CveIE={0}"" class=""Texto"" target=""_blank"" >{1}</a></b>", CveIE, FolioIE)
End If
@@ -1428,8 +1437,6 @@ Partial Class ContabilidadC_RegPrePolizaS
End Sub
Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged
'Aquii hay que consultar el concepto y determinar que es lo que se vba aplicar
@@ -1440,6 +1447,7 @@ Partial Class ContabilidadC_RegPrePolizaS
If CveConceptoContableInsertar > 0 Then
DT_Concepto = GlobalDTContaConceptosContables(CveConceptoContableInsertar)
DrConceptoContable = GlobalDTContaConceptosContables(CveConceptoContableInsertar).FiltroPrimero("")
Dim AplicaActivoFijo As Boolean = False
Dim AplicaAlmacen As Boolean = False
@@ -1455,6 +1463,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim AplicaTC As Boolean = False 'ok
Dim AplicaVenta As Boolean = False
Dim AplicaComplementaria As Boolean = False 'ok
Dim AplicaME As Boolean = False 'ok
AplicaActivoFijo = Boolean.Parse(DT_Concepto.Rows(0)("AplicaActivoFijo").ToString)
AplicaAlmacen = Boolean.Parse(DT_Concepto.Rows(0)("AplicaAlmacen").ToString)
@@ -1472,6 +1481,7 @@ Partial Class ContabilidadC_RegPrePolizaS
AplicaTC = Boolean.Parse(DT_Concepto.Rows(0)("AplicaTC").ToString)
AplicaVenta = Boolean.Parse(DT_Concepto.Rows(0)("AplicaVenta").ToString)
AplicaComplementaria = Boolean.Parse(DT_Concepto.Rows(0)("EsComplementaria").ToString)
'AplicaME = Boolean.Parse(DT_Concepto.Rows(0)("EsMonedaExtranjera").ToString)
If AplicaImpuesto Then
@@ -1549,11 +1559,31 @@ Partial Class ContabilidadC_RegPrePolizaS
Else
DivMonedaExtranjera.Visible = False
End If
CargaCuentaConcepto(CveConceptoContableInsertar)
End If
UpModalConcepto.Update()
End Sub
Private Sub CargaCuentaConcepto(CveConcepto As Integer)
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, -1, 1, CveConcepto) Then
Dim dr As DataRow = ObjConta.DtResultados.FiltroPrimero("")
If dr IsNot Nothing Then
DdlCuentaContableE.SelectedValueExist(dr("CveCuenta"))
Else
If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa, CveConcepto) Then
Dim drY As DataRow = ObjConta.DtResultados.FiltroPrimero("")
If drY IsNot Nothing Then
DdlCuentaContableE.SelectedValueExist(drY("CveCuenta"))
End If
End If
End If
End If
ObjConta.Dispose()
End Sub
Private Sub CargaProveedoresE()
DdlProveedoresE.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedoresE.DataBind()
@@ -1592,7 +1622,7 @@ Partial Class ContabilidadC_RegPrePolizaS
If CveMoneda = 2 Then
DdlVentasE.DataSource = ObjVentas.DtResultados.FiltraParametros("CveMoneda = 2")
Else
DdlVentasE.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0")
DdlVentasE.DataSource = ObjVentas.DtResultados.FiltraParametros("CveMoneda = 1")
End If
DdlVentasE.DataBind()
@@ -1619,18 +1649,52 @@ Partial Class ContabilidadC_RegPrePolizaS
CargaComprasE(DdlProveedoresE.SelectedValue.ToEntero)
End Sub
Private Sub DdlClientesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientesE.selectedindexchange
Dim tCveMoneda As Integer = 1
CargaVentasE(DdlClientesE.SelectedValue.ToEntero, IIf(DdlConceptosContablesE.SelectedValue.Contiene("291", "292"), 2, -1))
If DrConceptoContable IsNot Nothing Then
Dim AplicaME = Boolean.Parse(DrConceptoContable("EsMonedaExtranjera").ToString)
If AplicaME Then
tCveMoneda = 2
End If
End If
CargaVentasE(DdlClientesE.SelectedValue.ToEntero, tCveMoneda)
End Sub
Private Function CargaValidacionesConcepto() As Boolean
Dim Retorno As Boolean = true
If DrConceptoContable IsNot Nothing Then
Dim AplicaComplementaria = Boolean.Parse(DrConceptoContable("EsComplementaria").ToString)
If AplicaComplementaria Then
Dim Importe As Decimal = IIf(TxtCargoE.Text.ToDecimal <> 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal)
'valida Mon Extranjera por el TC - Mon Extranjera
Dim dif As Decimal = ((TxtME.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal) - TxtME.Text.ToDecimal).RoundSQL - Importe
If dif <> 0 Then
Alert("El importe moneda extranjera no coinciden con el TC ")
Retorno = False
Else
Retorno = True
End If
End If
End If
Return Retorno
End Function
Protected Sub BtnAceptar_Click(sender As Object, e As EventArgs) Handles BtnAceptar.Click
'asdasdasd
If Not CargaValidacionesConcepto() Then
Exit Sub
End If
ChkSeguir.Visible = False
If IndiceGrid = -1 Then
ChkSeguir.Visible = True
If DtMovimientos Is Nothing Then CreaDT()
Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero)
@@ -1675,7 +1739,7 @@ Partial Class ContabilidadC_RegPrePolizaS
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
UpTotalCargo.Update()
UpTotalAbono.Update()
RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
If Not ChkSeguir.Checked Then RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
Else
Dim CvePrePolizaDetalle As Integer = GvPrePoliza.DataKeys(IndiceGrid).Value.ToString.ToEntero
@@ -1797,7 +1861,7 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("Concepto") = TxtConcepto.Text
dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, False, True)
dr("EsComodin") = 0
dr("CveConcepto") = DdlConceptosContables.SelectedValue
dr("CveConceptoContable") = DdlConceptosContables.SelectedValue
dr("Cargo") = TxtCargo.Text.ToDouble
dr("Abono") = TxtAbono.Text.ToDouble
dr("Descripcion") = TxtDescripcion.Text
@@ -1869,7 +1933,6 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("Concepto") = TxtConcepto.Text
dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, False, True)
dr("EsComodin") = 0
dr("CveConcepto") = DdlConceptosContables.SelectedValue
dr("CveConceptoContable") = DdlConceptosContables.SelectedValue
dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text
dr("Cargo") = TxtCargo.Text.ToDouble
@@ -2074,7 +2137,7 @@ Partial Class ContabilidadC_RegPrePolizaS
TxtConcepto.Text = DrM("Concepto")
' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto")
DrM("EsComodin") = 0
DdlConceptosContables.SelectedValueExist(DrM("CveConcepto").ToString)
DdlConceptosContables.SelectedValueExist(DrM("CveConceptoContable").ToString)
TxtCargo.Text = DrM("Cargo").ToString
TxtAbono.Text = DrM("Abono").ToString
TxtDescripcion.Text = DrM("Descripcion").ToString
@@ -2203,7 +2266,7 @@ Partial Class ContabilidadC_RegPrePolizaS
.SubProyecto = row.Item("SubProyecto"),
.Folio = "",
.TipoTransferencia = "",
.CveConceptoContable = row.Item("CveConcepto"),
.CveConceptoContable = row.Item("CveConceptoContable"),
.CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString.ToEntero > 0, row.Item("CveSubProyecto"), -1),
.IdCtaContable = IIf(row.Item("IdCtaContable").ToString.ToEntero > 0, row.Item("IdCtaContable"), -1),
.CveCuenta = row.Item("CveCuenta")
@@ -2432,7 +2495,6 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("Concepto") = Row("Concepto").ToString
dr("TipoMovto") = TipoMovto
dr("EsComodin") = 0
dr("CveConcepto") = CveConceptoContable
dr("CveConceptoContable") = CveConceptoContable
dr("ConceptoContable") = Row("ConceptoAdministrativo").ToString
dr("Cargo") = Row("Cargo").ToString.ToDecimal.RoundSQL
@@ -3060,8 +3122,6 @@ Partial Class ContabilidadC_RegPrePolizaS
UpPoliza.Update()
UpGuardar.Update()
End Sub
Private Sub LnkFolioManual_Click(sender As Object, e As EventArgs) Handles LnkFolioManual.Click
@@ -3071,5 +3131,17 @@ Partial Class ContabilidadC_RegPrePolizaS
UpPoliza.Update()
End Sub
Protected Sub DdlVentasE_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim Venta As New ClsVentas
If Venta.GetVenta(DdlVentasE.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
Dim dr As DataRow = Venta.DtResultados.FiltroPrimero("")
If dr IsNot Nothing Then
TxtTipoCambio.Text = dr("TipoCambioValuacion")
End If
End If
Venta.Dispose()
End Sub
End Class