This commit is contained in:
2024-06-17 08:33:49 -07:00
31 changed files with 11483 additions and 4153 deletions

View File

@@ -157,48 +157,42 @@
<asp:UpdatePanel runat="server" ID="Upsaldar" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" runat="server" id="DvSaldar">
<div class="col-md-1" style="text-align: left">Fecha:</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFecha" CssClass="form-control input-sm ADSMaskDate" Style="width: 118px" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkCortfecha" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEECortfecha" runat="server" TargetControlID="TxtFecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEECortfecha" TargetControlID="TxtFecha" PopupButtonID="LnkCortfecha" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvCortfecha" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoCortfecha" runat="server" HighlightCssClass="vco" TargetControlID="RfvCortfecha"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="text-align: left">Centro Costo:</div>
<div class="col-md-1" style="text-align: left">
<asp:DropDownList ID="DdlSubProyectoSaldar" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
</asp:DropDownList>
</div>
<div class="col-md-1" style="text-align: left">Concepto:</div>
<div class="col-md-1" style="text-align: left">
<asp:TextBox ID="TxtConcepto" CssClass="form-control" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvConcepto" runat="server" ControlToValidate="TxtConcepto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoConcepto" runat="server" HighlightCssClass="vco" TargetControlID="RfvConcepto"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1" >
<asp:Button ID="BtnSaldar" OnClick="BtnSaldar_Click" runat="server" Text="Saldar" CssClass="btn btn-primary" ValidationGroup="VgGuardar" />
</div>
<div class="row" runat="server" id="DvSaldar" visible="false">
<div class="col-md-1" style="text-align: left">Fecha:</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFecha" CssClass="form-control input-sm ADSMaskDate" Style="width: 118px" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkCortfecha" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEECortfecha" runat="server" TargetControlID="TxtFecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEECortfecha" TargetControlID="TxtFecha" PopupButtonID="LnkCortfecha" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvCortfecha" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoCortfecha" runat="server" HighlightCssClass="vco" TargetControlID="RfvCortfecha"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="text-align: left">Centro Costo:</div>
<div class="col-md-1" style="text-align: left">
<asp:DropDownList ID="DdlSubProyectoSaldar" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
</asp:DropDownList>
</div>
<div class="col-md-1" style="text-align: left">Concepto:</div>
<div class="col-md-1" style="text-align: left">
<asp:TextBox ID="TxtConcepto" CssClass="form-control" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvConcepto" runat="server" ControlToValidate="TxtConcepto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoConcepto" runat="server" HighlightCssClass="vco" TargetControlID="RfvConcepto"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1">
<asp:Button ID="BtnSaldar" OnClick="BtnSaldar_Click" runat="server" Text="Saldar" CssClass="btn btn-primary" ValidationGroup="VgGuardar" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
@@ -206,7 +200,7 @@
<ajax:TabContainer runat="server" ID="Tabs">
<ajax:TabPanel ID="TabIndicadores" runat="server" HeaderText="Indicadores" ClientIDMode="Static">
<ajax:TabPanel ID="TabIXC" runat="server" HeaderText="IXC" ClientIDMode="Static">
<ContentTemplate>
<div class="row">
@@ -271,7 +265,8 @@
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
<ContentTemplate>
<asp:RadioButtonList runat="server" ID="RblTipoCambio" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
<%-- <asp:RadioButtonList runat="server" ID="RblTipoCambio" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" Value="2"></asp:ListItem>
<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>
@@ -279,13 +274,14 @@
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">
Especifico:
<asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" />
</div>
</div>--%>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:Button ID="BtnTipoCambio" runat="server" OnClick="BtnTipoCambio_Click" Text="Aceptar" class="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<%-- <asp:Button ID="BtnTipoCambio" runat="server" OnClick="BtnTipoCambio_Click" Text="Aceptar" class="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>--%>
</div>
</div>
</div>

View File

@@ -9,7 +9,7 @@ Partial Public Class General_SaldosMenores
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Private Property DtDatosIXC As DataTable
Get
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get
@@ -61,6 +61,114 @@ Partial Public Class General_SaldosMenores
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
DvSaldar.Visible = False
If Tabs.ActiveTab Is TabIXC Then
CargaDatosIXC()
If DtDatosIXC.Rows.Count > 0 Then
DvSaldar.Visible = True
End If
End If
Upsaldar.Update()
End Sub
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs)
If Tabs.ActiveTab Is TabIXC Then
Dim ObjConta As New ClsContabilidad()
ObjConta.IniciaTransacSQL()
Dim CvePrePoliza As Integer = 0, CveVenta As Integer = -1, CveIE As Integer = -1
Dim Saldo As Decimal = 0
Dim SaldoAdmin As Decimal = 0
Dim ImporteTotalGasto As Decimal = 0
Dim MsgError As String = ""
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, 0, 0, 1, TxtFecha.Text.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 3)
Dim tMovto As Boolean = True
Dim tConceptoSaldar As Integer = 78
If CvePrePoliza > 0 Then
For Each Gv As GridViewRow In GvDatosIXC.Rows
Dim ConPreP As New ConceptosTipoSaldo()
If Gv.FCCheckBox("Chk").Checked Then
If Gv.DataKey("CveVenta").ToEntero > 0 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(6, Gv.DataKey("CveMoneda").ToEntero(), False, 2)
ElseIf Gv.DataKey("CveIE").ToEntero > 0 Then
ConPreP.CveConcepto = 3
End If
'If Tipo = 1 OrElse Tipo = 2 Then
If Gv.DataKey("CveVenta").ToEntero() > 0 Then
CveVenta = Gv.DataKey("CveVenta").ToEntero()
Saldo = -Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
ElseIf Gv.DataKey("CveIE").ToEntero() > 0 Then
'ElseIf Tipo = 3 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(18, Gv.DataKey("CveMoneda").ToEntero(), True, 2)
CveIE = Gv.DataKey("CveIE").ToEntero()
Saldo = Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
End If
Saldo = -Saldo ' invertimos el saldo para que se haga negativo para que sea Abono
ImporteTotalGasto += Saldo
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, SaldoAdmin, Saldo, ConPreP.CveConcepto, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
If Gv.DataKey("CveMoneda").ToEntero() > 1 Then
Dim ImporteMN As Decimal = (Saldo * Gv.DataKey("TipoCambio").ToDecimal() - Saldo).RoundSQL()
ImporteTotalGasto += ImporteMN
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, Saldo, ImporteMN, ConPreP.CveConceptoComplementario, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero(), ImporteME:=Saldo, TipoCambio:=Gv.DataKey("TipoCambio").ToDecimal()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
End If
End If
Next
If ImporteTotalGasto <> 0 Then
ImporteTotalGasto *= -1 ' se invierte el valor, para cuadre de prepoliza
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, ImporteTotalGasto, ImporteTotalGasto, tConceptoSaldar, "", TxtConcepto.Text, CveIE, CveVenta, CveSubProyecto:=DdlSubProyectoSaldar.SelectedValue.ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
MsgError = "Poliza no insertada"
End If
End If
If MsgError = "" Then
ObjConta.Commit()
Dim Msg As String = "Los movimientos se saldaron correctamente."
Msg &= $"<br/><br/><a Class='Texto' target='_blank' href='/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={CvePrePoliza}'>Ver Póliza</a>&nbsp;&nbsp; "
Alert(Msg)
Else
ObjConta.RollBack()
Alert(MsgError, ModExtensiones.TipoMensaje.MsgError)
End If
CargaDatosIXC()
ObjConta.Dispose()
End If
TxtFecha.Text = DateTime.Today.ToString()
Upsaldar.Update()
End Sub
#Region "I X C"
@@ -82,55 +190,45 @@ Partial Public Class General_SaldosMenores
txtFechaF.Text = If(Request("FechaF") Is Nothing, NowADS().ToString(), Request("FechaF").ToString())
TipoCambio = If(Request("TipoCambio") Is Nothing, 1, Request("TipoCambio").ToString().ToEntero())
TCEspecifico = If(Request("TCEspecifico") Is Nothing, -1, Request("TCEspecifico").ToString().ToDouble())
RblTipoCambio.SelectedValue = TipoCambio.ToString()
LiEspecifico.InnerText = TCEspecifico.FormatoNumero()
'RblTipoCambio.SelectedValue = TipoCambio.ToString()
'LiEspecifico.InnerText = TCEspecifico.FormatoNumero()
Dim FechaICorte As DateTime
FechaICorte = If(Request("FechaICorte") Is Nothing, DateTime.MinValue, Request("FechaICorte").ToString().ToDate())
CargaDatos()
Tipo = -1
End Sub
Protected Sub CargaSucursales()
'DdlSucursal.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
'DdlSucursal.DataBind()
'DdlSucursal.Items.Insert(0, New ListItem("Todos", "-1"))
'DdlSucursal.SelectedValue = "-1"
DdlSubProyectoSaldar.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
DdlSubProyectoSaldar.DataBind()
End Sub
'Protected Sub CargaVendedores()
' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
' DdlVendedor.DataBind()
' DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
'End Sub
Protected Sub CargaDatos()
If TipoCambio = 3 AndAlso TxtEspecifico.Text <> "" Then
TCEspecifico = TxtEspecifico.Text.ToDouble()
Else
TCEspecifico = -1
End If
If TipoCambio <> 1 Then
CveMoneda = -1
End If
Protected Sub CargaDatosIXC()
'If TipoCambio = 3 AndAlso TxtEspecifico.Text <> "" Then
' TCEspecifico = TxtEspecifico.Text.ToDouble()
'Else
' TCEspecifico = -1
'End If
'If TipoCambio <> 1 Then
' CveMoneda = -1
'End If
Dim FechaICorte As DateTime = MinFecha
'If TxtFechaICorte.Text <> "" Then
' FechaICorte = TxtFechaICorte.Text.ToDate()
'Else
' FechaICorte = DateTime.MinValue
'End If
Dim FechaFCorte As DateTime = MaxFecha
'If TxtFechaFCorte.Text <> "" Then
' FechaFCorte = TxtFechaFCorte.Text.ToDate()
'Else
' FechaFCorte = DateTime.MaxValue
'End If
Dim ObjVenta As New ClsVentas()
Dim CveCliente As Integer = -1
@@ -140,30 +238,18 @@ Partial Public Class General_SaldosMenores
If ObjVenta.GetRepAnticiposNCIXCDetalle(CveCliente, -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, 1, -1, CveMoneda, FechaICorte, FechaFCorte, TipoCambio, TCEspecifico,
SaldoMayorA:=TxtSaldoMayorA.Text.ToDecimal, SaldoMenorA:=TxtSaldoMenorA.Text.ToDecimal) Then
GvDatosIXC.DataSource = ObjVenta.DtResultados
DtDatos = ObjVenta.DtResultados
DtDatosIXC = ObjVenta.DtResultados
End If
ObjVenta.Dispose()
GvDatosIXC.DataBind()
UpDatos.Update()
'If TxtFechaFCorte.Text <> NowADS().ToShortDateString() AndAlso txtFechaI.Text <> "" Then
' LnkHabilitarSaldar.Visible = False
' LnkSaldar.Visible = False
'Else
'LnkHabilitarSaldar.Visible = True
''End If
'If LnkSaldar.Visible Then
' HabilitarCheckbox()
'End If
Tipo = -1
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
'GenerarPDF("EXCEL")
@@ -173,80 +259,7 @@ Partial Public Class General_SaldosMenores
'GenerarPDF("PDF")
End Sub
'Protected Sub GenerarPDF(Opcion As String)
' Dim FechaI As String
' If txtFechaI.Text = "" OrElse txtFechaI.Text = "__/__/____" Then
' FechaI = "-1"
' Else
' FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"
' End If
' Dim FechaF As String
' If txtFechaF.Text = "" OrElse txtFechaF.Text = "__/__/____" Then
' FechaF = "-1"
' Else
' FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"
' End If
' Dim FechaICorte As String
' If TxtFechaICorte.Text = "" OrElse TxtFechaICorte.Text = "__/__/____" Then
' FechaICorte = ""
' Else
' FechaICorte = $"&emsp;<b>Fecha Inicial Corte:</b> {TxtFechaICorte.Text}"
' End If
' Dim FechaFCorte As String
' If TxtFechaFCorte.Text = "" OrElse TxtFechaFCorte.Text = "__/__/____" Then
' FechaFCorte = ""
' Else
' FechaFCorte = $"&emsp;<b>Fecha Final Corte:</b> {TxtFechaFCorte.Text}"
' End If
' Dim Sucursal As String
' If DdlSucursal.SelectedValue <> "-1" Then
' Sucursal = $"&emsp;<b>Sucursal:</b> {DdlSucursal.SelectedItem.Text}"
' Else
' Sucursal = ""
' End If
' Dim Cliente As String = ""
' Dim ConSaldo As String
' If DdlConSaldo.SelectedValue <> "-1" Then
' ConSaldo = $"&emsp;<b>Con Saldo:</b> {DdlConSaldo.SelectedItem.Text}"
' Else
' ConSaldo = ""
' End If
' Dim Tipo2 As String
' If DdlTipo.SelectedValue <> "-1" Then
' Tipo2 = $"&emsp;<b>Tipo:</b> {DdlTipo.SelectedItem.Text}"
' Else
' Tipo2 = ""
' End If
' If DtDatos.Rows.Count > 0 Then
' Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
' Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
' Dim para As New List(Of ReportParameter) From {
' New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
' New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre),
' New ReportParameter("FechaImpresion", NowADS().ToString()),
' New ReportParameter("Tipo", Tipo.ToString()),
' New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Cliente}{Sucursal}{ConSaldo}{Tipo2}{FechaI}{FechaF}{FechaICorte}{FechaFCorte}")
' }
' If Imagen.Exists Then
' para.Add(New ReportParameter("LogoPath", logouri))
' Else
' para.Add(New ReportParameter("LogoPath", ""))
' End If
' ImprimirPDF("Empresas/Grales/Formatos/RepAnt-NC-IXCDetalle.rdlc", DtDatos, para, "Reporte de Anticipos - NCXAplicar - IXC Detalle", Opcion)
' Else
' Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia)
' End If
'End Sub
Protected Sub GvDatosIXC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosIXC.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -338,120 +351,10 @@ Partial Public Class General_SaldosMenores
RegistraScript("$('#DivModalSaldar').modal();")
End Sub
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) Handles BtnSaldar.Click
Dim ObjConta As New ClsContabilidad()
ObjConta.IniciaTransacSQL()
Dim CvePrePoliza As Integer = 0, CveVenta As Integer = -1, CveIE As Integer = -1
Dim Saldo As Decimal = 0
Dim SaldoAdmin As Decimal = 0
Dim ImporteTotalGasto As Decimal = 0
Dim MsgError As String = ""
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, 0, 0, 1, TxtFecha.Text.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 3)
Dim tMovto As Boolean = True
Dim tConceptoSaldar As Integer = 78
If CvePrePoliza > 0 Then
For Each Gv As GridViewRow In GvDatosIXC.Rows
Dim ConPreP As New ConceptosTipoSaldo()
If Gv.FCCheckBox("Chk").Checked Then
If Tipo = 2 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(6, Gv.DataKey("CveMoneda").ToEntero(), False, 2)
ElseIf Tipo = 1 Then
ConPreP.CveConcepto = 3
End If
'If Tipo = 1 OrElse Tipo = 2 Then
If Gv.DataKey("CveVenta").ToEntero() > 0 Then
CveVenta = Gv.DataKey("CveVenta").ToEntero()
Saldo = -Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
ElseIf Gv.DataKey("CveIE").ToEntero() > 0 Then
'ElseIf Tipo = 3 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(18, Gv.DataKey("CveMoneda").ToEntero(), True, 2)
CveIE = Gv.DataKey("CveIE").ToEntero()
Saldo = Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
End If
Saldo = -Saldo ' invertimos el saldo para que se haga negativo para que sea Abono
ImporteTotalGasto += Saldo
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, SaldoAdmin, Saldo, ConPreP.CveConcepto, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
If Gv.DataKey("CveMoneda").ToEntero() > 1 Then
Dim ImporteMN As Decimal = (Saldo * Gv.DataKey("TipoCambio").ToDecimal() - Saldo).RoundSQL()
ImporteTotalGasto += ImporteMN
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, Saldo, ImporteMN, ConPreP.CveConceptoComplementario, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero(), ImporteME:=Saldo, TipoCambio:=Gv.DataKey("TipoCambio").ToDecimal()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
End If
End If
Next
If ImporteTotalGasto <> 0 Then
ImporteTotalGasto *= -1 ' se invierte el valor, para cuadre de prepoliza
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, ImporteTotalGasto, ImporteTotalGasto, tConceptoSaldar, "", TxtConcepto.Text, CveIE, CveVenta, CveSubProyecto:=DdlSubProyectoSaldar.SelectedValue.ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
MsgError = "Poliza no insertada"
End If
End If
If MsgError = "" Then
ObjConta.Commit()
Dim Msg As String = "Los movimientos se saldaron correctamente."
Msg &= $"<br/><br/><a Class='Texto' target='_blank' href='/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={CvePrePoliza}'>Ver Póliza</a>&nbsp;&nbsp; "
Alert(Msg)
Else
ObjConta.RollBack()
Alert(MsgError, ModExtensiones.TipoMensaje.MsgError)
End If
'LnkSaldar.Visible = False
'LnkHabilitarSaldar.Visible = True
CargaDatos()
'UpLnkAgregar.Update()
ObjConta.Dispose()
'RegistraScript("$('#DivModalSaldar').modal('hide');")
TxtFecha.Text = DateTime.Today.ToString()
Upsaldar.Update()
End Sub
#End Region
#Region "TIPO DE CAMBIO"
Protected Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click
CargaDatos()
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
End Sub
Protected Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
TipoCambio = RblTipoCambio.SelectedValue.ToEntero()
If TipoCambio = 3 Then
LiEspecifico.Visible = True
TCEspecifico = GlobalTipoCambio(NowADS()).ToString().ToDouble()
TxtEspecifico.Text = TCEspecifico.ToString()
Else
LiEspecifico.Visible = False
End If
UpBodyTipoCambio.Update()
End Sub
#End Region
#End Region