diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 8f576a8d9..d33475899 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5176,7 +5176,7 @@ Public Class ClsInventarios #Region "INVENTARIOS - REPORTE DE MOVIMIENTOS DE PROVEEDOR" - Public Function GetRepMovimientosProveedor(CveEmpresa As Integer, CveConcepto As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date) As Boolean + Public Function GetRepMovimientosProveedor(CveEmpresa As Integer, CveConcepto As Integer, CveProveedor As Integer, CvePS As Integer, CveAlmacenOrigen As Integer, CveAlmacenDestino As Integer, FechaI As Date, FechaF As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ProductosProveedor") @@ -5184,6 +5184,9 @@ Public Class ClsInventarios .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveAlmacenOrigen", SqlDbType.Int).Value = CveAlmacenOrigen + .Add("@CveAlmacenDestino", SqlDbType.Int).Value = CveAlmacenDestino .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF End With diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 2499c1de1..466e394c5 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -3479,9 +3479,17 @@ Public Class Timbrado Try Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg" - Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ObjCFDITimbre.Receptor.RFC, ObjCFDITimbre.Comprobante.Total, FolioFiscal, RutaCBB) - CBB = Nothing + 'Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + 'CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ObjCFDITimbre.Receptor.RFC, ObjCFDITimbre.Comprobante.Total, FolioFiscal, RutaCBB) + 'CBB = Nothing + + Dim qrCode As New GoFac.QrCode() + 'String cadenaqrCode = qrCode.GenerarCadenaQrCode(txtXml.Text) + + Dim bCBB As Byte() = qrCode.GenerarQrCode($"{LigaVerificacionSAT}?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}&fe=ELleDg==") + File.WriteAllBytes(RutaCBB, bCBB) + bCBB = Nothing + Catch ex As Exception OnError("Ocurrió un error al generar el QR", ex) End Try diff --git a/Bancos/CuentasBancariasDetalle.aspx.vb b/Bancos/CuentasBancariasDetalle.aspx.vb index ddfc4d03c..707282855 100644 --- a/Bancos/CuentasBancariasDetalle.aspx.vb +++ b/Bancos/CuentasBancariasDetalle.aspx.vb @@ -106,7 +106,7 @@ Partial Class Bancos_CuentasBancariasDetalle DDlCuentaContable.DataSource = ObjContabilidad.DtResultados DDlCuentaContable.DataBind() DDlCuentaContable.Items.Insert(0, New ListItem("Selecione", "-1")) - DDlCuentaContable.DataTextField = "Cuenta" + DDlCuentaContable.DataTextField = "CtaCodigo" DDlCuentaContable.DataValueField = "CveCuenta" End If End Using diff --git a/Bancos/PrestamoPersonal.aspx.cs b/Bancos/PrestamoPersonal.aspx.cs index 61470b145..038100bf5 100644 --- a/Bancos/PrestamoPersonal.aspx.cs +++ b/Bancos/PrestamoPersonal.aspx.cs @@ -106,15 +106,15 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas txtFechaF.Text = DateTime.Now.ToShortDateString(); TxtImporte.Attributes.Add("disabled", "disabled"); - if (UsuarioActual.Empresa.Funcionalidad(281).ToEntero() == 1) - { - TxtFechaPrestamo.Enabled = false; - ImgCalendarioPrestamo.Visible = false; + //if (UsuarioActual.Empresa.Funcionalidad(281).ToEntero() == 1) + //{ + // TxtFechaPrestamo.Enabled = false; + // ImgCalendarioPrestamo.Visible = false; - TxtFechaDocumento.Enabled = false; - ImgCalendario.Visible = false; + // TxtFechaDocumento.Enabled = false; + // ImgCalendario.Visible = false; - } + //} } diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 979dc9b22..c482c796d 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1963,10 +1963,10 @@ Partial Class ContabilidadC_RegPrePolizaS Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) RowIndex = GvRow.RowIndex - If GvRow.FCTextBox("TxtAbono").Text = "" Then - CargaTipoTransaccion("Ing") - Else + If GvRow.FCTextBox("TxtAbono").Visible Then CargaTipoTransaccion("Egs") + Else + CargaTipoTransaccion("Ing") End If Dim IdMov As Integer = GvRow.DataKey("IdMov").ToString.ToEntero diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 4f0fa3524..04bee566c 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -2351,7 +2351,7 @@ Partial Class Inventarios_EntregaAlmacen ErrorMovInv = True End If - If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, TotalGarantia, TxtObservaciones.Text, 95, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, TotalGarantia, TxtObservaciones.Text, 331, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then ErrorMovInv = True End If Else diff --git a/Inventarios/RepMovimientosProveedor.aspx b/Inventarios/RepMovimientosProveedor.aspx index 3ee552289..6db0eea7e 100644 --- a/Inventarios/RepMovimientosProveedor.aspx +++ b/Inventarios/RepMovimientosProveedor.aspx @@ -31,11 +31,8 @@
-
- - - - +
+
@@ -72,11 +69,25 @@
diff --git a/Inventarios/RepMovimientosProveedor.aspx.cs b/Inventarios/RepMovimientosProveedor.aspx.cs index a349a1c1f..785ce0dd5 100644 --- a/Inventarios/RepMovimientosProveedor.aspx.cs +++ b/Inventarios/RepMovimientosProveedor.aspx.cs @@ -38,19 +38,39 @@ public partial class Inventarios_RepMovimientosProveedor : ClsPaginas public void CargaCombos() { - DdlProveedor.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa); - DdlProveedor.Items.Insert(0, new ListItem("Seleccione", "-1")); - DdlProveedor.DataBind(); + //DdlProveedor.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa); + //DdlProveedor.Items.Insert(0, new ListItem("Seleccione", "-1")); + //DdlProveedor.DataBind(); + DdlProveedor.setEsWebService(true); + DdlProveedor.Attributes.Add("data-metodo", "getproveedores"); + DdlProveedor.SelectedText = "Todos"; + DdlProveedor.SelectedValue = "-1"; + DdlConcepto.DataSource = GlobalDTInvConceptos; DdlConcepto.Items.Insert(0, new ListItem("Todos", "-1")); DdlConcepto.DataBind(); + + DdlAlmacenOrigen.DataSource = get_GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + DdlAlmacenOrigen.DataBind(); + DdlAlmacenOrigen.Items.Insert(0, new ListItem("Todos", "-1")); + + DdlAlmacenDestino.DataSource = get_GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + DdlAlmacenDestino.DataBind(); + DdlAlmacenDestino.Items.Insert(0, new ListItem("Todos", "-1")); + + DdlPS.setEsWebService(true); + DdlPS.SelectedText = "Todos"; + DdlPS.SelectedValue = "-1"; } public void CargaDatos() { + int CvePS = DdlPS.SelectedValue.ToEntero(); ClsInventarios ObjInv = new ClsInventarios(); - if (ObjInv.GetRepMovimientosProveedor(UsuarioActual.CveEmpresa, DdlConcepto.SelectedValue.ToEntero(), DdlProveedor.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate())) + if (ObjInv.GetRepMovimientosProveedor(UsuarioActual.CveEmpresa, DdlConcepto.SelectedValue.ToEntero(), DdlProveedor.SelectedValue.ToEntero(), + CvePS, DdlAlmacenOrigen.SelectedValue.ToEntero(), DdlAlmacenDestino.SelectedValue.ToEntero(), + txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate())) { DtDatos = ObjInv.DtResultados; GvDatos.DataSource = DtDatos; @@ -74,7 +94,7 @@ public partial class Inventarios_RepMovimientosProveedor : ClsPaginas String FechaI; if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } String Proveedor; - if (DdlProveedor.SelectedValue != "-1") { Proveedor = $" Proveedor: {DdlProveedor.SelectedItem.Text}"; } else { Proveedor = ""; } + if (DdlProveedor.SelectedValue != "-1") { Proveedor = $" Proveedor: {DdlProveedor.SelectedText}"; } else { Proveedor = ""; } String Concepto; if (DdlConcepto.SelectedValue != "-1") { Concepto = $" Concepto: {DdlConcepto.SelectedItem.Text}"; } else { Concepto = ""; } System.IO.FileInfo Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)); diff --git a/Inventarios/ResguardoMaterial.aspx b/Inventarios/ResguardoMaterial.aspx index 1d8247bd6..024e8ee0b 100644 --- a/Inventarios/ResguardoMaterial.aspx +++ b/Inventarios/ResguardoMaterial.aspx @@ -493,13 +493,13 @@ - +
- + diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index 5392156b9..74e36dff3 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -986,7 +986,7 @@ Partial Class Inventarios_ResguardoMaterial Cont = 0 Importe = ObjInventario.DtResultados.SUMD("Total").RoundAD For Each Dr As DataRow In ObjInventario.DtResultados.Rows - Dim CveSeccionAlmacen As Integer = DiccionarioSecciones(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero + Dim CveSeccionAlmacen As Integer = -1 'DiccionarioSecciones(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero Dim Lote As String = "-1" Dim FechaCaducidad As Date = MinFecha If DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString <> "" Then Lote = DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString @@ -1013,6 +1013,7 @@ Partial Class Inventarios_ResguardoMaterial End If If Not TieneError Then + ObjInventario.Commit() Dim Msg As New StringBuilder If Concepto = 23 Then 'FolioEntrada @@ -1035,7 +1036,6 @@ Partial Class Inventarios_ResguardoMaterial DdlSubProyecto.SelectedValueExist("-1") End If - ObjInventario.Commit() If Concepto = 23 Then LimpiarMovimiento() diff --git a/Nomina/ReportePTU.aspx b/Nomina/ReportePTU.aspx index 8419a4969..d20134520 100644 --- a/Nomina/ReportePTU.aspx +++ b/Nomina/ReportePTU.aspx @@ -4,18 +4,15 @@ - Reparto de Utilidades + PTU @@ -88,11 +85,22 @@ + + + + + + + + + + + diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index 5c4f6f4bc..82f7df0c2 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -199,6 +199,19 @@
+
+
+
Anticipo:
+
+ +
+ + +
Liquidación:
+
+ +
+
@@ -239,37 +252,35 @@
- +
- - +
+
+ + " style="display: inline-block; margin-right: -20px; width: 125px;" /> + " style="margin-top: -3px; margin-right: 20px" class="btn btn-circle btn-sm label-info"> + +
-
- -
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px; margin-right: 20px" class="btn btn-circle btn-sm label-info"> -
-
+ + CssClass="table table-striped table-advance table-hover Widthall" Style="text-align: center;" GridLines="None" HeaderStyle-CssClass="ADtr"> <%--0--%> @@ -338,7 +349,7 @@ <%--9--%> - +   @@ -399,55 +410,56 @@ <%--17--%> - + <%--18--%> - + <%--19--%> - + <%--20--%> - + <%--21--%> - + <%--22--%> - + <%--23--%> - + <%--24--%> - + <%--25--%> - + + @@ -616,21 +628,14 @@ } else { txt.value = ""; - let ClsSelLiquidacionVenta = ".ClsSelLiquidacionVenta" + CveVenta; - let ClsSelLiquidacionVentaTotal = ".ClsSelLiquidacionVentaTotal" + CveVenta; + let ClsSelLiqVenta = ".ClsSelLiqVenta" + CveVenta; + let ClsSelLiqVentaTotal = ".ClsSelLiqVentaTotal" + CveVenta; - $(ClsSelLiquidacionVenta).val(''); - $(ClsSelLiquidacionVentaTotal).val(''); - + $(ClsSelLiqVenta).val(''); + $(ClsSelLiqVentaTotal).val(''); } - //if (typeof t2 === "undefined") { - - //} else { - - //} - - + if (chkPesosBancos) { CambiaPesosDolares() } else if (chkDolaresBancos) { @@ -654,6 +659,7 @@ var div = document.getElementById("DivTC") let totalLiquidacion = 0.0; + let totalAnti = 0.0; if ($get('TxtTC') != null) { tc = ToDouble($get('TxtTC').value); @@ -709,21 +715,29 @@ } $get('TxtObservaciones').value = $get('HdnObs').value + ' Ventas: ' + Ventas; + $(".ClsSelLiq").each(function () { - - - $(".ClsSelLiquidacion").each(function () { - - let valorString = $(this).val(); - valorString = valorString.replace(/,/g, ''); - - if (valorString.trim().length > 0) { - totalLiquidacion = totalLiquidacion + parseFloat(valorString); - } - + totalLiquidacion = totalLiquidacion + ToDouble($(this).val()); + }); + $(".ClsSelLiqAnt").each(function () { + totalAnti = totalAnti + ToDouble($(this).val()); + + }); + + totalLiquidacion = totalLiquidacion + totalAnti; + + if ($get('TxtAnticipo') != null) { + + if ($get('TxtAnticipo').value == '') { + $get('TxtAnticipo').value = 0.00 + } + else { + Importe = Importe + ToDouble($get('TxtAnticipo').value); + } + } if ($get('TxtOtrosImportes') != null) { if (pagoMultiple != 0) { @@ -737,11 +751,10 @@ else { return Importe + parseFloat(Comision) - totalLiquidacion; } - } else { return Importe - totalLiquidacion - } + } } function FnCambia(chk, txt, saldo, op, pagoMultiple, monedaPago) { @@ -912,34 +925,35 @@ $get("BtnCambiaTipoMoneda").click(); TipoCambioActual = TipoCambioTxt; } - } + } + function SumaLiq(txt, CveVenta, pagoMultiple, monedaPago) { + let ClsSelLiqVenta = ".ClsSelLiqVenta" + CveVenta; + let ClsSelLiqVentaTotal = ".ClsSelLiqVentaTotal" + CveVenta; + let ClsSelLiqAnticipo = ".ClsSelLiqAnt" + CveVenta; - function SumaLiquidacion(txt, CveVenta, pagoMultiple, monedaPago) { - - let ClsSelLiquidacionVenta = ".ClsSelLiquidacionVenta" + CveVenta; - let ClsSelLiquidacionVentaTotal = ".ClsSelLiquidacionVentaTotal" + CveVenta; let Total = 0.0; + let Anticipos = 0.0; + $( ClsSelLiqVenta).each(function () { - $( ClsSelLiquidacionVenta).each(function () { - - let valorString = $(this).val(); - valorString = valorString.replace(/,/g, ''); - - if (valorString.trim().length > 0) { - Total = Total + parseFloat(valorString); - } + Total = Total + ToDouble($(this).val()); }); + $(ClsSelLiqAnticipo).each(function () { - $(ClsSelLiquidacionVentaTotal).each(function () { + Anticipos = Anticipos + ToDouble($(this).val()); + + }); + + Total = Total + Anticipos; + + $(ClsSelLiqVentaTotal).each(function () { $(this).val(Total); FormatoMoneda2($(this)); }); - - + FormatoMoneda(txt); var Suma = SumaValores(pagoMultiple, monedaPago); diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index c83c43171..6057c02a7 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -62,6 +62,15 @@ Partial Class Ventas_ClientesAbonar End Set End Property + Private Property DtIngresos As DataTable + Get + Return CType(ViewState("DtIngresos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtIngresos") = value + End Set + End Property + Private Property IdCuentaBancaria As Integer Get Return ViewState("IdCuentaBancaria").ToString.ToEntero @@ -258,6 +267,7 @@ Partial Class Ventas_ClientesAbonar IdCuentaBancaria = 0 TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1},-1);", "TxtTotal", 0)) + 'TxtAnticipo.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1},-1);", "null", 0)) If CveMoneda > 0 Then LbTipoMoneda.Text = String.Format("Pago en {0}", GlobalDTMonedas.FiltraParametros(String.Format("CveMoneda = {0}", CveMoneda)).Rows(0)("Moneda")) @@ -292,28 +302,6 @@ Partial Class Ventas_ClientesAbonar RVTxtFechaDocumento.MaximumValue = Now.ToString("dd/MM/yyyy") - If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then - - 'Dim CveClasificacionCol1 As Integer = 21514 - 'Dim CveClasificacionCol2 As Integer = 21916 - 'Dim CveClasificacionCol3 As Integer = 21520 - 'Dim CveClasificacionCol4 As Integer = 21519 - 'Dim CveClasificacionCol5 As Integer = 21547 - 'Dim CveClasificacionCol6 As Integer = 21572 - 'Dim CveClasificacionCol7 As Integer = 21571 - - GvCxC.Columns(17).HeaderText = "Comisión
Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10) - GvCxC.Columns(18).HeaderText = "Gastos
Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - GvCxC.Columns(19).HeaderText = "Servicio
Inspección" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol3).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - GvCxC.Columns(20).HeaderText = "Seguro" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol4).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - GvCxC.Columns(21).HeaderText = "Aduana
Mex" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol5).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - GvCxC.Columns(23).HeaderText = "Aduana
USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - 'GvCxC.Columns(24).HeaderText = "Material
Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - - DvLiquidacion1.Visible = True - DvLiquidacion2.Visible = True - End If End If @@ -385,6 +373,32 @@ Partial Class Ventas_ClientesAbonar If Request("FechaI") IsNot Nothing Then ViewState("FechaI") = Request("FechaI") Else ViewState("FechaI") = "-1" If Request("FechaF") IsNot Nothing Then ViewState("FechaF") = Request("FechaF") Else ViewState("FechaF") = "-1" + If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then + + 'Dim CveClasificacionCol1 As Integer = 21514 + 'Dim CveClasificacionCol2 As Integer = 21916 + 'Dim CveClasificacionCol3 As Integer = 21520 + 'Dim CveClasificacionCol4 As Integer = 21519 + 'Dim CveClasificacionCol5 As Integer = 21547 + 'Dim CveClasificacionCol6 As Integer = 21572 + 'Dim CveClasificacionCol7 As Integer = 21571 + divAnticipo.Visible = True + + GvCxC.Columns(17).HeaderText = "Comisión
Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10) + GvCxC.Columns(18).HeaderText = "Gastos
Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(19).HeaderText = "Servicio
Inspección" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol3).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(20).HeaderText = "Seguro" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol4).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(21).HeaderText = "Aduana
Mex" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol5).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(23).HeaderText = "Aduana
USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + 'GvCxC.Columns(24).HeaderText = "Material
Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + + DvLiquidacion1.Visible = True + DvLiquidacion2.Visible = True + + DtIngresos = CargaIngresos(2) + End If + CargaDatos(tCveMoneda) Else Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) @@ -525,15 +539,7 @@ Partial Class Ventas_ClientesAbonar If e.Row.RowType = DataControlRowType.DataRow Then Dim moneda As Integer = 0 If e.Row.RowIndex = 0 Then - ' e.Row.Cells(0).ColumnSpan = 5 - ' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right - ' e.Row.Cells(1).Visible = False - ' e.Row.Cells(2).Visible = False - ' e.Row.Cells(3).Visible = False - ' e.Row.Cells(4).Visible = False - e.Row.BackColor = Drawing.Color.LightGray - e.Row.FCDropDownList("DdlTG").Visible = False e.Row.FCTextBox("TxtLiqCol1").Visible = False e.Row.FCTextBox("TxtLiqCol2").Visible = False @@ -543,6 +549,8 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol6").Visible = False e.Row.FCTextBox("TxtLiqCol7").Visible = False e.Row.FCTextBox("TxtLiqCol8").Visible = False + e.Row.FCTextBox("TxtAmort").Visible = False + e.Row.FCDropDownList("DdlAnti").Visible = False End If If e.Row.RowIndex = 1 Then @@ -553,9 +561,9 @@ Partial Class Ventas_ClientesAbonar e.Row.Cells(6).Width = Unit.Pixel(50) e.Row.Cells(7).Width = Unit.Pixel(70) e.Row.Cells(8).Width = Unit.Pixel(50) - e.Row.Cells(9).Width = Unit.Pixel(90) - e.Row.Cells(10).Width = Unit.Pixel(80) - e.Row.Cells(11).Width = Unit.Pixel(60) + 'e.Row.Cells(9).Width = Unit.Pixel(90) + 'e.Row.Cells(10).Width = Unit.Pixel(80) + 'e.Row.Cells(11).Width = Unit.Pixel(60) End If e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right @@ -614,40 +622,42 @@ Partial Class Ventas_ClientesAbonar e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{5}); FnCambia({2},this,{1},0,{3},{4}); FnEditarImporte({2}, {0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda, e.Row.DBCampo("CveVenta"))) End If - If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then '' si es empresa agrícola e.Row.FCDropDownList("DdlTG").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlTG").DataBind() - e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiquidacionVentaTotal{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiqVentaTotal{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtAmort").Attributes.Add("class", $"ClsSelLiqAnt") + e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("onkeyup", $"SumaLiq (this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtAmort").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCDropDownList("DdlAnti").DataSource = DtIngresos + e.Row.FCDropDownList("DdlAnti").DataBind() + e.Row.FCDropDownList("DdlAnti").Items.Insert(0, New ListItem("-", "-1")) End If - Else e.Row.FCTextBox("TxtAbonar").Visible = False e.Row.FCTextBox("TxtComision").Visible = False e.Row.FCCheckBox("Chk").Visible = False End If - If e.Row.DBCampo("CveVenta").ToEntero > 0 Then If e.Row.DataKey("ClaveMetodoPagoSAT") = "PUE" Then e.Row.FCLiteral("LtlComplemento").Text = "" @@ -656,7 +666,6 @@ Partial Class Ventas_ClientesAbonar e.Row.FCLiteral("LtlComplemento").Visible = False End If - End If End Sub @@ -929,7 +938,7 @@ Partial Class Ventas_ClientesAbonar Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False) Dim ImporteMovimiento As Decimal = 0 - Dim importeMX As Decimal + 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) @@ -942,21 +951,9 @@ Partial Class Ventas_ClientesAbonar Select Case ConceptoContable Case 2 'Pago Cliente If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292 - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioVentaValuacion - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento * tipoCambioVentaValuacion - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVentaValuacion).RoundSQL TipoCambioGeneral = tipoCambioVentaValuacion CveSubProyectoContabilizar = CveSubProyecto @@ -967,7 +964,7 @@ Partial Class Ventas_ClientesAbonar ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria) If ImporteMovimiento <> 0 Then - importeMX = ImporteMovimiento + 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, -1, 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 @@ -977,8 +974,8 @@ Partial Class Ventas_ClientesAbonar 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:=importeMX, 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:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) 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" End If Else @@ -986,29 +983,14 @@ Partial Class Ventas_ClientesAbonar End If End If - Case 8 'Ret IVA x Trasladar If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then Exit Select End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1025,27 +1007,12 @@ Partial Class Ventas_ClientesAbonar End If End If - Case 313 'Ret Iva Servicios If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1064,23 +1031,9 @@ Partial Class Ventas_ClientesAbonar Case 9 'Ret ISR x Trasladar If EsAnticipoEspecial Then Exit Select - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioVenta - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1100,23 +1053,9 @@ Partial Class Ventas_ClientesAbonar Case 13 'Iva por Trasladar If EsAnticipoEspecial Then Exit Select - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL() ' se ajusta por la parcialidad de pago, afecta en el redondeo - importeMX = ImporteMovimiento * tipoCambioVenta - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL() + + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1134,24 +1073,9 @@ Partial Class Ventas_ClientesAbonar If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then Exit Select End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1167,29 +1091,12 @@ Partial Class Ventas_ClientesAbonar End If End If End If - - Case 314 'Ret Iva Servicios Traslado If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1200,30 +1107,15 @@ Partial Class Ventas_ClientesAbonar 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 - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1243,23 +1135,9 @@ Partial Class Ventas_ClientesAbonar Case 61 'Iva Trasladado If EsAnticipoEspecial Then Exit Select - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1274,47 +1152,20 @@ Partial Class Ventas_ClientesAbonar If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" Case 38 'IEPS por trasladar If EsAnticipoEspecial Then Exit Select - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IEPS").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioVenta - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * tipoCambioVenta - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago * tipoCambioVenta).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 - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IEPS").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) + CveSubProyectoContabilizar = CveSubProyecto IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado @@ -1369,7 +1220,7 @@ Partial Class Ventas_ClientesAbonar End If ImporteMovimiento = Math.Abs(Diferencia) - importeMX = ImporteMovimiento + ImporteMN = ImporteMovimiento CveSubProyectoContabilizar = CveSubProyecto @@ -1381,32 +1232,18 @@ Partial Class Ventas_ClientesAbonar Case 78 'Otros Ingresos If ChkAjusteOI.Checked Then ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = Math.Round(ImporteMovimiento * tipoCambioPago, 2) - - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = ImporteMovimiento * tipoCambioPago - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = ImporteMovimiento * tipoCambioPago - End If + ImporteMN = ImporteMovimiento * tipoCambioPago.RoundSQL If gvr.FCTextBox("TxtComision").Text.ToDecimal < 0 Then TipoMovimiento = False ImporteMovimiento = ImporteMovimiento * -1 - importeMX = importeMX * -1 + ImporteMN = ImporteMN * -1 Else TipoMovimiento = True End If ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMN = ImporteMN.RoundSQL TipoCambioGeneral = tipoCambioPago CveSubProyectoContabilizar = CveSubProyecto @@ -1419,12 +1256,12 @@ Partial Class Ventas_ClientesAbonar Case 134 'Pago Intermediario If RblTipoPago.SelectedValue = "2" Then ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal - importeMX = Math.Round(ImporteMovimiento * tipoCambioPago, 2) + ImporteMN = Math.Round(ImporteMovimiento * tipoCambioPago, 2) CveSubProyectoContabilizar = CveSubProyecto If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" - 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:=importeMX) 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" End If End If @@ -1446,7 +1283,7 @@ Partial Class Ventas_ClientesAbonar 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:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then + 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 @@ -1480,51 +1317,44 @@ Partial Class Ventas_ClientesAbonar Dim ConceptoPartida As String = gvr.DataKey("SerieFolio") & " " & gvr.FCDropDownList("DdlTG").SelectedItem.Text If ImporteLiq1 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq1, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq1 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiq1, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq1, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq1 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiq1, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq2 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq2, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq2 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiq2, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq2, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq2 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiq2, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq3 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq3, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq3 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiq3, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq3, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq3 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiq3, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq4 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq4, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq4 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiq4, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq4, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq4 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiq4, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq5 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq5, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq5 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiq5, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq5, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq5 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiq5, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq6 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq6, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq6 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiq6, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq6, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq6 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiq6, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If If ImporteLiq7 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq7, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq7 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiq7, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq7, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq7 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiq7, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For End If End If @@ -1534,6 +1364,16 @@ Partial Class Ventas_ClientesAbonar ' Exit For ' End If 'End If + + If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then + Dim TCP As Decimal = 0 + If DtIngresos IsNot Nothing Then + TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").SelectedValue)) + End If + MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVenta) + End If + + End If If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() @@ -1577,47 +1417,65 @@ Partial Class Ventas_ClientesAbonar End If End If - If RblTipoPago.SelectedValue = "3" AndAlso MsgError = "" Then - If CveMonedaPago = 2 Then - 'rmf faltan las cuentas - If IdCtaContMonedaComplementariaAnticipo > 0 Then - If CveMonedaPago = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - tipoCambioPago = TxtTCDolares.Text.ToDecimal - ElseIf CveMonedaPago = 2 AndAlso CveMonedaFiltro = 2 Then - tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtImporte.Text.Trim.ToDecimal, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If - Else - If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - tipoCambioPago = TxtTCDolares.Text.ToDecimal - ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If - End If - Else - If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - tipoCambioPago = TxtTCDolares.Text.ToDecimal - ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola + If TxtAnticipo.Text.ToDecimal <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtAnticipo.Text.ToDecimal, TxtFolio.Text, 66, TxtObservaciones.Text, Now, -1, -1, CveIE, -1, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtAnticipo.Text.ToDecimal, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=0, ImporteME:=If(CveMoneda > 1, TxtAnticipo.Text.ToDecimal, 0)) Then MsgError = "No se pudo insertar la póliza" End If + + If CveMoneda > 1 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtAnticipo.Text.ToDecimal, TxtFolio.Text, 226, TxtObservaciones.Text, Now, -1, -1, CveIE, -1, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(TxtAnticipo.Text.ToDecimal * tipoCambioPago).RoundSQL, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=0, ImporteME:=If(CveMoneda > 1, TxtAnticipo.Text.ToDecimal, 0)) Then + MsgError = "No se pudo insertar la póliza" + 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) + + 'If CveMonedaPago = 2 Then + ' 'rmf faltan las cuentas + ' If IdCtaContMonedaComplementariaAnticipo > 0 Then + ' If CveMonedaPago = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' tipoCambioPago = TxtTCDolares.Text.ToDecimal + ' ElseIf CveMonedaPago = 2 AndAlso CveMonedaFiltro = 2 Then + ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtImporte.Text.Trim.ToDecimal, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + ' Else + ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' tipoCambioPago = TxtTCDolares.Text.ToDecimal + ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + ' End If + 'Else + ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' tipoCambioPago = TxtTCDolares.Text.ToDecimal + ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + 'End If + End If + If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(220) <> "" Then If Not ObjMov.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then MsgError = "No se pudo simplificar los movimientos" @@ -1810,6 +1668,51 @@ Partial Class Ventas_ClientesAbonar End Sub + Private Function RegistraAmortizacionAnticipo(ByRef ObjMov As ClsContabilidad, CvePrePoliza As Integer, CveIE As Integer, Importe As Decimal, tipoCambioPago As Decimal, tipoCambioVenta As Decimal) As String + Dim MsgError As String = "" + If CveMonedaPago = 2 Then + 'rmf faltan las cuentas + 'If IdCtaContMonedaComplementariaAnticipo > 0 Then + If CveMonedaPago = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + tipoCambioPago = TxtTCDolares.Text.ToDecimal + ElseIf CveMonedaPago = 2 AndAlso CveMonedaFiltro = 2 Then + tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + End If + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, CveCliente, ImporteMX:=Importe, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + MsgError = "No se pudo insertar la póliza" + End If + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, Importe / TxtTC.Text.ToDecimal, Importe), TxtObservaciones.Text, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (Importe * tipoCambioPago) - Importe, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + MsgError = "No se pudo insertar la póliza" + End If + 'Else + ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' tipoCambioPago = TxtTCDolares.Text.ToDecimal + ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, CveCliente, ImporteMX:=If(CveMoneda = 2, Importe * tipoCambioPago, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + 'End If + Else + If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + tipoCambioPago = TxtTCDolares.Text.ToDecimal + ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + End If + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, Importe * tipoCambioPago, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + MsgError = "No se pudo insertar la póliza" + End If + End If + + Return MsgError + + End Function + #Region " N O T A - D E - C R E D I T O" Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura @@ -1837,16 +1740,6 @@ Partial Class Ventas_ClientesAbonar Dim Folio As Integer = -1 Dim Serie As String = "-1" - 'Dim ObjFolios As New ClsGralFolios() - 'If ObjFolios.GetFolios("Egs", UsuarioActual.CveEmpresa) Then - ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" Estado = 'Activo' AND CveSubProyecto = {0}", Me.CveSubProyecto)) - ' If DT.Rows.Count > 0 Then - ' Serie = DT.Rows(0)("Serie").ToString() - ' Folio = DT.Rows(0)("FActual").ToString() - ' End If - ' DT.Dispose() - 'End If - 'ObjFolios.Dispose() ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa ObjFacturaDevolucion.TipoCambio = If(Me.CveMoneda = 1, 1, GlobalTipoCambio(Now).FormatoNumero(4).ToDecimal()) @@ -2370,17 +2263,19 @@ Partial Class Ventas_ClientesAbonar UpDatos.Update() End Sub - Private Sub CargaIngresos(tCveMoneda As Integer) - + Private Function CargaIngresos(tCveMoneda As Integer) As DataTable + Dim dtt As DataTable = Nothing Dim Deudores As New ClsMovimientos If Deudores.GetIngresosSaldosDetalle(CveCliente, tCveMoneda, UsuarioActual.CveEmpresa) Then DdlIngreso.DataSource = Deudores.DtResultados.FiltraParametros("CveCliente > 0 AND Saldo > 0 AND CveIE > 0") + dtt = Deudores.DtResultados.FiltraParametros("CveCliente > 0 AND Saldo > 0 AND CveIE > 0") End If Deudores.Dispose() DdlIngreso.DataBind() DdlIngreso.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub + Return dtt + End Function Protected Sub ChkAjusteOI_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChkAjusteOI.CheckedChanged @@ -2475,13 +2370,9 @@ Partial Class Ventas_ClientesAbonar End If End If - End If Dep.Dispose() - - DdlCuentaDeposito.DataBind() - Else trCuentaDeposito.Visible = False DdlCuentaDeposito.Items.Clear() @@ -2542,8 +2433,6 @@ Partial Class Ventas_ClientesAbonar End If End If - - ObjBancos.IniciaTransacSQL() @@ -2615,22 +2504,6 @@ Partial Class Ventas_ClientesAbonar End If End If - 'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then - ' If ObjIE.DtResultados.Rows.Count > 0 Then - ' Dim tFecha As Date = TxtFechaIncobrable.Text.ToDate - ' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day) - ' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC") - - ' If drr IsNot Nothing Then - ' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate - ' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal - ' End If - - ' End If - 'End If - - 'ObjIE.Dispose() - CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ClientesAbonar/SaldarI", 47, 0, 0, 1, TxtFechaIncobrable.Text.ToDate, TxtObsSaldarIncobrable.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -2918,193 +2791,6 @@ Partial Class Ventas_ClientesAbonar #End Region -#Region "COMPLEMENTO DE PAGO - ELIMINAR POR SUSTITUCION" - - 'Protected Sub CargaIESustituir() - ' Dim ObjIE As New ClsBancos() - ' If ObjIE.GetBancosIE(CveIESustitucion, UsuarioActual.CveEmpresa) Then - ' If ObjIE.DtResultados.Rows.Count > 0 Then - ' FechaCorteIE = ObjIE.FechaDocumento - ' CveMoneda = ObjIE.CveMoneda - ' CveMonedaFiltro = CveMoneda - ' IDPoliza = ObjIE.IDPoliza - ' FolioIECancelado = ObjIE.Folio - ' End If - ' End If - ' ObjIE.Dispose() - ' UpDatos.Update() - 'End Sub - - 'Function CancelarIE() As Boolean - ' Dim ErrorCancelar = False - - ' If Not IsDate(TxtFechaDocumento.Text.ToDate) Then - ' Alert("El campo fecha cancelación es incorrecto. Por favor verifique y vuelva a intentar") - ' Return True - ' End If - - ' Dim Banc As New ClsBancos - ' Banc.IniciaTransacSQL() - - ' Dim ObjAC As ClsContPAQi = Nothing - ' If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then - ' ObjAC = New ClsContPAQi(UsuarioActual.Empresa) - ' ObjAC.IniciaTransacSQL() - ' End If - - ' Dim IdPolizaNueva = -1 - ' Dim FolioPolizaNueva = -1 - - ' Try - ' 'CANCELA IE CONTABILIZADO - ' If IDPoliza > 0 Then - ' If ObjAC Is Nothing Then - ' ErrorCancelar = True - ' End If - - ' If Not ErrorCancelar Then - ' Dim dt As DataTable - ' If ObjAC.GetPoliza(IDPoliza, -1, -1, -1, -1) AndAlso ObjAC.DtResultados.Rows.Count > 0 Then - ' dt = ObjAC.DtResultados - - ' ' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS) - ' If dt.Rows(0)("FechaPol").ToString.ToDate.Month < TxtFechaDocumento.Text.ToDate.Month Or dt.Rows(0)("FechaPol").ToString.ToDate.Year < TxtFechaDocumento.Text.ToDate.Year Then - ' IdPolizaNueva = ObjAC.AddPoliza(3, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, TxtFechaDocumento.Text.ToDate) - - ' If IdPolizaNueva > 0 Then - ' FolioPolizaNueva = ObjAC.Folio - - ' 'CREA POLIZA NEGATIVA - ' For Each dr As DataRow In dt.Rows - ' If Not ObjAC.AddMovimiento(IdPolizaNueva, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "True", dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), dr("IdSegNeg").ToString.ToEntero, TxtFechaDocumento.Text.ToDate, "") Then - ' ErrorCancelar = True : Exit For - ' End If - ' Next - - ' 'AJUSTA POLIZA - ' If Not ErrorCancelar Then - ' If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then - ' ErrorCancelar = True - ' End If - ' End If - - ' 'CANCELA IE - ' If Not ErrorCancelar Then - ' If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIESustitucion, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaDocumento.Text.ToDate) > 0 Then - ' ErrorCancelar = True - ' End If - ' End If - - ' Else - ' ErrorCancelar = True - ' End If - - ' Else - - ' 'LIMPIA POLIZA PONIENDO IMPORTE EN CEROS - ' For Each dr As DataRow In dt.Rows - ' If Not ObjAC.UpdateMovimiento(dr("Id").ToString.ToEntero, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "1", 0, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegNeg").ToString.ToEntero, dr("Fecha").ToString.ToDate) Then - ' ErrorCancelar = True : Exit For - ' End If - ' Next - - ' 'AJUSTA POLIZA - ' If Not ErrorCancelar Then - ' If Not ObjAC.AjustaPoliza(IDPoliza) Then - ' ErrorCancelar = True - ' End If - ' End If - - ' 'CANCELA IE - ' If Not ErrorCancelar Then - ' If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIESustitucion, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaDocumento.Text.ToDate) > 0 Then - ' ErrorCancelar = True - ' End If - ' End If - - ' End If - - ' End If - ' End If - ' Else - - ' If FechaCorteIE.Month < TxtFechaDocumento.Text.ToDate.Month Or FechaCorteIE.Year < TxtFechaDocumento.Text.ToDate.Year Then - ' 'CANCELA IE MES ANTERIOR - ' If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIESustitucion, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaDocumento.Text.ToDate) > 0 Then - ' ErrorCancelar = True - ' End If - ' Else - ' 'CANCELA IE MES ACTUAL - ' If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIESustitucion, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaDocumento.Text.ToDate) > 0 Then - ' ErrorCancelar = True - ' End If - ' End If - - ' End If - - ' If Not ErrorCancelar Then - ' If Banc.GetComplementoPagos(-1, CveIESustitucion, -1, UsuarioActual.CveEmpresa) Then - - ' Dim CveComplementoPago As Integer = -1 - - ' If Banc.DtResultados.Rows.Count > 0 Then - ' 'OBTENEMOS EL UUID DEL COMPLEMENTO A CANCELAR POR SUSTITUCION - ' CFDIRelacionadoSustitucion = Banc.DtResultados.Rows(0)("FolioFiscal") - ' CveComplementoPago = Banc.DtResultados(0)("CveComplementoPago").ToString().ToEntero - ' End If - - ' 'ACTUALIZA FOLIOS CANCELADOS - ' If Banc.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}).Rows.Count > 0 Then - ' If Not Banc.GetFoliosCancelados(UsuarioActual.CveEmpresa) Then - ' ErrorCancelar = True - ' Else - ' Dim FolioCancelado = $"{FolioIECancelado}_C_{Banc.DtResultados(0)("Cantidad").ToString().ToEntero + 1}" - - ' If Not Banc.UpdateFolioCancelado(CveIESustitucion.ToEntero, Folio:=FolioCancelado) Then - ' ErrorCancelar = True - ' End If - ' End If - ' End If - - ' 'ACTUALIZA ESTATUS DE COMPLEMENTO DE PAGO A CANCELADO = 2 - ' If Not ErrorCancelar And CveComplementoPago > 0 Then - ' If Not Banc.UpdateComplementoPagoCancelado(CveComplementoPago, 2, UsuarioActual.Empresa.CvePAC, UsuarioActual.CveEmpresa, DateTime.Now) Then - ' ErrorCancelar = True - ' End If - ' End If - ' End If - ' End If - ' Catch ex As Exception - ' ErrorCancelar = True - ' OnError("Ocurrió un error al cancelar el IE", ex) - ' End Try - - ' If Not ErrorCancelar Then - ' Banc.Commit() - ' If ObjAC IsNot Nothing Then ObjAC.Commit() - - ' Dim Msg As New StringBuilder - ' Msg.Append("El movimiento bancario quedó cancelado exitosamente.") - - ' If IdPolizaNueva > 0 Then Msg.AppendFormat("

Ver Póliza de cancelación", IdPolizaNueva) - ' Alert(Msg.ToString, TipoMensaje.MsgInformacion) - ' Else - ' Banc.RollBack() - ' If ObjAC IsNot Nothing Then ObjAC.RollBack() - ' Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError) - ' End If - - ' If ObjAC IsNot Nothing Then ObjAC.Dispose() - ' Banc.Dispose() - ' Return ErrorCancelar - 'End Function - - Private Sub BtnVincularIntermediario_Click(sender As Object, e As EventArgs) Handles BtnVincularIntermediario.Click - RegistraScript("$('#ModalVincularIntermediario').modal('hide')", "hidemodal") - End Sub -#End Region - - Protected Sub BtnCambiaTipoMoneda_Click(sender As Object, e As EventArgs) CambiaTipoMoneda() End Sub @@ -3199,11 +2885,12 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(22).Visible = True GvCxC.Columns(23).Visible = True GvCxC.Columns(24).Visible = True - 'GvCxC.Columns(25).Visible = True + GvCxC.Columns(25).Visible = True 'anticipos GvCxC.Columns(26).Visible = False GvCxC.Columns(27).Visible = False + Else GvCxC.Columns(4).Visible = True GvCxC.Columns(5).Visible = True