diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb
index 38d16dc57..145843325 100644
--- a/App_Code/ClsBancos.vb
+++ b/App_Code/ClsBancos.vb
@@ -1950,12 +1950,14 @@ Public Class ClsBancos
Return Retorno
End Function
- Public Function GetIngresoEgresosDelDia(Fecha As Date, Tipo As String, Opcion As Integer, CveEmpresa As Integer) As Boolean
+ Public Function GetIngresoEgresosDelDia(Grupo As Integer, FechaInicio As Date, FechaFin As Date, Tipo As String, Opcion As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_IngresoEgresosDiariosGet")
With SqlAdapter.SelectCommand.Parameters
- .Add("@Fecha", SqlDbType.Date).Value = Fecha
+ .Add("@Grupo", SqlDbType.Int).Value = Grupo
+ .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
+ .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Tipo", SqlDbType.VarChar).Value = Tipo 'Ing Ingresp Egs Egreso
.Add("@Opcion", SqlDbType.VarChar).Value = Opcion
diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index 61f19afbb..d6f77b7f8 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -4313,7 +4313,7 @@ Public Class ClsContabilidad
Return Retorno
End Function
- Public Function GetAnexoCatalagoCC(CveCuenta As Integer, FechaI As Date, FechaF As Date, CveSubProyecto As Integer, CveEmpresa As Integer, Divisor As Integer, CveUsuario As Integer) As Boolean
+ Public Function GetAnexoCatalagoCC(CveCuenta As Integer, FechaI As Date, FechaF As Date, CveSubProyecto As Integer, CveEmpresa As Integer, Divisor As Integer, CveUsuario As Integer, Optional OpcionCuentas As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_AnexoCatalogoCCGet")
@@ -4326,6 +4326,7 @@ Public Class ClsContabilidad
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Divisor", SqlDbType.Int).Value = Divisor
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@OpcionCuentas", SqlDbType.Int).Value = OpcionCuentas
End With
Try
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 16ac7f41e..ea5c15c34 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -4492,7 +4492,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)
@@ -4520,13 +4520,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
@@ -4879,6 +4904,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
diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb
index 9343ffa93..4b42c5616 100644
--- a/App_Code/modExtensiones.vb
+++ b/App_Code/modExtensiones.vb
@@ -2393,6 +2393,28 @@ Namespace Extensiones
Dim worksheet As ExcelWorksheet = excel.Worksheets(0)
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
+
+
+ '2025-02-15 OIC Este for es para que las celdas tomen formato numerico y se puedan sumar
+ For Each row In worksheet.Rows
+ For Each cell In row.AllocatedCells
+ If cell.Value IsNot Nothing Then
+ Dim valorTexto As String = cell.Value.ToString().Trim()
+ Dim numero As Decimal
+ ' Intentar convertir a número
+ If Decimal.TryParse(valorTexto, System.Globalization.NumberStyles.Any,
+ System.Globalization.CultureInfo.InvariantCulture,
+ numero) Then
+
+ ' Si se pudo convertir exitosamente, reasignar como Double
+ cell.Value = numero
+ End If
+ End If
+ Next
+ Next
+
+
+
Dim celdasConTexto As CellRange = worksheet.GetUsedCellRange(True)
If celdasConTexto Is Nothing Then Exit Sub 'No se recuperaron datos, salir de sin guardar porque soltará error
celdasConTexto.Style.Font.Name = "Calibri Light"
diff --git a/Bancos/FlujoDiario.aspx.vb b/Bancos/FlujoDiario.aspx.vb
index 23aa78957..21723b838 100644
--- a/Bancos/FlujoDiario.aspx.vb
+++ b/Bancos/FlujoDiario.aspx.vb
@@ -73,12 +73,12 @@ Partial Class Bancos_FlujoDiario
End If
'Se Llena TmpDTIngresosDelDia
- If Ban.GetIngresoEgresosDelDia(TxtFecha.Text.ToDate, "Ing", OpcionSaldo, UsuarioActual.CveEmpresa) Then
+ If Ban.GetIngresoEgresosDelDia(1, TxtFecha.Text.ToDate, TxtFecha.Text.ToDate, "Ing", OpcionSaldo, UsuarioActual.CveEmpresa) Then
TmpDTIngresosDelDia = Ban.DtResultados '.FiltraParametros("CveTipoTransaccion <> 8")
End If
'Se Llena TmpDTGastosDelDia
- If Ban.GetIngresoEgresosDelDia(TxtFecha.Text.ToDate, "Egs", OpcionSaldo, UsuarioActual.CveEmpresa) Then
+ If Ban.GetIngresoEgresosDelDia(1, TxtFecha.Text.ToDate, TxtFecha.Text.ToDate, "Egs", OpcionSaldo, UsuarioActual.CveEmpresa) Then
TmpDTGastosDelDia = Ban.DtResultados '.FiltraParametros("CveTipoTransaccion <> 2")
End If
diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx
index 0e84a3b80..d0b0efbb4 100644
--- a/Compras/eFacturas.aspx
+++ b/Compras/eFacturas.aspx
@@ -33,6 +33,10 @@
.ajax__tab_xp .ajax__tab_body {
font-size: 12px !important;
}
+
+ .addropzone {
+ min-height: 170px;
+ }
@@ -265,10 +269,10 @@
-
Caja Chica
- Viáticos
+ Viáticos
+ Deudores
@@ -295,7 +299,7 @@
+
@@ -352,7 +357,7 @@
-
@@ -827,6 +912,162 @@
+
+ <%--PRORRATE INICIO--%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%--PRORRATEO FIN--%>
+
+
@@ -1356,9 +1597,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1529,8 +1752,7 @@
-
-
+
@@ -1552,9 +1774,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..1141c23ff 100644
--- a/Compras/eFacturas.aspx.vb
+++ b/Compras/eFacturas.aspx.vb
@@ -25,6 +25,8 @@ Imports SharpCompress.Archive.Rar
Imports SharpCompress.Common
Imports SharpCompress.Reader
Imports Telerik.Web.UI
+Imports System.Data.SqlClient
+Imports Stimulsoft.Base.Serializing
'Imports Telerik.Web.UI
@@ -756,13 +758,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 +829,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 +1163,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 +5195,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 +5304,7 @@ Partial Class Compras_eFacturas
DivPersonalReembolso.Visible = False
DivCuentaCajaChicaReembolso.Visible = False
-
+ DivDeudores.Visible = False
Select Case RBLContado.SelectedValue
@@ -5280,6 +5316,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 +5354,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 +5428,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, TxtPrecioProrrateoGasolina.Text.ToDecimal)
+ 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, TxtPrecioProrrateoGasolina.Text.ToDecimal)
+ 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, Porcentaje As Decimal)
+
+ ''' 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 = Porcentaje
+ 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") = Porcentaje '((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 +5719,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 +5785,541 @@ 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
+ 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
+
+
+
+ Private Sub VinculacionAutomaticaRNC()
+ Dim ErrorProceso As Boolean = False
+ Dim ErrorProcesoStr As String = ""
+ Dim Contador As Integer = 0
+ Dim Objcompras As New ClsCompras
+ Objcompras.IniciaTransacSQL()
+
+ 'DataKeyNames="CveFactura,CveCompra,CveProveedor,SerieFolio,NombreProveedor,UUID,RFCDe,RFCPara,TipoFactura,FueValidado,TipoComprobante,Version,RFCde,XML,PDF,BloquePorComplemento,Total,CveTipoProveedor,FechaFactura"
+
+
+ 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
+ Exit For
+ End If
+
+ Dim CompraActual As New ClsCompraManager(CFDIXmlPath, ClsCompraManager.EnumCargaCompra.DesdeArchivo, GlobalDTTiposGastos(UsuarioActual.CveEmpresa), UsuarioActual)
+
+ CompraActual.CveFactura = GvRow.DataKey("CveFactura").ToEntero
+ CompraActual.CveProveedor = GvRow.DataKey("CveProveedor").ToEntero
+ CompraActual.CveTipoProveedor = GvRow.DataKey("CveTipoProveedor").ToEntero
+ CompraActual.CveTipoConceptoProveedor = GvRow.DataKey("CveTipoProveedor").ToEntero
+ CompraActual.TipoCompra = ClsCompraManager.EnumTipoCompra.Sin_definir
+ CompraActual.IEPSGasto = True
+ CompraActual.Descripcion = TxtDescripcionCompra.Text.Trim
+ CompraActual.NombreProveedor = GvRow.DataKey("NombreProveedor")
+
+ Dim CvePersonal As Integer = -1 'DdlPersonalReembolso.SelectedValue.ToEntero
+ Dim CveCajachica As Integer = -1 'DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
+
+ If RBLContado.SelectedValue.ToEntero = 6 Then 'Caja Chica
+ CveCajachica = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
+ ElseIf RBLContado.SelectedValue.ToEntero = 2 Then ' viaticos
+ CvePersonal = DdlPersonalReembolso.SelectedValue.ToEntero
+ ElseIf RBLContado.SelectedValue.ToEntero = 4 Then ' deudores
+
+ End If
+
+
+
+
+ If CompraActual.ConfiguraRegistroCompra(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal,
+ DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text,
+ DTProrrateo:=DTProrrateo, DTPagosDeudores:=New DataTable) Then
+
+ 'FIX ME OIC Recuerda cambiar el tipo de documento al registrar, actualmente tiene FAC y NC uno u otro, ajustar para que registre *** Egs *** cuado TipoComprobante = 'E'
+ 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
+
+
+
+ Else
+ ErrorProceso = True
+ End If
+ Else
+ ErrorProceso = True
+ End If
+
+
+
+
+
+ End If
+
+ End If
+ If ErrorProceso Then
+ Exit For
+ End If
+ Next
+
+ 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
+ End If
+
+ Objcompras.Dispose()
+
+
+
+
+ End Sub
+
+
+
+ Protected Sub LnkDecargaPlatilla_Click(sender As Object, e As EventArgs)
+
+ Dim rutaArchivoPlantilla As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\CargaProrrateoPorcentaje.xlsx"
+
+ Dim nombreArchivo As String = "CargaProrrateoPorcentaje.xlsx"
+
+ ' Configurar la respuesta HTTP
+ Response.Clear()
+ Response.ContentType = "application/octet-stream"
+ Response.AppendHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
+
+ Dim contenido As Byte() = System.IO.File.ReadAllBytes(rutaArchivoPlantilla)
+ Response.BinaryWrite(contenido)
+
+ Response.Flush()
+ Response.End()
+
+ End Sub
+
+ Protected Sub BrnAgregarPlantilla_Click(sender As Object, e As EventArgs)
+
+ If TxtExcel.getfiles().Archivos.Count > 0 Then
+ Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
+ Dim Directorio As String = Server.MapPath("~") & file.path
+ Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
+
+ Dim DTPlantilla As DataTable = ReadExcelFile(Directorio + file.filename, True)
+
+ ProcesaPlantilla(DTPlantilla)
+
+ Else
+ Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError)
End If
End Sub
+
+ Function ProcesaPlantilla(DTPlantilla As DataTable) As Boolean
+
+
+ Dim CvePs As Integer = DdlPS.SelectedValue.ToEntero
+
+ If Not CvePs > 0 Then
+ Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia)
+ Return False
+ End If
+
+ Dim PsRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePs).FiltroPrimero("")
+
+ If PsRow Is Nothing Then
+ Alert("No se encontro el producto", TipoMensaje.MsgAdvertencia)
+ Return False
+ 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} ")
+
+ Dim TotalPorcentaje As Decimal
+ Dim ErrorProceso As Boolean = False
+ Dim SbSubProyectosNoencontrados As New StringBuilder
+
+ For Each dRow As DataRow In DTPlantilla.Rows
+ If dRow("Porcentaje").ToString.ToDecimal < 0 Then
+ Alert("No se admiten porcentajes negativos.", TipoMensaje.MsgAdvertencia)
+ Return False
+ End If
+ TotalPorcentaje = TotalPorcentaje + dRow("Porcentaje").ToString.ToDecimal
+ Next
+
+ TotalPorcentaje = TotalPorcentaje.RoundSQL
+ If TotalPorcentaje <> 100 Then
+ Alert($"La suma de porcentaje es diferente de 100%, el porcetaje actual es de {TotalPorcentaje}%", TipoMensaje.MsgAdvertencia)
+ Return False
+ End If
+
+ If Not DTPlantilla.Columns.Contains("CveSubProyecto") Then
+ DTPlantilla.Columns.Add("CveSubProyecto", GetType(Integer))
+ End If
+
+
+ For Each dRow As DataRow In DTPlantilla.Rows
+ Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $" SubProyecto = '{dRow("CentroCosto").ToString}' ").ToEntero
+ If CveSubProyecto > 0 Then
+ dRow("CveSubProyecto") = CveSubProyecto
+ Else
+ ErrorProceso = True
+ SbSubProyectosNoencontrados.AppendLine($"{dRow("CentroCosto").ToString}
")
+ End If
+ Next
+
+ If ErrorProceso AndAlso SbSubProyectosNoencontrados.Length > 0 Then
+ Alert($"No se encontraron los siguientes centros de costo
{SbSubProyectosNoencontrados.ToString}", TipoMensaje.MsgAdvertencia)
+ End If
+
+ For Each dRow As DataRow In DTPlantilla.Rows
+ AgregarProrrateoGasolina(dRow("CveSubProyecto").ToString.ToEntero, dRow("CentroCosto").ToString, CvePs, CveUM, UM, CveClasificacion, Clasificacion, dRow("Porcentaje").ToString.ToDecimal)
+ Next
+
+ TxtExcel.Text = "[]"
+ Return True
+
+ End Function
+
End Class
@@ -5630,6 +6545,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 +6856,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 +6867,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 +6900,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 +8062,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 +8130,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
diff --git a/Contabilidad/RepAnexoCatalogoCC.aspx b/Contabilidad/RepAnexoCatalogoCC.aspx
index d628bcb22..0e105651a 100644
--- a/Contabilidad/RepAnexoCatalogoCC.aspx
+++ b/Contabilidad/RepAnexoCatalogoCC.aspx
@@ -103,6 +103,19 @@
>
+
+
+
+ Tipo Movto
+
+
+
@@ -156,7 +169,7 @@
-
+
@@ -346,7 +359,13 @@
let currentid = 1;
function HandlerGraf(obj, evt) {
$("#DivModalGrafica").modal();
- cdatos = $(obj).data('values');
+
+ //cdatos = $(obj).data('values');
+
+ cdatos = $(obj).data('values').sort(function (a, b) {
+ return b.Valor - a.Valor;
+ });
+
if (currentid == 1) {
CargaGraficaBarras();
} else {
@@ -356,6 +375,9 @@
}
function CargaGraficaBarras() {
let data = cdatos;
+ //let data = cdatos.sort(function (a, b) {
+ // return b.Valor - a.Valor;
+ //});
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
@@ -393,6 +415,11 @@
function CargaGraficaPastel() {
let data = cdatos;
+
+ //let data = cdatos.sort(function (a, b) {
+ // return b.Valor - a.Valor;
+ //});
+
var chart = AmCharts.makeChart("chartdiv", {
"type": "pie",
"theme": "light",
diff --git a/Contabilidad/RepAnexoCatalogoCC.aspx.vb b/Contabilidad/RepAnexoCatalogoCC.aspx.vb
index 63cf931d0..22ce9b1b2 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)
@@ -235,9 +236,15 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
Next
Dim CveCunetaRow As Integer = e.Row.DataKey("CveCuenta").ToEntero
+ If e.Row.Cells(2).Text.ToDecimal <> 0 Then
+ e.Row.Cells(2).Text = $"
{ If(DdlDivisor.SelectedValue.ToEntero > 1, e.Row.Cells(2).Text.ToDecimal.ToString("###,###,##0"), e.Row.Cells(2).Text.ToDecimal.ToString("###,###,###.00")) }"
+ Else
+ e.Row.Cells(2).Text = $"-"
+ End If
+
+
Dim inicial As Boolean = True
Index = 4
-
For Each DRow As DataRow In DTHeaders.Rows
Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
@@ -248,7 +255,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
diff --git a/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx b/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx
index 2499e6d64..b39faeb0a 100644
--- a/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx
+++ b/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx
@@ -51,7 +51,7 @@
Cuenta:
-
+
>
-
+
Tipo Movto
-
-
+
-
+
Tipo
diff --git a/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx.vb b/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx.vb
index 876464b03..50a1de01f 100644
--- a/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx.vb
+++ b/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx.vb
@@ -129,7 +129,7 @@ Partial Class Conta_RepMovimientosAuxiliaresCatalogo
' DdlTipoReporte.SelectedValue = TipoReporte.ToString
End If
-
+ DdlOpcionCuentas.SelectedValueExist(IfNull(Request("OpcionCuenta"), "-1")) 'OpcionCuenta
''If DdlTipoCuentas.Items.FindByValue(IdCuenta.ToString) IsNot Nothing Then
'' DdlTipoCuentas.SelectedValue = IdCuenta.ToString
''Else
diff --git a/Empresas/Grales/CargaProrrateoPorcentaje.xlsx b/Empresas/Grales/CargaProrrateoPorcentaje.xlsx
new file mode 100644
index 000000000..d2dd4e872
Binary files /dev/null and b/Empresas/Grales/CargaProrrateoPorcentaje.xlsx differ
diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs
index 867093f94..ccedabda1 100644
--- a/Nomina/Nomina.aspx.cs
+++ b/Nomina/Nomina.aspx.cs
@@ -7629,6 +7629,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
//DdlTipo.Items.Insert(2, new ListItem("Obligaciones", "O"));
//DdlTipo.SelectedValueExist("-1");
CargaConcepto();
+
}
protected void CargaConcepto()
@@ -7637,11 +7638,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
DdlConcepto.Items.Clear();
if (DdlTipo.SelectedValue.Contiene("P", "D", "O"))
{
- DdlConcepto.DataSource = dt.FiltraParametros(string.Format("Tipo ='{0}'", DdlTipo.SelectedValue));
+ dt = dt.FiltraParametros(string.Format("Tipo ='{0}'", DdlTipo.SelectedValue));
}
DataRow drow = dt.NewRow();
drow["CveConcepto"] = "-1";
drow["Concepto"] = "Seleccione";
+ drow["CodigoConcepto"] = "Seleccione";
dt.Rows.InsertAt(drow, 0);
DdlConcepto.DataSource = dt;
DdlConcepto.SelectedValueExist("-1");
@@ -7663,10 +7665,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void DdlTipo_SelectedIndexChanged(object sender, EventArgs e)
{
CargaConcepto();
+ UpMovtosPermanentesModal.Update();
}
protected void LnkAddMovtoPermanente_Click(object sender, EventArgs e)
{
+ DdlTipo.SelectedValue = "D";
CargaConcepto();
DdlTipoDescto_SelectedIndexChanged(null, null);
pnlAddupMovto.Visible = true;
diff --git a/RH/Personal.aspx b/RH/Personal.aspx
index 32e1ab0a1..ba14b0eaf 100644
--- a/RH/Personal.aspx
+++ b/RH/Personal.aspx
@@ -135,7 +135,7 @@
- Convertir en Deudor
+ Convertir en Deudor
@@ -403,9 +403,9 @@