From 60243c001e6ae224ae1fc89ec367db4a1778e597 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 13 Feb 2025 09:23:27 -0700 Subject: [PATCH 1/7] -- mejora --- Ventas/Ventas.aspx.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9b6d4ebe3..a0f6bc0da 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2876,6 +2876,7 @@ Partial Class Ventas TmpDT = ObjCGame.DtResultados TmpDT.Columns.Add("Costo", GetType(Decimal)) TmpDT.Columns("Costo").DefaultValue = 0D + If Not TmpDT.Columns.Contains("NumeroParte") Then TmpDT.Columns.Add("NumeroParte", GetType(String)) GvPS.DataBind() End If From 48ea8500007d0bab354b32a7da89fec7e7a13024 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 13 Feb 2025 11:41:24 -0700 Subject: [PATCH 2/7] =?UTF-8?q?--=20=20activaci=C3=B3n=20de=20tipo=20de=20?= =?UTF-8?q?compra=20(16)=20apoyo=20sin=20virtuales?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inventarios/RecepcionAlmacen.aspx.vb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index bd1291701..d6dfc008a 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -1076,7 +1076,9 @@ Partial Class Inventarios_RecepcionAlmacen If TipoMovimiento = 3 Then CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "21", CveTipoCompra) Else - CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "22", CveTipoCompra) + Dim tTipoAlm As String = "22" + If CveTipoCompra = 16 Then tTipoAlm = "22,1,24" ' apoyos, "acumuladores sin virtual" o "virtual solo" + CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, tTipoAlm, CveTipoCompra) End If Else @@ -1112,8 +1114,8 @@ Partial Class Inventarios_RecepcionAlmacen DivVirtualAdvertencia.Visible = False End If - 'SI LA COMPRA ES DE TIPO "APOYO LOGISTICO" NO DEBE GENERAR VIRTUAL - If Not SumarImporteUsados AndAlso CveTipoCompra = 9 Then + 'SI LA COMPRA ES DE TIPO "APOYO LOGISTICO" NO DEBE GENERAR VIRTUAL (9) y apoyo sin virtual (16) + If Not SumarImporteUsados AndAlso CveTipoCompra.Contiene(9, 16) Then RealizarMovimientoVirtual = False DivVirtualAdvertencia.Visible = False End If From 3a1b200d15a5322beecbbf76979c004efde30f06 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 13 Feb 2025 14:41:00 -0700 Subject: [PATCH 3/7] --FIX aplicacion de NC/Ant en dolares --- App_Code/ClsPaginas.vb | 2 ++ App_Code/Modelos.vb | 37 ++++++++++++++++++++----------------- Ventas/Ventas.aspx.vb | 3 +-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 38cec4aa4..2a408ff3c 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -7742,6 +7742,8 @@ Public Class ClsPaginas 'Dim urlHost As String = "http://localhost:2202/" If EsProduccion Then urlHost = "http://192.200.113.178:6599/" + Else + urlHost = "http://localhost:2202/" End If 'SITIO DE PRUEBA EN IIS Dim Url As Uri = New Uri(String.Format("{0}{1}", urlHost, Opcion)) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b71c4f47d..b8dd69b13 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3548,32 +3548,35 @@ Namespace Modelos If Not ErrorPrepoliza AndAlso ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.EsNCAmortizacion AndAlso ObjFactura.TipoDocto.Contiene("Egs") AndAlso ObjFactura.DtAnticiposAplicados IsNot Nothing Then - For Each row2 As DataRow In ObjFactura.DtAnticiposAplicados.Rows - If row2("CveConceptoContable").ToString().ToEntero() = 3 Then - CveIEAnticipo = row2("CveIE").ToString().ToEntero() + For Each RowAnticipo As DataRow In ObjFactura.DtAnticiposAplicados.Rows + If RowAnticipo("Tipo").ToString() = "Ant" AndAlso RowAnticipo("CveConceptoContable").ToString().ToEntero().Contiene(3, 295) Then - importeMovimiento = row2("Importe").ToString().ToDecimal() '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) + importeMovimiento = RowAnticipo("Importe").ToString().ToDecimal() Dim ImporteAnticipo As Decimal = importeMovimiento - Dim CveMonedaAnticipo As Integer = row2("CveMoneda").ToString().ToEntero() - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + Dim CveMonedaAnticipo As Integer = RowAnticipo("CveMoneda").ToString().ToEntero() If ObjFactura.CveTipoAmortizacionAnticipo = 2 Then - Dim DescuentosAnticipos As Decimal = row2("Descuentos").ToString().ToDecimal - ImporteAnticipo = ImporteAnticipo / (row2("TotalAnticipo").ToString().ToDecimal - DescuentosAnticipos) * row2("SubTotalAnticipo").ToString().ToDecimal + Dim DescuentosAnticipos As Decimal = RowAnticipo("Descuentos").ToString().ToDecimal + ImporteAnticipo = ImporteAnticipo / (RowAnticipo("TotalAnticipo").ToString().ToDecimal - DescuentosAnticipos) * RowAnticipo("SubTotalAnticipo").ToString().ToDecimal ImporteAnticipo = ImporteAnticipo.RoundSQL(2) End If - Dim Importe11MX As Decimal = ImporteAnticipo - CveSubProyectoContabilizar = CveSubProyectoVenta + Dim PagoAnt As New ClsPaginas.VentaPago + PagoAnt.ImportePagoVenta = 0 'DEBE SER 0 PORQUE EL PAGO A LA FACTURA YA FUE APLICADO PREVIAMENTE + PagoAnt.ImportePago = ImporteAnticipo + PagoAnt.CveIE = RowAnticipo("CveIE").ToString().ToEntero() + PagoAnt.CveMonedaPago = CveMonedaAnticipo + PagoAnt.TipoPago = "A" + PagoAnt.Fecha = ObjFactura.Fecha + PagoAnt.CveVentaAmortizacion = RowAnticipo("CveVenta").ToString().ToEntero() + PagoAnt.TCPago = RowAnticipo("TipoCambioPago").ToString().ToDecimal() + PagoAnt.AplicaTraslado = False + PagoAnt.Referencia = Referencia + PagoAnt.AplicaConceptoImpuestoPendiente = False + + ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, PagoAnt, ObjFactura.CvePrePoliza, ObjConta) - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Importe11MX, 11, Referencia, Concepto, CveVenta:=row2("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - Exit For - End If - End If End If Next diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9b6d4ebe3..d4f2051a7 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -17638,7 +17638,6 @@ Partial Class Ventas Dim Folio = GvRowAnticipo.DataKey("Folio") Dim Tipo = GvRowAnticipo.DataKey("Tipo") - DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo) End If @@ -17768,7 +17767,7 @@ Partial Class Ventas Select Case gvr.DataKey("CveConceptoContable").ToString() Case "3", "295" - If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlMoneda.SelectedValue.ToEntero() = 1 Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim ImporteNC As Decimal = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal Dim RespNC = GenerarNC(ImporteNC, DdlVendedor.SelectedValue.ToEntero(), Me.VentaActual, gvr, ObjVenta) From baaec697d95b704f60e5a05542ab012b3813c792 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 13 Feb 2025 16:15:49 -0700 Subject: [PATCH 4/7] -- mejora BDH --- Inventarios/RecepcionAlmacen.aspx.vb | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index d6dfc008a..cb015e6f0 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -581,7 +581,7 @@ Partial Class Inventarios_RecepcionAlmacen ''' ''' ''' Parametro sin espacios y separado por comas ["1,2,3,21"] - Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1) + Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1, Optional RecargaGrid As Boolean = True) Dim StrAlmacenes As String = "" Dim Strtmp As String = If(TipoMovimiento = 2, ",21", "") ' cuando es solicitud de devolución de almacen ,considerar los almacenes de dev prov StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,15,14,19" & Strtmp)}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}" @@ -597,25 +597,20 @@ Partial Class Inventarios_RecepcionAlmacen DdlAlmacen.DataBind() If UsuarioActual.CveAlmacen > 0 Then DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) - RecargaporAlmacenes() + If RecargaGrid Then RecargaporAlmacenes() End If UpGenerales.Update() End Sub - - Private Sub RecargaporAlmacenes() CveTipoAlmacen = -1 If DdlAlmacen.SelectedValue <> "-1" Then Dim drr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimero("") If drr IsNot Nothing Then - CveTipoAlmacen = drr("CveTipoAlmacen").ToString.ToEntero - End If - CargaGVInv() 'For Each Gvr As GridViewRow In GvInv.Rows ' If Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue = "-1" Then @@ -1078,7 +1073,7 @@ Partial Class Inventarios_RecepcionAlmacen Else Dim tTipoAlm As String = "22" If CveTipoCompra = 16 Then tTipoAlm = "22,1,24" ' apoyos, "acumuladores sin virtual" o "virtual solo" - CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, tTipoAlm, CveTipoCompra) + CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, tTipoAlm, CveTipoCompra, RecargaGrid:=False) End If Else @@ -1098,11 +1093,7 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - - - CveSubProyecto = DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero - CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero 'SI ES MOTOBATERIA NO GENERA MOVIMIENTO VIRTUAL @@ -1449,6 +1440,7 @@ Partial Class Inventarios_RecepcionAlmacen If UsuarioActual.CveEmpresa = 119 Then DtInv = DtInv.FiltraParametros("", "PS") End If + If Not DtInv.Columns.Contains("Consec") Then DtInv.Columns.Add("Consec", GetType(Integer)) Dim AplicaSeccion, AplicaLote, AplicaCaducidad, AplicaSerie As Boolean If DtInv IsNot Nothing AndAlso DtInv.Rows.Count > 0 Then @@ -1746,7 +1738,7 @@ Partial Class Inventarios_RecepcionAlmacen Private Sub CreaDtDetalle() If DtDatosDetalle Is Nothing Then DtDatosDetalle = New DataTable - DtDatosDetalle.Columns.Add("Consec", GetType(Integer)) + If Not DtDatosDetalle.Columns.Contains("Consec") Then DtDatosDetalle.Columns.Add("Consec", GetType(Integer)) DtDatosDetalle.Columns.Add("ConsecId", GetType(Integer)) DtDatosDetalle.Columns.Add("CvePS", GetType(Integer)) DtDatosDetalle.Columns.Add("CveUM", GetType(Integer)) @@ -1998,7 +1990,7 @@ Partial Class Inventarios_RecepcionAlmacen Private Sub CreaDtLoteDetalle() If DtDatosLoteDetalle Is Nothing Then DtDatosLoteDetalle = New DataTable - DtDatosLoteDetalle.Columns.Add("Consec", GetType(Integer)) + If Not DtDatosLoteDetalle.Columns.Contains("Consec") Then DtDatosLoteDetalle.Columns.Add("Consec", GetType(Integer)) DtDatosLoteDetalle.Columns.Add("ConsecId", GetType(Integer)) DtDatosLoteDetalle.Columns.Add("Cantidad", GetType(Decimal)) DtDatosLoteDetalle.Columns.Add("CvePS", GetType(Integer)) From 332218214a85628b73ad720a38534189969f71d6 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 13 Feb 2025 20:59:38 -0700 Subject: [PATCH 5/7] =?UTF-8?q?--6=20Facturaci=C3=B3n=20Global=20Ferretera?= =?UTF-8?q?,=2050,=20optimizaci=C3=B3n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsInventarios.vb | 20 +++++++++++ App_Code/Modelos.vb | 70 ++++++++++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 7 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 68274613d..4917e8d32 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6426,6 +6426,26 @@ Public Class ClsInventarios Return Retorno End Function + + Public Function GetVentasRemisionesInventario(Ventas As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_VentasRemisionesInventarioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Ventas", SqlDbType.VarChar).Value = Ventas + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el inventario de las remisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region " IDisposable Support " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b8dd69b13..ef33bccdd 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4521,7 +4521,7 @@ Namespace Modelos Private Function GuardarVentaInventarios(ByRef Resp As MMensajeFactura, ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean Dim OcurrioError As Boolean = False - If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then + If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then If factura.GenerarSalidaAlmacen AndAlso factura.CveAlmacen > 0 AndAlso DtInventario.Rows.Count > 0 Then Dim CveMovimientoInventario As Integer = GenerarMovimientoAlmacenServicioDomicilio(ObjInventario, factura, factura.DtInventario, factura.CveAlmacen, 3, factura.CveMoneda, factura.CveVenta, "Modelos/SA", MovimientoPrePoliza:=True, ObjConta:=ObjConta) @@ -4549,13 +4549,38 @@ Namespace Modelos 'End If If RemisionesLista IsNot Nothing AndAlso factura.TipoDocto = "Ing" AndAlso RemisionesLista.Count > 0 Then - For Each CveRemision As Integer In RemisionesLista - 'El almacen general es el Primer Almacen de Material en la Sucursal - If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then - OcurrioError = True - Exit For + + If factura.EsFacturaGlobal Then + Dim DtMovimientosRemisiones As DataTable = Nothing + + Dim SbRemisiones As New StringBuilder() + + For Each CveRem In RemisionesLista + SbRemisiones.AppendFormat("{0},", CveRem) + Next + + SbRemisiones.Remove(SbRemisiones.Length - 1, 1) + + If ObjInventario.GetVentasRemisionesInventario(SbRemisiones.ToString(), UsuarioActual.CveEmpresa) Then + DtMovimientosRemisiones = ObjInventario.DtResultados.Copy() End If - Next + + If DtMovimientosRemisiones IsNot Nothing Then + If Not TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones, ObjInventario, ObjConta) Then + OcurrioError = True + End If + End If + + Else + For Each CveRemision As Integer In RemisionesLista + 'El almacen general es el Primer Almacen de Material en la Sucursal + If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then + OcurrioError = True + Exit For + End If + Next + End If + End If If factura.TipoDocto = "Rem" AndAlso factura.ServicioDomicilio Then @@ -4908,6 +4933,37 @@ Namespace Modelos End Try Return Not OcurrioError End Function + + + Private Function TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones As DataTable, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Boolean + Dim OcurrioError As Boolean = False + Try + Dim DtMovimientos As DataTable = DtMovimientosRemisiones.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveAlmacen"}) + + For Each RowMovto As DataRow In DtMovimientos.Rows + Dim CveAlmacenParaSalida As Integer = RowMovto("CveAlmacen").ToString().ToEntero() + Dim CveConceptoSalidaAlmacen As Integer = 40 + + Dim MovDetalle As DataTable = DtMovimientosRemisiones.FiltraParametros($"CveMovimiento = {RowMovto("CveMovimiento")}") + + Dim CveMovimientoSalidaAlmacen As Integer = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenParaSalida, CveConceptoSalidaAlmacen, Me.CveMoneda, Me.CveVenta, AplicaMovimientoDetalleEntrada:=True, MovimientoPrePoliza:=True, ObjConta:=ObjConta) + Dim GeneroMovimientoAlmacen = CveMovimientoSalidaAlmacen > 0 + + If Not GeneroMovimientoAlmacen Then + OcurrioError = True + Exit For + End If + + Next + + Catch ex As Exception + OcurrioError = True + OnError("Ocurrió un error al realizar el traspaso", ex) + End Try + Return Not OcurrioError + End Function + + Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = True, Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional CveAlmacenDestino As Integer = -1) As Integer From 9a5142e5f2eb086a61aaa42bff72f4aaf77ea541 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 14 Feb 2025 09:00:16 -0700 Subject: [PATCH 6/7] eFacturas --- Compras/eFacturas.aspx | 394 ++++++++++++++++++- Compras/eFacturas.aspx.vb | 804 +++++++++++++++++++++++++++++++++++++- 2 files changed, 1166 insertions(+), 32 deletions(-) diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 0e84a3b80..0e1e68e12 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -265,10 +265,10 @@
- Caja Chica - Viáticos + Viáticos + Deudores
@@ -295,7 +295,7 @@
- +
@@ -334,6 +334,7 @@
+ @@ -352,7 +353,7 @@ -
+
@@ -362,7 +363,87 @@
- +
+
+
+ + +
+ +
+
+ +
+ + + + + +
+ + + + + + + + + + + + Fecha + + + + + + Folio + + + + + + Saldo + +   + + + + + Saldo Abonar + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
@@ -827,6 +908,134 @@ + + <%--PRORRATE INICIO--%> + + + + <%--PRORRATEO FIN--%> + + - - + @@ -1552,9 +1760,173 @@ $('#BtnCargaCompraComplementoTraslado').click(); } - //function VinculacionManual(v) { - // $get("HdnCveIE").value = v; - // $('#BtnVincularManualmente').click(); - //} + + function CambioTipoMoneda() { + + + var chkPesosBancos = $get("ChkPagarPesos"); + var chkDolaresBancos = $get("ChkPagarDolares"); + + AjustaTextboxDeudores(); + if (chkPesosBancos) { + CambiaPesosDolares() + } else if (chkDolaresBancos) { + CambiaDolaresPesos() + } else { + CambiaPesosDolares() + } + + } + + + // CAMBIO DOLARES-PESOS + function CambiaPesosDolares() { + debugger; + if ($("#LbImporteME").length) { + + if ($("#TxtTipoCambio").length) { + $get('LbImporteME').value = '$ ' + FormatoNumero(ToDouble(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTipoCambio').value)), 2) + ' USD'; + } else { + $get('LbImporteME').value = ''; + } + + } + } + + function CambiaDolaresPesos() { + debugger; + if ($("#LbImporteMN").length) { + + if ($("#TxtTipoCambio").length) { + $get('LbImporteMN').value = '$ ' + FormatoNumero(ToDouble(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTipoCambio').value)), 2) + ' MXN'; + } else { + $get('LbImporteMN').value = '' + } + + } + } + + function AjustaTextboxDeudores() { + + if (!(($("#C_RBLContado_2") && $("#C_RBLContado_2").is(':checked')) || ($("#C_RBLContado_3") && $("#C_RBLContado_3").is(':checked')) || ($("#C_RBLContado_4") && $("#C_RBLContado_4").is(':checked')))) { + return false; + } + + var totalPoints = 0.00; + var TC = 1.00; + + if ($get("TxtTipoCambio") && ToDouble($get("TxtTipoCambio").value) > 0) { + TC = ToDouble($get("TxtTipoCambio").value); + } + + $('input[name*=TxtSaldoDeudor]').each(function () { + totalPoints += ToDouble($(this).val()); + + if ($("#LbImporteME").length) { + if ($("#TxtTipoCambio").length) { + $(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val(FormatoNumero(ToDouble($(this).val()) / TC, 2)); + + } else { + $(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val('0.00'); + } + } else if ($("#LbImporteMN").length) { + + if ($("#TxtTipoCambio").length) { + $(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val(FormatoNumero(ToDouble($(this).val()) * TC, 2)); + } else { + $(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val('0.00'); + } + } + + }); + $get('TxtImporte').value = FormatoNumero(totalPoints, 2); + + var chkPesosBancos = $get("ChkPagarPesos"); + var chkDolaresBancos = $get("ChkPagarDolares"); + + if (chkPesosBancos) { + CambiaPesosDolares() + } else if (chkDolaresBancos) { + CambiaDolaresPesos() + } else { + CambiaPesosDolares() + } + } + + // ajuste Ingresos x comprobar y Deudores + function ClickDeudorChk(Chk, Obj, total, saldo) { + + if ($("#" + Chk.id).is(":checked")) { + $('#' + Obj).val(saldo); + }else{ + $('#' + Obj).val(""); + } + + + + /* + total = ToDouble(ToDouble(total).toFixed(2)); + saldo = ToDouble(ToDouble(saldo).toFixed(2)); + var totalTC = total; + var TC = 1.00; + if ($get("TxtTipoCambio") && ToDouble($get("TxtTipoCambio").value) > 0) { + + TC = ToDouble($get("TxtTipoCambio").value); + total = total * TC; + } + + + if ($("#" + Chk.id).is(":checked")) { + $('#' + Obj).attr('disabled', false); + if (ToDouble($get('TxtImporte').value) != total) { + + if ((ToDouble($get('TxtImporte').value) + saldo) > total) { + $('#' + Obj).val(saldo - (ToDouble($get('TxtImporte').value) + saldo - total)); + $get('TxtImporte').value = (total / TC).toFixed(2) + } + else { + if (total > saldo) { + $('#' + Obj).val(saldo); + } + + else { + $('#' + Obj).val(total); + } + + if (ToDouble($get('TxtImporte').value) >= total) { + + $('#' + Obj).val($get(total - 'TxtImporte').value); + $get('TxtImporte').value = (total / TC).toFixed(2) + + } else { + $get('TxtImporte').value = (ToDouble($get('TxtImporte').value) + ToDouble($get(Obj).value) / TC).toFixed(2); + } + } + + } + else { + $('#' + Obj).val(0); + } + + } + + else { + $('#' + Obj).attr('disabled', true); + if (ToDouble($get(Obj).value) > 0) { + $get('TxtImporte').value = ToDouble(ToDouble($get('TxtImporte').value) - ToDouble($get(Obj).value)).toFixed(2); + if ($get('TxtImporte').value < 0) { + $get('TxtImporte').value = 0 + } + } + $('#' + Obj).val(0); + } + + $('#' + Obj).val(ToDouble($get(Obj).value).toFixed(2)); + CambioTipoMoneda(); + */ + } + + + diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 150fa2d97..d1eb38b6a 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -25,6 +25,7 @@ Imports SharpCompress.Archive.Rar Imports SharpCompress.Common Imports SharpCompress.Reader Imports Telerik.Web.UI +Imports System.Data.SqlClient 'Imports Telerik.Web.UI @@ -756,13 +757,24 @@ Partial Class Compras_eFacturas End Set End Property + Private Property CveMonedaFiltros As Integer + Get + If ViewState("CveMonedaFiltros") Is Nothing Then + ViewState("CveMonedaFiltros") = -1 + End If + Return ViewState("CveMonedaFiltros").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMonedaFiltros") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then - 'EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) + EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) ChecandoCorreo = False @@ -816,12 +828,16 @@ Partial Class Compras_eFacturas CargaPersonalViaticos() CargaDdlRetIVA() CargaDdlRetISR() + CargaDeudores() End If Dim LblSubProyectoTemp As New Label CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyectoTemp, "Seleccione") LblSubProyecto.InnerText = $"{LblSubProyectoTemp.Text}:" + + InicializaDTProrrateoGasolina() + End If removeasincevent() End Sub @@ -1146,6 +1162,8 @@ Partial Class Compras_eFacturas End If End If + e.Row.FCCheckBox("chkRegistraFactura").Attributes.Add("onclick", "ChkRegsitraFacturas()") + End If End Sub Protected Sub GvDatos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvD.RowUpdating @@ -5176,6 +5194,23 @@ Partial Class Compras_eFacturas End Property + Private Property DtDeudoresDetalle As DataTable + Get + Return CType(ViewState("DtDeudoresDetalle"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDeudoresDetalle") = value + End Set + End Property + + Private Property DtDeudores As DataTable + Get + Return CType(ViewState("DtDeudores"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDeudores") = value + End Set + End Property Private Sub CargaClasificacionesComprobaciones() @@ -5268,7 +5303,7 @@ Partial Class Compras_eFacturas DivPersonalReembolso.Visible = False DivCuentaCajaChicaReembolso.Visible = False - + DivDeudores.Visible = False Select Case RBLContado.SelectedValue @@ -5280,6 +5315,10 @@ Partial Class Compras_eFacturas DivCuentaCajaChicaReembolso.Visible = True RfvTxtNumeroReembolso.Enabled = True + Case "4" ' Deudores + DivDeudores.Visible = True + RfvTxtNumeroReembolso.Enabled = False + End Select UpRegistroFacturas.Update() @@ -5314,8 +5353,64 @@ Partial Class Compras_eFacturas DdlRetISRConcepto.Items.Insert(1, New ListItem("Resico", "3")) End Sub + Protected Sub CargaDeudores(Optional CveMoneda As Integer = 1) + Dim Deudores As New ClsMovimientos + DdlDeudor.Items.Clear() + If Deudores.GetDeudoresSaldos2(-1, UsuarioActual.CveEmpresa) Then + DtDeudores = Deudores.DtResultados.FiltraParametros($"CveProveedor > 0 AND Saldo > 0 AND CveMoneda = {CveMoneda}") + DdlDeudor.DataSource = DtDeudores + DdlDeudor.DataBind() + DdlDeudor.Items.Insert(0, New ListItem("Seleccione Deudor", "-1")) + UpDatos.Update() + CambieDeudor() + End If + + + Deudores.Dispose() + End Sub + Private Sub DdlDeudor_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDeudor.SelectedIndexChanged + CambieDeudor() + End Sub + Private Sub CambieDeudor() + Dim stringDeudor As String = DdlDeudor.SelectedItem.ToString + Dim SaldoD As Decimal = stringDeudor.Substring(stringDeudor.IndexOf("$") + 1, stringDeudor.Length - (stringDeudor.IndexOf("$") + 1)).ToDecimal + + If DdlDeudor.SelectedValue.ToEntero > 0 Then + Dim Deudores As New ClsMovimientos + Dim OpcionSaldo As Integer = 1 + + If Deudores.GetDeudoresSaldosDetalle(DdlDeudor.SelectedValue.ToEntero, CveMonedaFiltros, UsuarioActual.CveEmpresa) Then + DtDeudoresDetalle = Deudores.DtResultados.FiltraParametros("CveProveedor > 0 AND Saldo > 0") + GvDeudores.DataSource = DtDeudoresDetalle.FiltraParametros("CveMoneda = 1") + GvDeudores.DataBind() + End If + Deudores.Dispose() + Else + GvDeudores.DataSource = Nothing + GvDeudores.DataBind() + End If + + UpDeudores.Update() + End Sub + + Private Sub GvDeudores_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDeudores.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim total As Decimal + Dim saldo As Decimal + + saldo = e.Row.DataKey("Saldo").ToDecimal + total = 0D + + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ClickDeudorChk(this, ""{0}"", ""{1}"", ""{2}"")", e.Row.FCTextBox("TxtSaldoDeudor").ClientID, total, saldo)) + e.Row.FCTextBox("TxtSaldoDeudor").Attributes.Add("onKeyUp", "AjustaTextboxDeudores();") + e.Row.FCTextBox("LbTipoMoneda").Text = If(e.Row.DataKey("CveMoneda").ToString.ToEntero = 1, "USD", " MXN") + + Dim rv As RangeValidator = CType(e.Row.FindControl("RVSaldoDeudor"), RangeValidator) + End If + End Sub + Protected Sub DdlPersonal2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPersonalReembolso.SelectedIndexChanged ViewState("CvePersonal") = DdlPersonalReembolso.SelectedValue If DdlPersonalReembolso.SelectedValue.ToEntero > 0 Then @@ -5332,6 +5427,276 @@ Partial Class Compras_eFacturas ViewState("CveCajaChica") = DdlCuentaCajaChicaReembolso.SelectedValue End Sub +#End Region + + + +#Region "PRORATEO" + + + +#Region "PRORRATEO GASOLINA" + + Protected Sub LnlMostarProrateo_Click(sender As Object, e As EventArgs) + + 'InicializaDTProrrateoGasolina() + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoProrrateoGasolina,) + GvProrrateoGasolina.Columns(0).HeaderText = LblSubProyectoProrrateoGasolina.Text + LblRiruloProrrareo.Text = $"Prorratear por { LblSubProyectoProrrateoGasolina.Text}" + + DdlSubProyectoProrrateoGasolina.Items.Clear() + DdlSubProyectoProrrateoGasolina.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveProyecto:=-1)) + DdlSubProyectoProrrateoGasolina.DataBind() + DdlSubProyectoProrrateoGasolina.Items.Insert(0, New ListItem("Todos", "-1")) + + 'LblTotalProrrateoGasolina.Text = TxtTotal.Text + + 'CargaProrratePS(-1) + + RegistraScript("$('#DVModalProrrateoGasolina').modal();") + UpModalProrrateoGasolina.Update() + UpProrratearTitulo.Update() + + 'DdlPS.txtText.Value = DdlPS.txtText.Value + 'DdlPS.txtValue.Value = DdlPS.txtValue.Value + 'UpRegistroFacturas.Update() + + End Sub + Property DTProrrateoTmp As DataTable + Get + If ViewState("DTProrrateoTmp") Is Nothing Then + ViewState("DTProrrateoTmp") = New DataTable + End If + Return DirectCast(ViewState("DTProrrateoTmp"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTProrrateoTmp") = value + End Set + End Property + + Property DTProrrateo As DataTable + Get + If ViewState("DTProrrateo") Is Nothing Then + ViewState("DTProrrateo") = New DataTable + End If + Return DirectCast(ViewState("DTProrrateo"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTProrrateo") = value + End Set + End Property + + Property ProrratearFacturas As Boolean + Get + If ViewState("ProrratearFacturas") Is Nothing Then + ViewState("ProrratearFacturas") = False + End If + Return Boolean.Parse(ViewState("ProrratearFacturas").ToString) + End Get + Set(value As Boolean) + ViewState("ProrratearFacturas") = value + End Set + End Property + + Private Sub InicializaDTProrrateoGasolina() + + Dim TmpDTProrrateoGasolina As New DataTable + TmpDTProrrateoGasolina.Columns.Add("CvePS", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("SubProyecto", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("SubTotal", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("IVA", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetIVA", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetISR", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("Total", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("PorcentajeIVA", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetISRPorcentaje", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetIVAPorcentaje", GetType(Decimal)) + + TmpDTProrrateoGasolina.Columns.Add("CveUM", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("UM", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("Clasificacion", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("PS", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("Porcentaje", GetType(Decimal)) + + DTProrrateoTmp = TmpDTProrrateoGasolina + + End Sub + + Protected Sub LnkProrrateoGasolina_Click(sender As Object, e As EventArgs) + + + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoProrrateoGasolina,) + GvProrrateoGasolina.Columns(0).HeaderText = LblSubProyectoProrrateoGasolina.Text + LblRiruloProrrareo.Text = $"Prorratear por { LblSubProyectoProrrateoGasolina.Text}" + + DdlSubProyectoProrrateoGasolina.Items.Clear() + DdlSubProyectoProrrateoGasolina.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveProyecto:=-1)) + DdlSubProyectoProrrateoGasolina.DataBind() + DdlSubProyectoProrrateoGasolina.Items.Insert(0, New ListItem("Todos", "-1")) + + RegistraScript("$('#DVModalProrrateoGasolina').modal();") + UpModalProrrateoGasolina.Update() + UpProrratearTitulo.Update() + + End Sub + + + + Private Sub GvProrrateoGasolinaBind() + GvProrrateoGasolina.DataSource = DTProrrateoTmp + GvProrrateoGasolina.DataBind() + UpModalProrrateoGasolina.Update() + End Sub + + Protected Sub LnkEliminarProrrateoGasolina_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + DTProrrateoTmp.Rows.RemoveAt(GvRow.RowIndex) + DTProrrateoTmp.AcceptChanges() + ProrateoCalculaRestante() + GvProrrateoGasolinaBind() + + End Sub + + + + Protected Sub LnkAgregarProrrateoGasolina_Click(sender As Object, e As EventArgs) + + Dim CvePs As Integer = DdlPS.SelectedValue.ToEntero + + If Not CvePs > 0 Then + Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim PsRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePs).FiltroPrimero("") + + If PsRow Is Nothing Then + Alert("No se encontro el producto", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveUM As Integer = PsRow("CveUM").ToString.ToEntero + Dim UM As String = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("UnidadMedida", $" CveUnidadMedida = {CveUM} ") + + Dim CveClasificacion As Integer = PsRow("CveClasificacion").ToString.ToEntero + Dim Clasificacion As String = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $" CveClasificacion = {CveClasificacion} ") + + + If DdlSubProyectoProrrateoGasolina.SelectedValue.ToEntero > 0 Then + AgregarProrrateoGasolina(DdlSubProyectoProrrateoGasolina.SelectedValue.ToEntero, DdlSubProyectoProrrateoGasolina.SelectedItem.Text, CvePs, CveUM, UM, CveClasificacion, Clasificacion) + Else + DTProrrateoTmp.Rows.Clear() + + For Each item As ListItem In DdlSubProyectoProrrateoGasolina.Items + If item.Value.ToEntero > 0 Then + AgregarProrrateoGasolina(item.Value.ToEntero, item.Text, CvePs, CveUM, UM, CveClasificacion, Clasificacion) + End If + Next + End If + + TxtPrecioProrrateoGasolina.Text = "" + DdlSubProyectoProrrateoGasolina.SelectedValueExist(-1) + UpModalProrrateoGasolina.Update() + + End Sub + + + Private Sub AgregarProrrateoGasolina(CveSubProyecto As Integer, SubProyecto As String, CvePS As Integer, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String) + + ''' este prco3eso compratira todo esto se debe de llevar a la genracion de la factura por porcentaje + + Dim SubTotalOriginal As Decimal = 1 + Dim IVAOriginal As Decimal = 0D 'TxtIVA.Text.ToDecimal + Dim RetISROriginal As Decimal = 0D 'TxtRetISR.Text.ToDecimal + Dim RetIVAOriginal As Decimal = 0D 'TxtRetIVA.Text.ToDecimal + Dim TotalOriginal As Decimal = 1 + + Dim totalParcialDeseado As Decimal = TxtPrecioProrrateoGasolina.Text.ToDecimal + Dim PorcentajeCalculado As Decimal = totalParcialDeseado / TotalOriginal + + Dim subtotalParcial As Decimal = SubTotalOriginal * PorcentajeCalculado + Dim ivaParcial As Decimal = IVAOriginal * PorcentajeCalculado + Dim retIsrParcial As Decimal = RetISROriginal * PorcentajeCalculado + Dim retIvaParcial As Decimal = RetIVAOriginal * PorcentajeCalculado + + Dim nRow As DataRow = DTProrrateoTmp.NewRow + + nRow("CvePS") = DdlPS.SelectedValue.ToEntero + nRow("CveSubProyecto") = CveSubProyecto + nRow("SubProyecto") = SubProyecto + + 'If CveFactura > 0 Then + nRow("IVA") = ivaParcial.RoundSQL(4) + nRow("RetIVA") = retIvaParcial.RoundSQL(4) + nRow("RetISR") = retIsrParcial.RoundSQL(4) + 'Else + 'nRow("IVA") = (ivaParcial / subtotalParcial).RoundSQL(4) + 'nRow("RetIVA") = (retIvaParcial / subtotalParcial).RoundSQL(4) + 'nRow("RetISR") = (retIsrParcial / subtotalParcial).RoundSQL(4) + 'End If + + nRow("SubTotal") = subtotalParcial.RoundSQL(4) + + nRow("Total") = totalParcialDeseado.RoundSQL(4) + nRow("PorcentajeIVA") = (ivaParcial / subtotalParcial).RoundSQL(4) + nRow("Porcentaje") = TxtPrecioProrrateoGasolina.Text.ToDecimal '((totalParcialDeseado.RoundSQL(4) * 100) / TotalOriginal).RoundSQL(2) + + 'nRow("RetIVAPorcentaje") = (retIvaParcial / subtotalParcial).RoundSQL(4) + 'nRow("RetISRPorcentaje") = (retIsrParcial / subtotalParcial).RoundSQL(4) + + nRow("CveUM") = CveUM + nRow("UM") = UM + nRow("CveClasificacion") = CveClasificacion + nRow("Clasificacion") = Clasificacion + nRow("PS") = DdlPS.txtText.Value + + DTProrrateoTmp.Rows.Add(nRow) + + ProrateoCalculaRestante() + GvProrrateoGasolinaBind() + End Sub + + + Function ProrateoCalculaRestante(Optional MostrarMensaje As Boolean = False) As Boolean + '''Esto no aplica por que es por factura + + Dim Acumulado As Decimal = DTProrrateoTmp.SUM("Porcentaje").RoundSQL(2) + Dim Total As Decimal = 100 'TxtTotal.Text.ToDecimal.RoundSQL(2) + Dim Respuesta As Boolean = False + + LblRestoProrrateoGasolina.Text = (Total - Acumulado).ToString("###,###,###.00") + + If Acumulado = Total Then + Respuesta = True + Else + Respuesta = False + If MostrarMensaje Then + + If Acumulado <> Total Then + Alert($"El porcentaje prorrateado es diferente de 100%, Diferencia: {(Acumulado - Total).Abs()}, Prorrateado:{Acumulado.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia) + End If + + End If + End If + + Return Respuesta + + End Function + + Protected Sub BtnGuardarProrrateoGasolina_Click(sender As Object, e As EventArgs) + If Not ProrateoCalculaRestante(True) Then + Exit Sub + End If + DTProrrateo = DTProrrateoTmp + RegistraScript("$('#DVModalProrrateoGasolina').modal('hide');") + End Sub + + +#End Region + #End Region Protected Sub LnkRegistarFactura_Click(sender As Object, e As EventArgs) @@ -5353,9 +5718,52 @@ Partial Class Compras_eFacturas Exit Sub End If + + If RBLContado.SelectedValue.ToEntero = 4 Then + If Not validaPagoDeudores() Then + Exit Sub + End If + End If + + Dim Objcompras As New ClsCompras + Objcompras.IniciaTransacSQL() + + + Dim DTPagosDeudores As New DataTable + + DTPagosDeudores.Columns.Add("CveIE", GetType(Decimal)) + DTPagosDeudores.Columns.Add("Saldo", GetType(Decimal)) + DTPagosDeudores.Columns.Add("RazonSocial", GetType(String)) + DTPagosDeudores.Columns.Add("Folio", GetType(String)) + DTPagosDeudores.Columns.Add("CveProveedor", GetType(Integer)) + DTPagosDeudores.Columns.Add("SaldoVentas", GetType(Decimal)) + DTPagosDeudores.Columns.Add("CveMoneda", GetType(Integer)) + DTPagosDeudores.Columns.Add("TCPago", GetType(Decimal)) + DTPagosDeudores.Columns.Add("ImportePago", GetType(Decimal)) + + For Each rw As GridViewRow In GvDeudores.Rows + If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then + + Dim nRow As DataRow = DTPagosDeudores.NewRow + nRow("CveIE") = rw.DataKey("CveIE").ToEntero + nRow("CveMoneda") = rw.DataKey("CveMoneda").ToEntero + nRow("ImportePago") = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal + nRow("TCPago") = rw.DataKey("TipoCambio").ToDecimal + nRow("CveProveedor") = DdlDeudor.SelectedValue.ToEntero + nRow("Saldo") = rw.DataKey("Saldo").ToDecimal + + DTPagosDeudores.Rows.Add(nRow) + + End If + Next + For Each GvRow As GridViewRow In GvD.Rows + If GvRow.FCCheckBox("chkRegistraFactura").Checked Then + Dim TotalFactura As Decimal = GvRow.DataKey("Total").ToDecimal + Dim SaldoFactura As Decimal = TotalFactura + Dim CFDIXmlPath As String = $"{UsuarioActual.Empresa.Ruta}Compras\{GvRow.DataKey("RFCDe")}\{GvRow.DataKey("XML")}" If Not File.Exists(CFDIXmlPath) Then ErrorProceso = True @@ -5376,35 +5784,295 @@ Partial Class Compras_eFacturas Dim CvePersonal As Integer = -1 'DdlPersonalReembolso.SelectedValue.ToEntero Dim CveCajachica As Integer = -1 'DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero - If RBLContado.SelectedValue.ToEntero = 6 Then + If RBLContado.SelectedValue.ToEntero = 6 Then 'Caja Chica CveCajachica = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero - Else + ElseIf RBLContado.SelectedValue.ToEntero = 2 Then ' viaticos CvePersonal = DdlPersonalReembolso.SelectedValue.ToEntero + ElseIf RBLContado.SelectedValue.ToEntero = 4 Then ' deudores + End If - CompraActual.ConfiguraRegistroRapidoReembolso(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal, - DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text) - If CompraActual.AddCompra() Then - Contador = Contador + 1 + + + If CompraActual.ConfiguraRegistroCompra(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal, + DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text, + DTProrrateo:=DTProrrateo, DTPagosDeudores:=DTPagosDeudores) Then + If CompraActual.AddCompra(Objcompras.IniciaTransacSQL()) Then + Contador = Contador + 1 + Else + ErrorProceso = True + ErrorProcesoStr = CompraActual.MensajeError + Exit For + End If Else ErrorProceso = True ErrorProcesoStr = CompraActual.MensajeError Exit For End If + + If RBLContado.SelectedValue.ToEntero = 4 Then 'Deudores + Dim CompraActualPagar = New Compra + If Objcompras.GetCompras(CompraActual.CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + If Objcompras.DtResultados IsNot Nothing AndAlso Objcompras.DtResultados.Rows.Count > 0 Then + Dim dr As DataRow = Objcompras.DtResultados.Rows(0) + + + CompraActualPagar.CveCompra = CompraActual.CveCompra + CompraActualPagar.CveTipoConceptoProveedor = dr("CveTipoConcepto").ToString.ToEntero + CompraActualPagar.CveProveedor = dr("CveProveedor").ToString.ToEntero + CompraActualPagar.CveMoneda = dr("CveMoneda").ToString.ToEntero + CompraActualPagar.Fecha = dr("Fecha").ToString.ToDate + CompraActualPagar.SerieFolio = dr("SerieFolio").ToString + 'CompraActualPagar.ProveedorNombre = TxtPagueseA.Text + CompraActualPagar.TC = dr("TipoCambio").ToString.ToDecimal + CompraActualPagar.Total = dr("Total").ToString.ToDecimal + CompraActualPagar.IVA = dr("IVA").ToString.ToDecimal + CompraActualPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL + CompraActualPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL + CompraActualPagar.IEPS = dr("IEPS").ToString.ToDecimal + CompraActualPagar.RetIVA = dr("RetIVA").ToString.ToDecimal + CompraActualPagar.RetISR = dr("RetISR").ToString.ToDecimal + CompraActualPagar.CveConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero + CompraActualPagar.CveConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero + CompraActualPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal + CompraActualPagar.UsuarioActual = UsuarioActual + CompraActualPagar.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero + CompraActualPagar.EsImportacion = CBool(dr("EsImportacion")) + CompraActualPagar.CompraNoDeducible = dr("NoDeducible").ToString.ToEntero + + ''Tipos de cambio + 'If Pago.CveMonedaPago = 1 AndAlso CompraActualPagar.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos + ' Pago.TCCambioMoneda = 1 / TxtTipoCambio.Text.ToDecimal + 'ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActualPagar.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES + ' Pago.TCPago = TxtTipoCambio.Text.ToDecimal + 'ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActualPagar.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' Pago.TCPago = TxtTipoCambio.Text.ToDecimal + ' Pago.TCCambioMoneda = TxtTipoCambio.Text.ToDecimal + 'End If + + Else + ErrorProceso = True + End If + Else + ErrorProceso = True + End If + + + If Not ErrorProceso Then + + Dim Pago As New CompraPago + Pago.Fecha = NowADS() + Pago.CveMonedaPago = 1 + + + Dim ObjMov As New ClsContabilidad(Objcompras.IniciaTransacSQL()) + Dim CvePlantillaPoliza As Integer = 2 + + Dim porAplicar As Decimal = DTPagosDeudores.SUM("ImportePago") + + While (SaldoFactura > 0 Or porAplicar <= 0) And (ErrorProceso = False) + + + For Each dRow As DataRow In DTPagosDeudores.Rows + + ' Dim SaldoDeudor As Decimal = dRow("Saldo").ToString.ToDecimal + Dim MaxPago As Decimal = dRow("ImportePago").ToString.ToDecimal + Dim ImportePagado As Decimal = 0D + + If MaxPago > 0 Then + + If MaxPago > SaldoFactura Then + ImportePagado = SaldoFactura + dRow("ImportePago") = (MaxPago - TotalFactura) + Else + ImportePagado = MaxPago + dRow("ImportePago") = 0 + End If + + Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Bancos/PopIECompras", CvePlantillaPoliza, ImportePagado, ImportePagado, Pago.CveMonedaPago, NowADS, "Registro factuta eFacturas", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) + + Pago.CveIE = dRow("CveIE").ToString.ToEntero + Pago.CveMonedaPago = dRow("CveMoneda").ToString.ToEntero + Pago.ImportePago = ImportePagado + Pago.TCPago = 1 + Pago.CveProveedor = DdlDeudor.SelectedValue.ToEntero + Pago.TipoPago = "DD" + If AplicaPrePolizaPagoCompra(CompraActualPagar, Pago, CvePrePoliza, ObjMov) Then + ErrorProceso = True + Exit For + End If + + End If + + SaldoFactura = (SaldoFactura - ImportePagado) + + Next + + + porAplicar = DTPagosDeudores.SUM("ImportePago") + + End While + + End If + + End If + + End If + If ErrorProceso Then + Exit For End If Next - If Not ErrorProceso Then + If ErrorProceso Then + Objcompras.RollBack() + Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia) + Else + Objcompras.Commit() + CargaDatos(NowADS()) + CambieDeudor() CargaDatos(NowADS()) If Contador > 0 Then Alert($"Se registraron {Contador} Compras") End If - Else - Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia) End If + Objcompras.Dispose() + End Sub + Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs) + 'If ChkPagarPesos.Checked Then + ' DivTipoCambio.Visible = True + ' CargaCuentas() + ' CargaOtrosIngresos(1) + ' CargaDeudores(1) + ' CargaAcreedores(1) + ' CargaVentas(1) + ' CveMonedaFiltros = 1 + ' TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") + ' TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) + + ' GvIngresos.Columns(5).Visible = True + ' GvIngresos.Columns(6).Visible = True + + ' GvDeudores.Columns(5).Visible = True + ' GvDeudores.Columns(6).Visible = True + + ' 'RVImporte.Enabled = False + ' ' RVImporte.MaximumValue = "0.00" + + ' CVImporteDolares.Enabled = True + 'Else + ' DivTipoCambio.Visible = False + ' CargaCuentas() + ' CargaOtrosIngresos(2) + ' CargaDeudores(2) + ' CargaAcreedores(2) + ' CargaVentas(2) + ' CveMonedaFiltros = 2 + ' TxtFechaDocumento.Attributes.Remove("onchange") + + ' GvIngresos.Columns(5).Visible = False + ' GvIngresos.Columns(6).Visible = False + + ' GvDeudores.Columns(5).Visible = False + ' GvDeudores.Columns(6).Visible = False + + ' 'RVImporte.Enabled = True + ' 'RVImporte.MaximumValue = LtlSaldo.Text.ToDecimal.ToString + + ' CVImporteDolares.Enabled = False + ' CVImportePesos.Enabled = False + 'End If + 'UpDatos.Update() + + 'RegistraScript("CambiaPesosDolares();") + End Sub + + Protected Sub ChkPagarDolares_CheckedChanged(sender As Object, e As EventArgs) + + 'If ChkPagarDolares.Checked Then + ' DivTipoCambio.Visible = True + ' CargaCuentas() + ' CargaOtrosIngresos(2) + ' CargaDeudores(2) + ' CargaAcreedores(2) + ' CargaVentas(2) + ' CveMonedaFiltros = 2 + ' TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") + ' TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) + + ' GvIngresos.Columns(5).Visible = True + ' GvIngresos.Columns(6).Visible = True + + ' GvDeudores.Columns(5).Visible = True + ' GvDeudores.Columns(6).Visible = True + + ' 'RVImporte.Enabled = False + ' 'RVImporte.MaximumValue = "0.00" + + ' CVImportePesos.Enabled = True + 'Else + ' DivTipoCambio.Visible = False + ' CargaCuentas() + ' CargaOtrosIngresos(1) + ' CargaDeudores(1) + ' CargaAcreedores(1) + ' CargaVentas(1) + ' CveMonedaFiltros = 1 + ' TxtFechaDocumento.Attributes.Remove("onchange") + + ' GvIngresos.Columns(5).Visible = False + ' GvIngresos.Columns(6).Visible = False + + ' GvDeudores.Columns(5).Visible = False + ' GvDeudores.Columns(6).Visible = False + + ' ' RVImporte.Enabled = True + ' 'RVImporte.MaximumValue = LtlSaldo.Text.ToDecimal.ToString + + ' CVImporteDolares.Enabled = False + ' CVImportePesos.Enabled = False + 'End If + + 'UpDatos.Update() + + 'RegistraScript("CambiaDolaresPesos();") + + End Sub + + + Function validaPagoDeudores() As Boolean + + Dim respuesta As Boolean = True + + Dim totalFacturas As Decimal = 0D + Dim totalDeudores As Decimal = 0D + + For Each gvRow As GridViewRow In GvDeudores.Rows + If gvRow.FCCheckBox("Chk").Checked Then + 'totalDeudores = totalDeudores + gvRow.DataKey("Saldo").ToDecimal + totalDeudores = totalDeudores + gvRow.FCTextBox("TxtSaldoDeudor").Text.ToDecimal + End If + Next + + For Each gvRow As GridViewRow In GvD.Rows + If gvRow.FCCheckBox("chkRegistraFactura").Checked Then + totalFacturas = totalFacturas + gvRow.DataKey("Total").ToDecimal + End If + Next + + If totalFacturas > totalDeudores Then + respuesta = False + Alert("El importe de lasf acturas es superior al importe de deudores selecionado", TipoMensaje.MsgAdvertencia) + End If + + + Return respuesta + + End Function + + End Class @@ -5630,6 +6298,7 @@ Public Class ClsCompraManager Public Property CveCreditoDetalle As Integer = -1 Public Property CveIE As Integer = -1 Public Property CveCompraAmortizacion As Integer = -1 + Public Property DTPagosDeudores As DataTable Public Sub New(XmlFuente As String, OpcionCarga As EnumCargaCompra, DTTiposGastos As DataTable, UsuarioActual As Usuario) @@ -5940,7 +6609,7 @@ Public Class ClsCompraManager #End Region End Sub - Public Function ConfiguraRegistroRapidoReembolso(CvePS As Integer, CveSubProyecto As Integer, CveCajaChica As Integer, CvePersonal As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer, NumeroReembolso As String) As Boolean + Public Function ConfiguraRegistroCompra(CvePS As Integer, CveSubProyecto As Integer, CveCajaChica As Integer, CvePersonal As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer, NumeroReembolso As String, DTProrrateo As DataTable, DTPagosDeudores As DataTable) As Boolean Dim respuesta As Boolean = True Me.CveSubProyecto = CveSubProyecto @@ -5951,6 +6620,7 @@ Public Class ClsCompraManager Me.CveRetISRConcepto = CveRetISRConcepto Me.CveTipoPoliza = 3 Me.NumeroReembolso = NumeroReembolso + Me.DTPagosDeudores = DTPagosDeudores Dim dRowSubProyecto As DataRow = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto).FiltroPrimero("") @@ -5983,10 +6653,100 @@ Public Class ClsCompraManager respuesta = False End If + + respuesta = Prorratear(DTProrrateo) + Return respuesta End Function + Function Prorratear(DtProrrateo As DataTable) As Boolean + + Dim Respuesta As Boolean = True + + If DtProrrateo.Rows.Count > 0 Then + + Dim DT_Impuestos As DataTable = TmpDT.FiltraParametros("", "", {"IVAPorcentaje", "RetIVAPorcentaje", "RetISRPorcentaje"}) + Dim TmpDTCopy As DataTable = TmpDT.Copy + + TmpDT.Rows.Clear() + + Dim SubTotalOriginal As Decimal = SubTotal + Dim IVAOriginal As Decimal = IVA + Dim RetISROriginal As Decimal = RetISR + Dim RetIVAOriginal As Decimal = RetIVA + Dim TotalOriginal As Decimal = Total + Dim DescuentoOriginal As Decimal = Descuento + + + For Each dRowImp As DataRow In DT_Impuestos.Rows + + Dim impPorcentajeIVA As Decimal = dRowImp("IVAPorcentaje").ToString.ToDecimal + Dim impRetIVAPorcentaje As Decimal = dRowImp("RetIVAPorcentaje").ToString.ToDecimal + Dim impRetISRPorcentaje As Decimal = dRowImp("RetISRPorcentaje").ToString.ToDecimal + + Dim ImpSubTotal As Decimal = TmpDTCopy.SUM("Total", $" (IVAPorcentaje = {impPorcentajeIVA} OR IVAPorcentaje IS NULL ) AND (RetIVAPorcentaje = {impRetIVAPorcentaje} OR RetIVAPorcentaje IS NULL) AND (RetISRPorcentaje = {impRetISRPorcentaje} OR RetISRPorcentaje IS NULL)") + Dim ImpIVA As Decimal = TmpDTCopy.SUM("IVA", $" (IVAPorcentaje = {impPorcentajeIVA} OR IVAPorcentaje IS NULL ) AND (RetIVAPorcentaje = {impRetIVAPorcentaje} OR RetIVAPorcentaje IS NULL) AND (RetISRPorcentaje = {impRetISRPorcentaje} OR RetISRPorcentaje IS NULL)") + + Dim impTotal As Decimal = (ImpSubTotal + ImpIVA) + + For Each dRow As DataRow In DtProrrateo.Rows + + + Dim totalParcialDeseado As Decimal = (dRow("Porcentaje").ToString.ToDecimal / 100D) * impTotal + Dim PorcentajeCalculado As Decimal = totalParcialDeseado / impTotal + + Dim subtotalParcial As Decimal = ImpSubTotal * PorcentajeCalculado + Dim ivaParcial As Decimal = ImpIVA * PorcentajeCalculado + Dim retIsrParcial As Decimal = impRetISRPorcentaje * PorcentajeCalculado + Dim retIvaParcial As Decimal = impRetIVAPorcentaje * PorcentajeCalculado + + Dim nIVA As Decimal = ivaParcial.RoundSQL(6) + Dim nRetIVA As Decimal = retIvaParcial.RoundSQL(6) + Dim nRetISR As Decimal = retIsrParcial.RoundSQL(6) + Dim nSubTotal As Decimal = subtotalParcial.RoundSQL(6) + Dim nTotal As Decimal = totalParcialDeseado.RoundSQL(6) + Dim nPorcentajeIVA As Decimal = impPorcentajeIVA '(ivaParcial / subtotalParcial).RoundSQL(4) + Dim nPorcentaje As Decimal = ((totalParcialDeseado.RoundSQL(4) * 100) / impTotal).RoundSQL(4) + Dim nRetIVAPorcentaje As Decimal = (retIvaParcial / subtotalParcial).RoundSQL(4) + Dim nRetISRPorcentaje As Decimal = (retIsrParcial / subtotalParcial).RoundSQL(4) + + + AddPS(1, dRow("CveUM").ToString.ToEntero, dRow("UM").ToString, dRow("CveClasificacion").ToString.ToEntero, dRow("Clasificacion").ToString, dRow("CvePS").ToString.ToEntero, dRow("PS").ToString, 1, dRow("CveSubProyecto").ToString, dRow("SubProyecto").ToString, "", + "-1", "", nSubTotal, nTotal, nIVA, nRetIVA, nRetISR, 0, 0, 0, PorcentajeIVA:=nPorcentajeIVA, + CargaXml:=True, PorcentajeRetIVA:=nRetIVAPorcentaje, PorcentajeRetISR:=nRetISRPorcentaje) + + Next + + + Next + + + + Dim SubTotalDetalle As Decimal = TmpDT.SUM("Total") + Dim IVADetalle As Decimal = TmpDT.SUM("IVA") + Dim RetIVADetalle As Decimal = TmpDT.SUM("RetIVA") + Dim RetISRDetalle As Decimal = TmpDT.SUM("RetISR") + Dim DescuentoDetalle As Decimal = TmpDT.SUM("Descuento") + + Dim Diferencia As Decimal = (TotalOriginal - (SubTotalDetalle + IVADetalle - RetIVADetalle - RetISRDetalle - DescuentoDetalle)).RoundSQL + + If Math.Abs(Diferencia) > 0.01 Then + Respuesta = False + Else + Total = Total.RoundSQL + SubTotal = SubTotal.RoundSQL + IVA = IVA.RoundSQL + RetISR = RetISR.RoundSQL + RetIVA = RetIVA.RoundSQL + End If + + End If + + Return Respuesta + + End Function + Private Function AjustesValidacion() As Boolean Dim respuesta As Boolean = True 'VALIDA IMPORTES @@ -7055,12 +7815,13 @@ Public Class ClsCompraManager End If End Function - Public Function AddCompra() As Boolean + Public Function AddCompra(ByRef transaccion As SqlTransaction) As Boolean If Not AjustesValidacion() Then Return False Dim respuesta As Boolean = True - Dim ObjCompras As New ClsCompras + + Dim ObjCompras As New ClsCompras(transaccion) Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL()) If Not AddPrepolizaCabecera(ObjConta) Then @@ -7122,14 +7883,15 @@ Public Class ClsCompraManager If Not ObjCompras.UpdateCompraFactura(Me.CveCompra, Me.CveFactura, Me.Serie, Me.Folio) Then respuesta = False End If - If respuesta Then - ObjCompras.Commit() - Else - ObjCompras.RollBack() - End If - ObjCompras.Dispose() - ObjConta.Dispose() + 'If respuesta Then + ' ObjCompras.Commit() + 'Else + ' ObjCompras.RollBack() + 'End If + + 'ObjCompras.Dispose() + 'ObjConta.Dispose() Return respuesta End Function From 85b54c641785c5f3d3ef2257640f07a865947513 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 14 Feb 2025 09:06:28 -0700 Subject: [PATCH 7/7] RepAnexoCatalogoCC --- Contabilidad/RepAnexoCatalogoCC.aspx | 13 +++++++++++++ Contabilidad/RepAnexoCatalogoCC.aspx.vb | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Contabilidad/RepAnexoCatalogoCC.aspx b/Contabilidad/RepAnexoCatalogoCC.aspx index d628bcb22..548cdf295 100644 --- a/Contabilidad/RepAnexoCatalogoCC.aspx +++ b/Contabilidad/RepAnexoCatalogoCC.aspx @@ -103,6 +103,19 @@
>
+ + +
+ Tipo Movto +
+
+ + + + + +
+
diff --git a/Contabilidad/RepAnexoCatalogoCC.aspx.vb b/Contabilidad/RepAnexoCatalogoCC.aspx.vb index 63cf931d0..ae99858cd 100644 --- a/Contabilidad/RepAnexoCatalogoCC.aspx.vb +++ b/Contabilidad/RepAnexoCatalogoCC.aspx.vb @@ -146,7 +146,8 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC DTDatos = New DataTable Dim Conta As New ClsContabilidad - If Conta.GetAnexoCatalagoCC(DdlCuentas.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + If Conta.GetAnexoCatalagoCC(DdlCuentas.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveUsuario, + OpcionCuentas:=DdlOpcionCuenta.SelectedValue.ToEntero) Then DTHeaders = Conta.DSResultados.Tables(0) DTDatos = Conta.DSResultados.Tables(1) @@ -248,7 +249,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC End If If Importe <> 0 Then - '' pendiente.. ' e.Row.Cells(Index).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" + e.Row.Cells(Index).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" End If Index += 1