-- mejoras en pagoprepolziaventa

++ clientesabonar. cambio para utilziar pagoprepoliza
This commit is contained in:
2023-01-24 06:34:39 -07:00
parent 5aa3da0ff0
commit 28beea57e1
4 changed files with 298 additions and 601 deletions

View File

@@ -1466,7 +1466,7 @@ Public Class ClsBancos
Public Function AddBancos_IE(CveCuenta As Integer, CveTipoTransaccion As Integer, FechaDocumento As Date, Folio As String, PagueseA As String, Importe As Double, CveMoneda As Integer, TipoCambio As Double, Observaciones As String, Public Function AddBancos_IE(CveCuenta As Integer, CveTipoTransaccion As Integer, FechaDocumento As Date, Folio As String, PagueseA As String, Importe As Double, CveMoneda As Integer, TipoCambio As Double, Observaciones As String,
NotificarA As String, EsAbonoEnCuenta As Boolean, AplicaImpuestos As Boolean, IDPoliza As Integer, CvePrePoliza As Integer, Comprobante As String, CveUsuario As Integer, CveEmpresa As Integer, NotificarA As String, EsAbonoEnCuenta As Boolean, AplicaImpuestos As Boolean, IDPoliza As Integer, CvePrePoliza As Integer, Comprobante As String, CveUsuario As Integer, CveEmpresa As Integer,
Optional CveCuentaDeposito As Integer = -1, Optional PagoElectronico As String = "-1", Optional CveEstatusIE As Integer = 1, Optional CveCuentaTarjeta As Integer = -1, Optional CveCuentaDeposito As Integer = -1, Optional PagoElectronico As String = "-1", Optional CveEstatusIE As Integer = 1, Optional CveCuentaTarjeta As Integer = -1,
Optional Referencia As String = "-1", Optional CveIESustitucion As Integer = -1, Optional CveCorte As Integer = -1, Optional CveProveedorIntermediario As Integer = -1, Optional FueConciliado As Boolean = False, Optional Referencia As String = "-1", Optional CveCorte As Integer = -1, Optional CveProveedorIntermediario As Integer = -1, Optional FueConciliado As Boolean = False,
Optional MesesSinIntereses As Integer = -1, Optional Modulo As String = "", Optional ConceptoCIE As String = "", Optional CveOCAnticipo As Integer = -1) As Integer Optional MesesSinIntereses As Integer = -1, Optional Modulo As String = "", Optional ConceptoCIE As String = "", Optional CveOCAnticipo As Integer = -1) As Integer
Dim Retorno As Integer = -1 Dim Retorno As Integer = -1
@@ -1497,7 +1497,6 @@ Public Class ClsBancos
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta
.Add("@Referencia", SqlDbType.VarChar).Value = Referencia .Add("@Referencia", SqlDbType.VarChar).Value = Referencia
.Add("@CveIESustitucion", SqlDbType.Int).Value = CveIESustitucion
.Add("@CveCorte", SqlDbType.Int).Value = CveCorte .Add("@CveCorte", SqlDbType.Int).Value = CveCorte
.Add("@CveProveedorIntermediario", SqlDbType.Int).Value = CveProveedorIntermediario .Add("@CveProveedorIntermediario", SqlDbType.Int).Value = CveProveedorIntermediario
.Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado

View File

@@ -10381,7 +10381,8 @@ Public Class ClsPaginas
End If End If
If VentaActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares If VentaActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares
tImportePago = ((Pago.ImportePago * TCValuacionVenta / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL tImportePago = ((Pago.ImportePago * TCValuacionVenta / Pago.TCPago) * Pago.TCPago).RoundSQL
tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL
ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares
tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL
tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL
@@ -10557,6 +10558,7 @@ Public Class ClsPaginas
Dim ConceptoContable, IdCtaContable As Integer Dim ConceptoContable, IdCtaContable As Integer
Dim TipoMovimiento As Boolean Dim TipoMovimiento As Boolean
Dim Diferencia As Decimal = 0 Dim Diferencia As Decimal = 0
tImportePago +=Pago.ImporteFluctuacionAdicional 'para los casos de aplicación de
If tImporteVenta <> tImportePago Then If tImporteVenta <> tImportePago Then
If tImporteVenta < tImportePago Then If tImporteVenta < tImportePago Then
@@ -10608,6 +10610,7 @@ Public Class ClsPaginas
Public Property CveCreditoDetalle As Integer = -1 Public Property CveCreditoDetalle As Integer = -1
Public Property AplicaTraslado As Boolean = True Public Property AplicaTraslado As Boolean = True
Public Property Referencia As String Public Property Referencia As String
Public Property ImporteFluctuacionAdicional As Decimal = 0
End Class End Class

View File

@@ -96,7 +96,7 @@
<div id="DivDatosBancarios" runat="server" class="chequesie1"> <div id="DivDatosBancarios" runat="server" class="chequesie1">
<div class="row"> <div class="row">
<label class="col-md-2">Movimiento:</label> <label class="col-md-2">Movimiento:</label>
<div class="col-md-4"> <div class="col-md-5">
<asp:DropDownList ID="DdlTipoTransaccion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="TipoTransaccion" DataValueField="CveTipoTransaccion" ValidationGroup="GrpGuardar"> <asp:DropDownList ID="DdlTipoTransaccion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="TipoTransaccion" DataValueField="CveTipoTransaccion" ValidationGroup="GrpGuardar">
</asp:DropDownList> </asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoTransaccion" runat="server" ControlToValidate="DdlTipoTransaccion" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Movimiento''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVTipoTransaccion" runat="server" ControlToValidate="DdlTipoTransaccion" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Movimiento''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
@@ -115,9 +115,6 @@
</div> </div>
<div class="col-md-5" runat="server" id="DivTCDolaresDolares" visible="false"> <div class="col-md-5" runat="server" id="DivTCDolaresDolares" visible="false">
T.C: T.C:
<asp:TextBox ID="TxtTCDolaresDolares" runat="server" placeholder="Tipo de Cambio" CssClass="form-control input-sm" MaxLength="12" Width="70px" ClientIDMode="Static" Style="text-align: right; display: inline-block;" /> <asp:TextBox ID="TxtTCDolaresDolares" runat="server" placeholder="Tipo de Cambio" CssClass="form-control input-sm" MaxLength="12" Width="70px" ClientIDMode="Static" Style="text-align: right; display: inline-block;" />
@@ -216,21 +213,21 @@
<div class="col-md-3"> <div class="col-md-3">
<asp:TextBox ID="TxtAnticipo" runat="server" Width ="100px" ClientIDMode="Static" /> <asp:TextBox ID="TxtAnticipo" runat="server" Width ="100px" ClientIDMode="Static" />
</div> </div>
<div class="col-md-2" runat="server" id="Div3" visible="false"> </div>
<div class="col-md-2" runat="server" id="Div3" visible="false">Liquidación:</div>
<div class="col-md-3" runat="server" id="Div4" visible="false"> <div class="col-md-3" runat="server" id="Div4" visible="false">
<asp:CheckBox ID="CheckBox2" OnCheckedChanged="ChkLiquidacion_CheckedChanged" runat="server" AutoPostBack="true" />
</div>
</div> </div>
</div>
<div class="row" id="divPrestamo" runat="server" visible="false" > <div class="row" id="divPrestamo" runat="server" visible="false" >
<div class="col-md-2" >Préstamo:</div> <div class="col-md-2" >Préstamo:</div>
<div class="col-md-3"> <div class="col-md-3">
<asp:TextBox ID="TxtPrestamo" runat="server" Width ="100px" ClientIDMode="Static" /> <asp:TextBox ID="TxtPrestamoImporte" runat="server" Width="100px" ClientIDMode="Static"></asp:TextBox>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlPrestamo" runat="server" Width="40px" DataTextField="RazonSocial" DataValueField="CveIE"></asp:DropDownList> <asp:DropDownList ID="DdlPrestamo" runat="server" Width="100%" DataTextField="TextoDocumento" DataValueField="CveIE"></asp:DropDownList>
</div>
<div class="col-md-3" >Intereses:
<asp:TextBox ID="TxtPrestamoIntereses" runat="server" Width="80px" ClientIDMode="Static"></asp:TextBox>
</div> </div>
</div> </div>
@@ -820,6 +817,24 @@
Importe = Importe + ToDouble($get('TxtAnticipo').value); Importe = Importe + ToDouble($get('TxtAnticipo').value);
} }
} }
if ($get('TxtPrestamoImporte') != null) {
if ($get('TxtPrestamoImporte').value == '') {
$get('TxtPrestamoImporte').value = 0.00;
}
else {
Importe = Importe - ToDouble($get('TxtPrestamoImporte').value);
}
}
if ($get('TxtPrestamoIntereses') != null) {
if ($get('TxtPrestamoIntereses').value == '') {
$get('TxtPrestamoIntereses').value = 0.00;
}
else {
Importe = Importe - ToDouble($get('TxtPrestamoIntereses').value);
}
}
if ($get('TxtOtrosImportes') != null) { if ($get('TxtOtrosImportes') != null) {
if (pagoMultiple != 0) { if (pagoMultiple != 0) {

View File

@@ -69,6 +69,14 @@ Partial Class Ventas_ClientesAbonar
ViewState("DtIngresos") = value ViewState("DtIngresos") = value
End Set End Set
End Property End Property
Private Property DtPrestamos As DataTable
Get
Return CType(ViewState("DtPrestamos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtPrestamos") = value
End Set
End Property
Private Property IdCuentaBancaria As Integer Private Property IdCuentaBancaria As Integer
Get Get
@@ -164,15 +172,6 @@ Partial Class Ventas_ClientesAbonar
End Set End Set
End Property End Property
'Private Property CveIESustitucion As Integer
' Get
' Return ViewState("CveIESustitucion").ToString.ToEntero
' End Get
' Set(value As Integer)
' ViewState("CveIESustitucion") = value
' End Set
'End Property
Private Property CFDIRelacionadoSustitucion As String Private Property CFDIRelacionadoSustitucion As String
Get Get
If ViewState("CFDIRelacionadoSustitucion") Is Nothing Then If ViewState("CFDIRelacionadoSustitucion") Is Nothing Then
@@ -248,16 +247,11 @@ Partial Class Ventas_ClientesAbonar
ViewState("IdCtaContMonedaExtranjeraAnticipo") = 0 ViewState("IdCtaContMonedaExtranjeraAnticipo") = 0
ViewState("IdCtaContMonedaComplementariaAnticipo") = 0 ViewState("IdCtaContMonedaComplementariaAnticipo") = 0
ViewState("CveIESustitucion") = IfNull(Request("CveIESustitucion"), "-1").ToString.ToEntero
DdlProveedorIntermediario.setEsWebService(True) DdlProveedorIntermediario.setEsWebService(True)
DdlProveedorIntermediario.Attributes.Add("data-metodo", "getproveedores") DdlProveedorIntermediario.Attributes.Add("data-metodo", "getproveedores")
FechaCorteIE = DateTime.Now FechaCorteIE = DateTime.Now
'If CveIESustitucion > 0 Then
' CargaIESustituir()
'End If
Dim dia As Integer = If(UsuarioActual.CveEmpresa = 13, Now.Day - 1, Now.Day) Dim dia As Integer = If(UsuarioActual.CveEmpresa = 13, Now.Day - 1, Now.Day)
Fecha = (dia.ToString + "/" + Now.Month.ToString + "/" + Now.Year.ToString).ToDate Fecha = (dia.ToString + "/" + Now.Month.ToString + "/" + Now.Year.ToString).ToDate
@@ -355,7 +349,6 @@ Partial Class Ventas_ClientesAbonar
CargaCuentas() CargaCuentas()
CargaTipoTransaccion() CargaTipoTransaccion()
'TxtFechaDocumento.Text = IIf(CveIESustitucion > 0, FechaCorteIE.ToShortDateString, Now.ToShortDateString).ToString
TxtFechaDocumento.Text = Now.ToShortDateString.ToString TxtFechaDocumento.Text = Now.ToShortDateString.ToString
TxtAboneA.Enabled = False TxtAboneA.Enabled = False
@@ -390,6 +383,7 @@ Partial Class Ventas_ClientesAbonar
'Dim CveClasificacionCol6 As Integer = 21572 'Dim CveClasificacionCol6 As Integer = 21572
'Dim CveClasificacionCol7 As Integer = 21571 'Dim CveClasificacionCol7 As Integer = 21571
divAnticipo.Visible = True divAnticipo.Visible = True
divPrestamo.Visible = True
GvCxC.Columns(17).HeaderText = "Comisión<br/>Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10) GvCxC.Columns(17).HeaderText = "Comisión<br/>Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10)
GvCxC.Columns(18).HeaderText = "Gastos<br/>Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12) GvCxC.Columns(18).HeaderText = "Gastos<br/>Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
@@ -406,6 +400,7 @@ Partial Class Ventas_ClientesAbonar
DvLiquidacion2.Visible = True DvLiquidacion2.Visible = True
DtIngresos = CargaIngresos(2) DtIngresos = CargaIngresos(2)
DtPrestamos = CargaPrestamos(1)
End If End If
CargaDatos(tCveMoneda) CargaDatos(tCveMoneda)
@@ -422,18 +417,15 @@ Partial Class Ventas_ClientesAbonar
Dim FechaI As String = IfNull(Request("FechaI"), "-1") Dim FechaI As String = IfNull(Request("FechaI"), "-1")
Dim FechaF As String = IfNull(Request("FechaF"), "-1") Dim FechaF As String = IfNull(Request("FechaF"), "-1")
'Dim FechaCorte As Date = IIf(CveIESustitucion > 0, (FechaCorteIE.ToDate).ToShortDateString, DateTime.Now.AddYears(1).ToShortDateString).ToString.ToDate
Dim FechaCorte As Date = DateTime.Now.AddYears(1).ToShortDateString.ToString.ToDate Dim FechaCorte As Date = DateTime.Now.AddYears(1).ToShortDateString.ToString.ToDate
Dim SumDescuentoProntoPago As Double = 0.0 Dim SumDescuentoProntoPago As Double = 0.0
'If Mov.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, FechaI, FechaF, pCveMoneda, CveSubProyecto, UsuarioActual.CveEmpresa, CveClienteSucursal, FechaCorte:=FechaCorte, CveIESustitucion:=CveIESustitucion) Then
If Mov.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, FechaI, FechaF, pCveMoneda, CveSubProyecto, UsuarioActual.CveEmpresa, CveClienteSucursal, FechaCorte:=FechaCorte) Then If Mov.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, FechaI, FechaF, pCveMoneda, CveSubProyecto, UsuarioActual.CveEmpresa, CveClienteSucursal, FechaCorte:=FechaCorte) Then
Dim TmpCxCAux As DataTable Dim TmpCxCAux As DataTable
TmpCxCAux = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio") TmpCxCAux = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
SumDescuentoProntoPago = TmpCxCAux.SUM("DescuentoProntoPago") SumDescuentoProntoPago = TmpCxCAux.SUM("DescuentoProntoPago")
GvCxC.DataSource = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio") GvCxC.DataSource = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
CveMoneda = pCveMoneda CveMoneda = pCveMoneda
End If End If
@@ -799,12 +791,6 @@ Partial Class Ventas_ClientesAbonar
'02-05-2018 MANDAMOS CANCELAR EL COMPLEMENTO A SUSTITUIR '02-05-2018 MANDAMOS CANCELAR EL COMPLEMENTO A SUSTITUIR
Dim ErrorCancelarIE As Boolean = False Dim ErrorCancelarIE As Boolean = False
'If CveIESustitucion > 0 Then
' ErrorCancelarIE = CancelarIE()
' If ErrorCancelarIE Then
' Exit Sub
' End If
'End If
Dim ObjIE As New ClsBancos() Dim ObjIE As New ClsBancos()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
@@ -856,11 +842,8 @@ Partial Class Ventas_ClientesAbonar
Dim CveProvIntermediario As Integer Dim CveProvIntermediario As Integer
If ChkProveedorIntermediario.Checked Then If ChkProveedorIntermediario.Checked Then
CveProvIntermediario = If(DdlProveedorIntermediario.SelectedValue.ToEntero <= 0, -1, DdlProveedorIntermediario.SelectedValue.ToEntero) CveProvIntermediario = If(DdlProveedorIntermediario.SelectedValue.ToEntero <= 0, -1, DdlProveedorIntermediario.SelectedValue.ToEntero)
End If End If
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveProveedorIntermediario:=CveProvIntermediario)
'CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveIESustitucion:=CveIESustitucion, CveProveedorIntermediario:=CveProvIntermediario)
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveIESustitucion:=-1, CveProveedorIntermediario:=CveProvIntermediario)
Else Else
If RblTipoPago.SelectedValue.Contiene("3") Then If RblTipoPago.SelectedValue.Contiene("3") Then
CveIE = DdlIngreso.SelectedValue.ToEntero CveIE = DdlIngreso.SelectedValue.ToEntero
@@ -878,7 +861,6 @@ Partial Class Ventas_ClientesAbonar
filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If End If
'inserto los movimientos de la conta para abonar al saldo 'inserto los movimientos de la conta para abonar al saldo
If CvePrePoliza > 0 Then If CvePrePoliza > 0 Then
@@ -895,7 +877,6 @@ Partial Class Ventas_ClientesAbonar
Dim CveSubProyectoContabilizar As Integer = -1 Dim CveSubProyectoContabilizar As Integer = -1
Dim CveSubProyectoMaximo As Integer = -1 Dim CveSubProyectoMaximo As Integer = -1
Dim CuentasContablesInvalidas As New StringBuilder Dim CuentasContablesInvalidas As New StringBuilder
Dim CuentasContablesInvalidasSIG As New StringBuilder
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim TipoCambioFluctuacion As Decimal = 1 Dim TipoCambioFluctuacion As Decimal = 1
Dim FechaUltimaFluctuacion As Date = MinFecha Dim FechaUltimaFluctuacion As Date = MinFecha
@@ -903,15 +884,41 @@ Partial Class Ventas_ClientesAbonar
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha) Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
Dim ImportePrestamo As Decimal = 0
Dim TCPrestamo As Decimal = 0
If TxtPrestamoImporte.Text.ToDecimal <> 0 Then 'amortización del préstamo
ImportePrestamo = TxtPrestamoImporte.Text.ToDecimal
Dim tCveProv As Integer = DtPrestamos.FiltroPrimeroValor("CveProveedor", "CveIE=" & DdlPrestamo.SelectedValue)
Dim tFechaIE As Date = DtPrestamos.FiltroPrimeroValor("FechaDocumento", "CveIE=" & DdlPrestamo.SelectedValue).ToDate
TCPrestamo = DtPrestamos.FiltroPrimeroValor("TipoCambio", "CveIE=" & DdlPrestamo.SelectedValue).ToDecimal
If CveMoneda = 1 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ImportePrestamo, 57, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=tipoCambioPago, CveProveedor:=tCveProv) Then
MsgError = "No se pudo insertar la póliza"
End If
Else
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then If tFechaIE <= UltimaFluctuacion.FechaFluctuacion Then
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion TCPrestamo = UltimaFluctuacion.TCFluctuacion
End If
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ImportePrestamo, 349, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=TCPrestamo, ImporteME:=ImportePrestamo, CveProveedor:=tCveProv) Then
MsgError = "No se pudo insertar la póliza"
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ((ImportePrestamo * TCPrestamo) - ImportePrestamo).RoundSQL, 350, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=TCPrestamo, ImporteME:=ImportePrestamo, CveProveedor:=tCveProv) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
If TxtPrestamoIntereses.Text.ToDecimal <> 0 AndAlso MsgError = "" Then
Dim ImporteIntereses As Decimal = (TxtPrestamoIntereses.Text.ToDecimal * tipoCambioPago).RoundSQL
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteIntereses, ImporteIntereses, 6, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=tipoCambioPago, CveClasificacion:=21927) Then
MsgError = "No se pudo insertar la póliza"
End If End If
End If End If
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
dtConceptos = ObjMov.DtResultados
End If End If
'inserto las ventas que voy a pagar 'inserto las ventas que voy a pagar
@@ -920,11 +927,52 @@ Partial Class Ventas_ClientesAbonar
If gvr.FCCheckBox("Chk").Checked Then If gvr.FCCheckBox("Chk").Checked Then
Dim ObjFactura As Modelos.Factura = Nothing Dim ObjFactura As Modelos.Factura = Nothing
Dim EsAnticipoEspecial As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
ObjFactura = New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa) ObjFactura = New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
End If End If
Dim VentaActual As New Venta
VentaActual.CveVenta = gvr.DataKey("CveVenta").ToEntero
VentaActual.Fecha = gvr.DataKey("Fecha").ToDate
VentaActual.CveCliente = gvr.DataKey("CveCliente").ToEntero
VentaActual.CveMoneda = gvr.DataKey("CveMoneda").ToEntero
VentaActual.SerieFolio = gvr.DataKey("SerieFolio")
VentaActual.ClienteNombre = NombreComercial
VentaActual.TC = gvr.DataKey("TipoCambio").ToDecimal
VentaActual.Total = gvr.DataKey("Original").ToDecimal
VentaActual.IVA = gvr.DataKey("IVA").ToDecimal
VentaActual.IEPS = gvr.DataKey("IEPS").ToDecimal
VentaActual.RetIVA = gvr.DataKey("RetIVA").ToDecimal
VentaActual.RetISR = gvr.DataKey("RetISR").ToDecimal
VentaActual.PorcentajeIVA = gvr.DataKey("PorcentajeIVA").ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
'Importe de pago
Dim Pago As New VentaPago
Pago.Fecha = TxtFechaDocumento.Text.ToDate
Pago.CveIE = CveIE
Pago.CveMonedaPago = CveMoneda
Pago.ImportePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
Pago.ImportePagoVenta = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
Pago.Referencia = TxtFolio.Text
If RblTipoPago.SelectedValue = "3" Then Pago.TipoPago = "I"
'Tipos de cambio
If Pago.CveMonedaPago = 1 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
Pago.TCPago = TxtTC.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
Pago.TCPago = IIf(TxtTCDolaresDolares.Visible, TxtTCDolaresDolares.Text.ToDecimal, TxtTCDolares.Text.ToDecimal)
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
Pago.TCPago = TxtTCDolares.Text.ToDecimal
End If
tipoCambioPago = Pago.TCPago
If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
tipoCambioPago = 1 tipoCambioPago = 1
@@ -946,61 +994,14 @@ Partial Class Ventas_ClientesAbonar
PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal
End If End If
'PARA EMITIR COMPLEMENTO PAGO If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then
CveVentasPago.Add(gvr.DataKey("CveVenta").ToEntero) EsAnticipoEspecial = True
SeriesPago.Add(gvr.DataKey("SerieFolio")) Pago.AplicaTraslado = False
Dim IdCtaContable As Integer = If(EsAnticipoEspecial, IdCtaAnticipo, IdCuentaCliente)
If VentaActual.CveMoneda = 2 Then IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaExtranjeraAnticipo, IdCtaContMonedaExtranjera)
Dim tipoCambioVentaDiferenciaCambiaria As Double = 1 If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, VentaActual.SerieFolio, 3, VentaActual.SerieFolio, IdCtaContable, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveCliente:=ViewState("CveCliente").ToString.ToEntero, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, Contabilizable:=False) Then
Dim EsAnticipoEspecial As Boolean = False If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, VentaActual.SerieFolio, 95, VentaActual.SerieFolio, IdCtaContable, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveCliente:=ViewState("CveCliente").ToString.ToEntero, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, Contabilizable:=False) Then
If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True
Dim FluctuacionAnticipo As Decimal = 0
If dtConceptos IsNot Nothing Then
FluctuacionAnticipo = 0 ' se limpia la fluctuación por cada factura.
For Each Row As DataRow In dtConceptos.Rows
Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False)
Dim ImporteMovimiento As Decimal = 0
Dim ImporteMN As Decimal
Dim FechaMovimiento As Date = TxtFechaDocumento.Text
Dim IdCtaContable As Integer = 0
Dim ConceptoMovimiento As String = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreComercial, gvr.DataKey("SerieFolio").ToString, TxtFolio.Text.Trim)
Dim Referencia As String = gvr.DataKey("SerieFolio").ToString
Dim CveSubProyecto As Integer = gvr.DataKey("CveSubProyecto").ToEntero
CveSubProyectoContabilizar = -1
Dim PorcentajeImpuesto As Decimal = 0
If CveSubProyecto > 0 Then CveSubProyectoMaximo = CveSubProyecto
Select Case ConceptoContable
Case 2 'Pago Cliente
If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292
ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal).RoundSQL
ImporteMN = ImporteMovimiento '(ImporteMovimiento * tipoCambioVentaValuacion).RoundSQL
TipoCambioGeneral = tipoCambioVentaValuacion
CveSubProyectoContabilizar = CveSubProyecto
If gvr.DataKey("CveMoneda").ToEntero = 1 Then
IdCtaContable = If(EsAnticipoEspecial, IdCtaAnticipo, IdCuentaCliente)
ConceptoContable = If(EsAnticipoEspecial, 3, ConceptoContable)
Else
ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}"
IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria)
If ImporteMovimiento <> 0 Then
ImporteMN = ImporteMovimiento
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaExtranjeraAnticipo, IdCtaContMonedaExtranjera)
ConceptoContable = If(EsAnticipoEspecial, 3, ConceptoContable)
End If
If EsAnticipoEspecial Then
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Referencia, 2, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Referencia, 95, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
Else Else
@@ -1009,7 +1010,7 @@ Partial Class Ventas_ClientesAbonar
End If End If
If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola
Dim FluctuacionAnticipo As Decimal = 0
Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal
Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal
Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal
@@ -1077,20 +1078,18 @@ Partial Class Ventas_ClientesAbonar
End If End If
If ImporteLiq8 <> 0 Then If ImporteLiq8 <> 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza" : Exit For
Exit For
End If End If
End If End If
If ImporteLiq9 <> 0 Then If ImporteLiq9 <> 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza" : Exit For
Exit For
End If End If
End If End If
If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then If MsgError = "" AndAlso gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then
Dim TCP As Decimal = 0 Dim TCP As Decimal = 0
Dim FolioPago As String = " " Dim FolioPago As String = " "
If DtIngresos IsNot Nothing Then If DtIngresos IsNot Nothing Then
@@ -1106,11 +1105,11 @@ Partial Class Ventas_ClientesAbonar
End If End If
End If End If
'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo 'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo
FluctuacionAnticipo = ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL FluctuacionAnticipo = ((TCP - tipoCambioPago) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago) MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago)
End If End If
If gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then If MsgError = "" AndAlso gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then
Dim TCP As Decimal = 0 Dim TCP As Decimal = 0
Dim FolioPago As String = " " Dim FolioPago As String = " "
If DtIngresos IsNot Nothing Then If DtIngresos IsNot Nothing Then
@@ -1127,351 +1126,42 @@ Partial Class Ventas_ClientesAbonar
End If End If
'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo 'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo
FluctuacionAnticipo += ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort2").Text.ToDecimal).RoundSQL FluctuacionAnticipo += ((TCP - tipoCambioPago) * gvr.FCTextBox("TxtAmort2").Text.ToDecimal).RoundSQL
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort2").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago) MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort2").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago)
End If End If
End If If ImportePrestamo <> 0 Then
If TCPrestamo > 0 Then
FluctuacionAnticipo += ((TCPrestamo - tipoCambioPago) * ImportePrestamo).RoundSQL
Case 8 'Ret IVA x Trasladar
If EsAnticipoEspecial Then Exit Select
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
Exit Select
End If
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
'Conta ContPAQ
If IdCtaContRetIVA <> 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If End If
End If End If
Pago.ImporteFluctuacionAdicional = FluctuacionAnticipo
End If End If
If MsgError = "" AndAlso AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
Case 313 'Ret Iva Servicios MsgError = "No se pudo insertar la póliza"
If EsAnticipoEspecial Then Exit Select
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
End If
End If End If
End If ' Case 134 'Pago Intermediario
Case 9 'Ret ISR x Trasladar
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
'Conta ContPAQ
If IdCtaContRetISR <> 0 Then
IdCtaContable = IdCtaContRetISR
Else
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
End If
Case 13 'Iva por Trasladar
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
Dim IdCtaIVAXTrasladar As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero
End If
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
Case 62 'Ret IVA Trasladado
If EsAnticipoEspecial Then Exit Select
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
Exit Select
End If
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
'Conta ContPAQ
If IdCtaContRetIVA <> 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
Case 314 'Ret Iva Servicios Traslado
If EsAnticipoEspecial Then Exit Select
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
End If
End If
End If
Case 63 'Ret ISR Trasladado
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
'Conta ContPAQ
If IdCtaContRetISR <> 0 Then
IdCtaContable = IdCtaContRetISR
Else
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
End If
Case 61 'Iva Trasladado
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
Dim IdCtaIVATrasladado As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero
End If
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
Case 38 'IEPS por trasladar
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
Case 39 'IEPS Trasladado
If EsAnticipoEspecial Then Exit Select
ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
Case 64 'Ganancia
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
Dim CveMonedaVenta As Integer = gvr.DataKey("CveMoneda").ToEntero
Dim tImporteVenta, tImportePago As Decimal
Dim Diferencia As Decimal = 0
ImporteMovimiento = 0
Dim ImportePago As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL
If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then
ImportePago = ImportePago - gvr.FCTextBox("TxtAmort").Text.ToDecimal - gvr.FCTextBox("TxtAmort2").Text.ToDecimal
End If
tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal)
If CveMonedaVenta = 1 And CveMoneda <> 1 Then
'factura pesos, pago en dolares
tImporteVenta = ImportePago
tImportePago = ((ImportePago * tipoCambioVenta / tipoCambioPago).RoundSQL * tipoCambioPago).RoundSQL
ElseIf CveMonedaVenta <> 1 And CveMoneda <> 1 Then
'factura dolares, pago en dolares
tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL
tImportePago = (ImportePago * tipoCambioPago).RoundSQL
ElseIf CveMonedaVenta <> 1 And CveMoneda = 1 Then
'factura dolares, pago en pesos
tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL
tImportePago = (ImportePago * tipoCambioPago).RoundSQL
End If
'If FluctuacionAnticipo <> 0 Then
' tImportePago += FluctuacionAnticipo
'End If
If tImporteVenta <> tImportePago Then
If tImporteVenta < tImportePago Then
ConceptoContable = 64
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
TipoMovimiento = True
'CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
Else
ConceptoContable = 65
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
TipoMovimiento = False
' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
End If
Diferencia = tImporteVenta - tImportePago
End If
' si tiene funcionalidad para que tome el TC de pago, que solo afecta a los impuestos
If FuncionalidadFluctuacionImpuestos Then
Dim TCImpuestos As Decimal = tipoCambioPago
Diferencia -= (((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IVA
Diferencia -= (((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetIVA
Diferencia -= (((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetISR
Diferencia -= (((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IEPS
Diferencia = Diferencia.RoundSQL
End If
ImporteMovimiento = Math.Abs(Diferencia)
ImporteMN = ImporteMovimiento
CveSubProyectoContabilizar = CveSubProyecto
Else
ImporteMovimiento = 0
End If
Case 78 'Otros Ingresos
If ChkAjusteOI.Checked Then
ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal
ImporteMN = ImporteMovimiento * tipoCambioPago.RoundSQL
If gvr.FCTextBox("TxtComision").Text.ToDecimal < 0 Then
TipoMovimiento = False
ImporteMovimiento = ImporteMovimiento * -1
ImporteMN = ImporteMN * -1
Else
TipoMovimiento = True
End If
ImporteMovimiento = ImporteMovimiento.RoundSQL
ImporteMN = ImporteMN.RoundSQL
TipoCambioGeneral = tipoCambioPago
CveSubProyectoContabilizar = CveSubProyecto
IdCtaContable = UsuarioActual.Empresa.IdCuentaOtrosIngresos
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
End If
Case 134 'Pago Intermediario
If RblTipoPago.SelectedValue = "2" Then If RblTipoPago.SelectedValue = "2" Then
ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal Dim ImporteMovimiento As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal
ImporteMN = Math.Round(ImporteMovimiento * tipoCambioPago, 2) Dim ImporteMN As Decimal = (ImporteMovimiento * tipoCambioPago).RoundSQL
CveSubProyectoContabilizar = CveSubProyecto Dim IdCtaContable As Integer = 0
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, VentaActual.SerieFolio, 134, VentaActual.SerieFolio, IdCtaContable, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ConceptoMovimiento, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero, ImporteMX:=ImporteMN) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
End If End If
ImporteMovimiento = 0
Case 30
ImporteMovimiento = 0
Case Else
ImporteMovimiento = 0
End Select
If MsgError <> "" Then 'PARA EMITIR COMPLEMENTO PAGO
Exit For CveVentasPago.Add(gvr.DataKey("CveVenta").ToEntero)
End If SeriesPago.Add(gvr.DataKey("SerieFolio"))
If ImporteMovimiento <> 0 AndAlso MsgError = "" Then
'Conta ContPAQ
If (IdCtaContable < 1 Or IdCuentaBancaria < 1) AndAlso UsuarioActual.CveEmpresa <> 119 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
idCuentaContabilizacion = 0
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then
MsgError = "No se pudo insertar la póliza"
Exit For
End If
End If
Next
If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then
ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal()
ListaFacturasGenerarNC.Add(ObjFactura) ListaFacturasGenerarNC.Add(ObjFactura)
End If End If
End If
End If End If
Next Next
@@ -1480,7 +1170,7 @@ Partial Class Ventas_ClientesAbonar
CveSubProyectoContabilizar = CveSubProyectoMaximo CveSubProyectoContabilizar = CveSubProyectoMaximo
If tipoCambioPago > 1 AndAlso CveMoneda = 2 Then If CveMoneda = 2 Then
'If IdCuentaBancariaComplementaria > 0 Then 'If IdCuentaBancariaComplementaria > 0 Then
If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
tipoCambioPago = TxtTCDolares.Text.ToDecimal tipoCambioPago = TxtTCDolares.Text.ToDecimal
@@ -1522,11 +1212,8 @@ Partial Class Ventas_ClientesAbonar
End If End If
End If End If
End If
If RblTipoPago.SelectedValue = "3" AndAlso MsgError = "" Then
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, CveIE, TxtImporte.Text.ToDecimal, tipoCambioPago, tipoCambioVenta, -1, TxtObservaciones.Text, DdlIngreso.SelectedItem.Text)
End If End If
@@ -1557,7 +1244,6 @@ Partial Class Ventas_ClientesAbonar
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidas)) Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidas))
End If End If
End If End If
Else Else
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
@@ -1572,7 +1258,6 @@ Partial Class Ventas_ClientesAbonar
For Each Fac As Modelos.Factura In ListaFacturasGenerarNC For Each Fac As Modelos.Factura In ListaFacturasGenerarNC
Dim ListaNC As New List(Of Modelos.Factura) Dim ListaNC As New List(Of Modelos.Factura)
ListaNC.Add(Fac) ListaNC.Add(Fac)
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC) Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC)
If Resp IsNot Nothing AndAlso Resp.Respuesta IsNot Nothing AndAlso Resp.Respuesta.CveVenta > 0 Then If Resp IsNot Nothing AndAlso Resp.Respuesta IsNot Nothing AndAlso Resp.Respuesta.CveVenta > 0 Then
@@ -1667,20 +1352,6 @@ Partial Class Ventas_ClientesAbonar
MsgError = "Error al Agregar la Póliza de Armonización Contable" MsgError = "Error al Agregar la Póliza de Armonización Contable"
End If End If
'BITACORA
'If MsgError = "" Then
' If CveIESustitucion > 0 And ComplementoSustitucionGenerado Then
' If Not ObjEvento.AddEventoBitacora($"Complemento de pago Cancelado por sustitución con Folio <a href='/Bancos/IE.aspx?CveIE={CveIE}' target='_blank' class='Texto'>{TxtFolio.Text}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIESustitucion) Then
' MsgError = "Ocurrió un error al agregar la bitacora"
' End If
' If Not ObjEvento.AddEventoBitacora($"Complemento de pago Generado por Sustitución de <a href='/Bancos/IE.aspx?CveIE={CveIESustitucion}' target='_blank' class='Texto'>{FolioIECancelado}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then
' MsgError = "Ocurrió un error al agregar la bitacora"
' End If
' End If
'End If
Catch ex As Exception Catch ex As Exception
MsgError = "Ocurrió un error al guardar el movimiento" MsgError = "Ocurrió un error al guardar el movimiento"
OnError("Ocurrió un error al guardar el movimiento", ex) OnError("Ocurrió un error al guardar el movimiento", ex)
@@ -1718,7 +1389,7 @@ Partial Class Ventas_ClientesAbonar
Else Else
If ObjConta IsNot Nothing Then ObjConta.RollBack() If ObjConta IsNot Nothing Then ObjConta.RollBack()
ObjIE.RollBack() ObjIE.RollBack()
Alert(MsgError, TipoMensaje.MsgAdvertencia) ' Alert(MsgError, TipoMensaje.MsgAdvertencia)
End If End If
ObjIE.Dispose() ObjIE.Dispose()
@@ -2398,7 +2069,6 @@ Partial Class Ventas_ClientesAbonar
DdlCuenta.SelectedValue = "-1" DdlCuenta.SelectedValue = "-1"
DdlTipoTransaccion.SelectedValue = "-1" DdlTipoTransaccion.SelectedValue = "-1"
'CveIESustitucion = "-1"
CFDIRelacionadoSustitucion = "-1" CFDIRelacionadoSustitucion = "-1"
FechaCorteIE = DateTime.Now.ToDate FechaCorteIE = DateTime.Now.ToDate
IDPoliza = -1 IDPoliza = -1
@@ -2476,7 +2146,21 @@ Partial Class Ventas_ClientesAbonar
Deudores.Dispose() Deudores.Dispose()
DdlIngreso.DataBind() DdlIngreso.DataBind()
DdlIngreso.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlIngreso.Items.Insert(0, New ListItem("-", "-1"))
Return dtt
End Function
Private Function CargaPrestamos(tCveMoneda As Integer) As DataTable
Dim dtt As DataTable = Nothing
Dim Deudores As New ClsMovimientos
If Deudores.GetDocumentosxPagarDetalle(CveCliente, tCveMoneda, 2, UsuarioActual.CveEmpresa) Then
DdlPrestamo.DataSource = Deudores.DtResultados '.FiltraParametros("CveCliente > 0 AND Saldo > 0 AND CveIE > 0")
dtt = Deudores.DtResultados
End If
Deudores.Dispose()
DdlPrestamo.DataBind()
DdlPrestamo.Items.Insert(0, New ListItem("-", "-1"))
Return dtt Return dtt
End Function End Function
@@ -2626,8 +2310,6 @@ Partial Class Ventas_ClientesAbonar
'For i = 0 To CveVentas.Count - 1 'For i = 0 To CveVentas.Count - 1
Dim ObjBancos As New ClsBancos Dim ObjBancos As New ClsBancos
'If ObjBancos.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, If(CveIESustitucion > 0, 2, 1), UsuarioActual.CveEmpresa, -1) Then
If ObjBancos.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, 1, UsuarioActual.CveEmpresa, -1) Then If ObjBancos.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, 1, UsuarioActual.CveEmpresa, -1) Then
If Not ObjBancos.DtResultados.Rows.Count > 0 Then If Not ObjBancos.DtResultados.Rows.Count > 0 Then
ObjBancos.Dispose() ObjBancos.Dispose()
@@ -2638,8 +2320,6 @@ Partial Class Ventas_ClientesAbonar
ObjBancos.IniciaTransacSQL() ObjBancos.IniciaTransacSQL()
'If ObjBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, CveCliente, CFDIRelacionado:=CFDIRelacionadoSustitucion, EsRegeneracion:=If(CveIESustitucion > 0, True, False)) Then
If ObjBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, CveCliente, CFDIRelacionado:=CFDIRelacionadoSustitucion, EsRegeneracion:=False) Then If ObjBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, CveCliente, CFDIRelacionado:=CFDIRelacionadoSustitucion, EsRegeneracion:=False) Then
ObjBancos.Commit() ObjBancos.Commit()
ComplementoSustitucionGenerado = True ComplementoSustitucionGenerado = True
@@ -3025,7 +2705,7 @@ Partial Class Ventas_ClientesAbonar
Private Sub DdlIngreso_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIngreso.SelectedIndexChanged Private Sub DdlIngreso_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIngreso.SelectedIndexChanged
'saco la moneda de la selección 'saco la moneda de la selección
hdnIngresoImporte.Value = 0 HdnIngresoImporte.Value = 0
If DdlIngreso.SelectedValue.ToEntero > 0 Then If DdlIngreso.SelectedValue.ToEntero > 0 Then
Dim Banco As New ClsBancos Dim Banco As New ClsBancos
@@ -3033,7 +2713,7 @@ Partial Class Ventas_ClientesAbonar
CveMonedaPago = Banco.CveMoneda CveMonedaPago = Banco.CveMoneda
Dim Deudores As New ClsMovimientos Dim Deudores As New ClsMovimientos
If Deudores.GetIngresosSaldosDetalle(CveCliente, -1, UsuarioActual.CveEmpresa) Then If Deudores.GetIngresosSaldosDetalle(CveCliente, -1, UsuarioActual.CveEmpresa) Then
hdnIngresoImporte.Value = Deudores.DtResultados.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIngreso.Selectedvalue)) HdnIngresoImporte.Value = Deudores.DtResultados.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIngreso.SelectedValue))
End If End If
Deudores.Dispose() Deudores.Dispose()
End If End If