diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb
index 211711478..1b16277ef 100644
--- a/App_Code/ClsCompras.vb
+++ b/App_Code/ClsCompras.vb
@@ -3484,6 +3484,60 @@ Public Class ClsCompras
End Function
+
+
+#Region "Medicos"
+
+ Public Function AddGastoMedicos(CveCompra As Integer, CveMedico As Integer, CvePS As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Comp_ComprasMedicosAdd")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
+ .Add("@CveMedico", SqlDbType.Int).Value = CveMedico
+ .Add("@CvePS", SqlDbType.Int).Value = CveCompra
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar gasto de médico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return Retorno
+ End Function
+
+ Public Function GetGastoMedicos(CveCompra As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Comp_ComprasMedicosGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió al obtener los gastos de médico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return Retorno
+ End Function
+
+ Public Function RemoveGastoMedicos(CveCompra As Integer, CveMedico As Integer, CvePS As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Comp_ComprasMedicosRemove")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
+ .Add("@CveMedico", SqlDbType.Int).Value = CveMedico
+ .Add("@CvePS", SqlDbType.Int).Value = CveCompra
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al eliminar gasto de médico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return Retorno
+ End Function
+
+#End Region
End Class
diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx
index 8fe0b7be9..71e5d047e 100644
--- a/Compras/Compras.aspx
+++ b/Compras/Compras.aspx
@@ -874,7 +874,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index dd10e1160..6f24b4dac 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -74,23 +74,7 @@ Partial Class Compras_Compras
ViewState("TmpDTOriginal") = value
End Set
End Property
- Private Property TmpCXP As DataTable
- Get
- Return CType(ViewState("TmpCXP"), DataTable)
- End Get
- Set(value As DataTable)
- ViewState("TmpCXP") = value
- End Set
- End Property
- 'Private Property PSDTRemplazo As DataTable
- ' Get
- ' Return CType(ViewState("PSDTRemplazo"), DataTable)
- ' End Get
- ' Set(value As DataTable)
- ' ViewState("PSDTRemplazo") = value
- ' End Set
- 'End Property
Private Property DtCheques As DataTable
Get
Return CType(ViewState("DtCheques"), DataTable)
@@ -109,15 +93,6 @@ Partial Class Compras_Compras
End Set
End Property
- Public Property IdVale As List(Of Integer)
- Get
- IdVale = DirectCast(ViewState("IdVale"), List(Of Integer))
- End Get
-
- Set(ByVal value As List(Of Integer))
- ViewState("IdVale") = value
- End Set
- End Property
Public Property ListaDocumentos As List(Of String)
Get
ListaDocumentos = DirectCast(ViewState("ListaDocumentos"), List(Of String))
@@ -161,30 +136,22 @@ Partial Class Compras_Compras
End Set
End Property
- 'Private Property DtCuentas As DataTable
- ' Get
- ' Return CType(ViewState("DtCuentas"), DataTable)
- ' End Get
- ' Set(value As DataTable)
- ' ViewState("DtCuentas") = value
- ' End Set
- 'End Property
- 'Private Property CargoFactura As Boolean
- ' Get
- ' Return CType(ViewState("CargoFactura"), Boolean)
- ' End Get
- ' Set(value As Boolean)
- ' ViewState("CargoFactura") = value
- ' End Set
- 'End Property
- Private Property tDTAcarreos As DataTable
+ Private Property DTMedicos As DataTable
Get
- Return If(IsNothing(ViewState("tDTAcarreos")), Nothing, CType(ViewState("tDTAcarreos"), DataTable))
+ If IsNothing(ViewState("DTMedicos")) Then
+ Dim tDT = New DataTable
+ tDT.Columns.Add("CveCompra", GetType(Integer))
+ tDT.Columns.Add("CveMedico", GetType(Integer))
+ tDT.Columns.Add("Medico", GetType(String))
+ ViewState("DTMedicos") = tDT
+ End If
+ Return CType(ViewState("DTMedicos"), DataTable)
End Get
Set(value As DataTable)
- ViewState("tDTAcarreos") = value
+ ViewState("DTMedicos") = value
End Set
End Property
+
Private Property DtDeudores As DataTable
Get
Return CType(ViewState("DtDeudores"), DataTable)
@@ -421,14 +388,7 @@ Partial Class Compras_Compras
ViewState("PUSerieLote") = value
End Set
End Property
- Private Property TotAcarreos As Double
- Get
- Return CType(ViewState("TotAcarreos"), Double)
- End Get
- Set(value As Double)
- ViewState("TotAcarreos") = value
- End Set
- End Property
+
Public Class Anticipos
@@ -702,6 +662,7 @@ Partial Class Compras_Compras
Private Property Descuentos As Decimal = 0
Private Property Amortizaciones As Decimal = 0
Private Property EmisorRFC As String
+ Private Property EmisorRegimenFiscal As String
Private Property ReceptorRFC As String
Private Property TrasladoIVA As Decimal = 0
Private Property RetencionIVA As Decimal = 0
@@ -1257,7 +1218,6 @@ Partial Class Compras_Compras
CveMetodoPago = -1
RFCProveedor = ""
CargaDdlTipoGasto()
- CreaTmpAcarreos()
EsContado = False
CierrePeriodo = False
NCDevolucion = False
@@ -1292,7 +1252,6 @@ Partial Class Compras_Compras
'VALIDACION DE XML
NuevaValidacionXML = IfNull(Request("NuevaValidacionXML"), 0).ToString.ToEntero
- IdVale = New List(Of Integer)
ListaDocumentos = New List(Of String)
TotalGeneral = 0
@@ -1372,11 +1331,16 @@ Partial Class Compras_Compras
DdlPersonal.DataSource = dtpersonal 'ObjPersonal.DtResultados
DdlPersonalReembolso.DataSource = dtpersonal.FiltraParametros("CveEstatusPersonal = 1")
-
'ObjPersonal.Dispose()
DdlPersonal.DataBind()
DdlPersonalReembolso.DataBind()
+ If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
+ UPPMedicosGastos.Visible = True
+ DdlMedico.DataSource = GlobalDTMedicos(UsuarioActual.CveEmpresa)
+ DdlMedico.DataBind()
+ End If
+
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then
DVCultivosCuadro.Visible = True
DdlSubProyecto.AutoPostBack = True
@@ -1979,13 +1943,12 @@ Partial Class Compras_Compras
If impuesto = "001" Then
impuesto = "Retención ISR"
+ If ValorXML(retencion, "TasaOCuota").Trim.ToDecimal = 0.0125 Then RetISRResico = True
ElseIf impuesto = "002" Then
impuesto = "Retención IVA"
ElseIf impuesto = "003" Then
impuesto = "IEPS"
End If
-
-
' Validar si Base coincide con Importe
If baseValue <> importeValue Then
'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
")
@@ -2022,13 +1985,14 @@ Partial Class Compras_Compras
End If
End If
Next
+ If EmisorRegimenFiscal = "626" AndAlso Not RetISRResico Then
+ SbValRet.Append(" La factura no tiene especificado una retención de ISR, ya que el proveedor es Resico.
")
+ End If
If SbValRet.ToString.Trim.Length > 0 Then
Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia)
End If
-
-
Else
CargaConceptosXML(XMLDoc)
End If
@@ -3312,6 +3276,14 @@ Partial Class Compras_Compras
BtnEliminarCompra.Visible = False
End If
+ If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
+ If ObjCompra.GetGastoMedicos(CveCompra) Then
+ DTMedicos = ObjCompra.DtResultados
+ GvMedicosGastos.DataSource = ObjCompra.DtResultados
+ GvMedicosGastos.DataBind()
+ End If
+ End If
+
Else
Alert("La compra solicitada no se encontró. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
End If
@@ -3462,12 +3434,6 @@ Partial Class Compras_Compras
Deudores.Dispose()
End Sub
- Private Sub CreaTmpAcarreos()
- tDTAcarreos = New DataTable
- tDTAcarreos.Columns.Add("CvePreEstimacion", GetType(Integer))
- tDTAcarreos.Columns.Add("Importe", GetType(Double))
- End Sub
-
Protected Sub CargaAcreedores()
Dim ObjMov As New ClsMovimientos
@@ -5097,306 +5063,315 @@ Partial Class Compras_Compras
End Select
End Select
End If
- '-------INICIA U S A A C -------------------------------------------------------------------
- 'If UsuarioActual.Empresa.UsaAC AndAlso Not TieneError Then
+ If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
+ If DTMedicos IsNot Nothing AndAlso DTMedicos.Rows.Count > 0 Then
- ' If TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0 Then
- ' ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
- ' ObjContaAC.IniciaTransacSQL()
+ For Each dr As DataRow In DTMedicos.Rows
+ ObjCompras.AddGastoMedicos(CveCompra, dr("CveMedico").ToString.ToEntero, -1)
+ Next
+ End If
- ' ''POLIZA COMPROMETIDO SOLO SI NO SE VINCULA OC
- ' If HdnVCveOC.Value.ToEntero > 0 Then
+ End If
+ '-------INICIA U S A A C -------------------------------------------------------------------
+ 'If UsuarioActual.Empresa.UsaAC AndAlso Not TieneError Then
- ' IDPolizaComprometido = 1
- ' TotalPorDevengar = TotalPorDevengar * 2
- ' Else
- ' TotalPorDevengar = TotalPorDevengar * 3
- ' End If
+ ' If TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0 Then
+ ' ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
+ ' ObjContaAC.IniciaTransacSQL()
- ' IdPoliza = ObjContaAC.AddPoliza(3, TxtDescripcion.Text.Trim, TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate)
+ ' ''POLIZA COMPROMETIDO SOLO SI NO SE VINCULA OC
+ ' If HdnVCveOC.Value.ToEntero > 0 Then
- ' 'Dim filtro As New StringBuilder
- ' If IdPoliza > 0 Then
- ' PolizaFolio = ObjContaAC.Folio
- ' 'Dim RegistroMatriz As DataRow
- ' 'Dim CuentaCargo As Integer
- ' Dim CuentaAbono As Integer
- ' Dim Importe As Decimal
+ ' IDPolizaComprometido = 1
+ ' TotalPorDevengar = TotalPorDevengar * 2
+ ' Else
+ ' TotalPorDevengar = TotalPorDevengar * 3
+ ' End If
- ' 'CUENTA PROVEEDOR
- ' 'If tIdContaProveedor <= 0 Then
- ' ' 'normalmente debe de ser la cuenta 021120000000000000, para el caso de APH, se el cmabio al 2119
- ' ' If ObjContaAC.GetCuentas(-1, "021190000000000000", -1) Then
- ' ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("")
- ' ' If drCuenta IsNot Nothing Then
+ ' IdPoliza = ObjContaAC.AddPoliza(3, TxtDescripcion.Text.Trim, TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate)
- ' ' CuentaAbono = drCuenta("Id").ToString.ToEntero
- ' ' Dim FolioProveedor = ObjContaAC.GetFolioProveedores("021190000000000000").ToString
- ' ' ViewState("CtaProveedor") = ObjContaAC.AddCuenta(String.Format("02119{0}000000000", FolioProveedor.PadLeft(4, "0"c)), NombreProveedor, "D", 2, 0, 1, 0, "", 1, CuentaAbono)
- ' ' ObjProveedores.UpdateProveedorIdCuentaAC(CveProveedor, CtaProveedor)
+ ' 'Dim filtro As New StringBuilder
+ ' If IdPoliza > 0 Then
+ ' PolizaFolio = ObjContaAC.Folio
+ ' 'Dim RegistroMatriz As DataRow
+ ' 'Dim CuentaCargo As Integer
+ ' Dim CuentaAbono As Integer
+ ' Dim Importe As Decimal
+
+ ' 'CUENTA PROVEEDOR
+ ' 'If tIdContaProveedor <= 0 Then
+ ' ' 'normalmente debe de ser la cuenta 021120000000000000, para el caso de APH, se el cmabio al 2119
+ ' ' If ObjContaAC.GetCuentas(-1, "021190000000000000", -1) Then
+ ' ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("")
+ ' ' If drCuenta IsNot Nothing Then
+
+ ' ' CuentaAbono = drCuenta("Id").ToString.ToEntero
+ ' ' Dim FolioProveedor = ObjContaAC.GetFolioProveedores("021190000000000000").ToString
+ ' ' ViewState("CtaProveedor") = ObjContaAC.AddCuenta(String.Format("02119{0}000000000", FolioProveedor.PadLeft(4, "0"c)), NombreProveedor, "D", 2, 0, 1, 0, "", 1, CuentaAbono)
+ ' ' ObjProveedores.UpdateProveedorIdCuentaAC(CveProveedor, CtaProveedor)
- ' ' Else
- ' ' ErrorAC = True
- ' ' ErrorACMEnsaje.Append(" - DrCuenta Nula")
- ' ' End If
- ' ' Else
- ' ' ErrorACMEnsaje.Append(" - Error al consultar cuenta 021190000000000000 ")
- ' ' ErrorAC = True
- ' ' End If
- ' 'End If
+ ' ' Else
+ ' ' ErrorAC = True
+ ' ' ErrorACMEnsaje.Append(" - DrCuenta Nula")
+ ' ' End If
+ ' ' Else
+ ' ' ErrorACMEnsaje.Append(" - Error al consultar cuenta 021190000000000000 ")
+ ' ' ErrorAC = True
+ ' ' End If
+ ' 'End If
- ' Dim ConceptoRenglon As String = ""
- ' If Not ErrorAC Then
+ ' Dim ConceptoRenglon As String = ""
+ ' If Not ErrorAC Then
- ' 'INVENTARIOS EN AC
- ' Dim ContadorInventario As Integer = GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked)
+ ' 'INVENTARIOS EN AC
+ ' Dim ContadorInventario As Integer = GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked)
- ' Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA, tRetIVA, tRetISR As Decimal
- ' Dim ipresup As Integer = 0
- ' 'COMIENZA: PRUEBA AGRUPACION CONCEPTOS
- ' Dim Presup = From gvr As DataRow In TmpDT.Rows.Cast(Of DataRow)()
- ' Group gvr By Grp = New With {
- ' Key .CvePresupuestoEgreso = gvr("CvePresupuestoEgreso").ToString.ToEntero,
- ' Key .CveOrdencompraDetalle = If(gvr("CveOrdencompraDetalle").ToString.ToEntero > 0, 1, -1),
- ' Key .CveActivoFijo = If(gvr("TipoAF").ToString.ToEntero = 2, gvr("CveActivoFijo").ToString.ToEntero, -1)
- ' } Into Group
- ' Select Grp.CvePresupuestoEgreso, Grp.CveActivoFijo, Grp.CveOrdencompraDetalle,
- ' TotalImporte = Group.Sum(Function(r) r("Total").ToString.ToDecimal)
- ' Dim Fecha As Date = TxtFecha.Text.ToDate
+ ' Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA, tRetIVA, tRetISR As Decimal
+ ' Dim ipresup As Integer = 0
+ ' 'COMIENZA: PRUEBA AGRUPACION CONCEPTOS
+ ' Dim Presup = From gvr As DataRow In TmpDT.Rows.Cast(Of DataRow)()
+ ' Group gvr By Grp = New With {
+ ' Key .CvePresupuestoEgreso = gvr("CvePresupuestoEgreso").ToString.ToEntero,
+ ' Key .CveOrdencompraDetalle = If(gvr("CveOrdencompraDetalle").ToString.ToEntero > 0, 1, -1),
+ ' Key .CveActivoFijo = If(gvr("TipoAF").ToString.ToEntero = 2, gvr("CveActivoFijo").ToString.ToEntero, -1)
+ ' } Into Group
+ ' Select Grp.CvePresupuestoEgreso, Grp.CveActivoFijo, Grp.CveOrdencompraDetalle,
+ ' TotalImporte = Group.Sum(Function(r) r("Total").ToString.ToDecimal)
+ ' Dim Fecha As Date = TxtFecha.Text.ToDate
- ' 'Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA As Double
- ' tTotalIVA = TxtIVA.Text.ToDecimal
- ' tRetIVA = TxtRetIVA.Text.ToDecimal
- ' tRetISR = TxtRetISR.Text.ToDecimal
+ ' 'Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA As Double
+ ' tTotalIVA = TxtIVA.Text.ToDecimal
+ ' tRetIVA = TxtRetIVA.Text.ToDecimal
+ ' tRetISR = TxtRetISR.Text.ToDecimal
- ' 'tTotalIVA = tTotalIVA - tRetIVA - tRetISR
+ ' 'tTotalIVA = tTotalIVA - tRetIVA - tRetISR
- ' tTotalGral = TxtTotal.Text.ToDecimal + tRetIVA + tRetISR ' EL TOTAL GENERAL DEBE DE SER EL SUBTOTAL + IVA, NO SE DEBEN DE INCLUIR LAS RETENCIONES, POR ESO SE RESTA
- ' tDiferenciaIVA = tTotalIVA
+ ' tTotalGral = TxtTotal.Text.ToDecimal + tRetIVA + tRetISR ' EL TOTAL GENERAL DEBE DE SER EL SUBTOTAL + IVA, NO SE DEBEN DE INCLUIR LAS RETENCIONES, POR ESO SE RESTA
+ ' tDiferenciaIVA = tTotalIVA
- ' ipresup = 0
+ ' ipresup = 0
- ' Dim CuentaMatrizAlmacen As Integer
+ ' Dim CuentaMatrizAlmacen As Integer
- ' 'PresupuestoEgresos
- ' Dim DtPresupuestosTemp As DataTable
- ' Dim IdCuentaComprometido, IdCuentaPorEjercer, IdCuentaDevengado, IdCuentaMatriz As Integer
- ' ' Dim DescuentoConIVA As Decimal
- ' Dim tPorIVA As Decimal = tTotalIVA / (tTotalGral - tTotalIVA)
- ' Dim tAjusteTotal As Decimal
+ ' 'PresupuestoEgresos
+ ' Dim DtPresupuestosTemp As DataTable
+ ' Dim IdCuentaComprometido, IdCuentaPorEjercer, IdCuentaDevengado, IdCuentaMatriz As Integer
+ ' ' Dim DescuentoConIVA As Decimal
+ ' Dim tPorIVA As Decimal = tTotalIVA / (tTotalGral - tTotalIVA)
+ ' Dim tAjusteTotal As Decimal
- ' For Each grp In Presup
- ' Importe = grp.TotalImporte
- ' TotalDetalle += Importe
- ' ipresup += 1
- ' If Importe > 0 Then
- ' 'saco la proporcion de iva que le corresponde
- ' tIVA = Math.Round(Importe * tPorIVA, 2)
- ' tDiferenciaIVA -= tIVA
- ' 'identifico si es el ultimo registro, para ver si es necesario un ajuste
- ' If ipresup = Presup.Count Then
- ' If Math.Round(TotalDetalle - tTotalGral, 2) <= 0.01 AndAlso tDiferenciaIVA > 0 Then
- ' tIVA += tDiferenciaIVA
- ' End If
- ' End If
+ ' For Each grp In Presup
+ ' Importe = grp.TotalImporte
+ ' TotalDetalle += Importe
+ ' ipresup += 1
+ ' If Importe > 0 Then
+ ' 'saco la proporcion de iva que le corresponde
+ ' tIVA = Math.Round(Importe * tPorIVA, 2)
+ ' tDiferenciaIVA -= tIVA
+ ' 'identifico si es el ultimo registro, para ver si es necesario un ajuste
+ ' If ipresup = Presup.Count Then
+ ' If Math.Round(TotalDetalle - tTotalGral, 2) <= 0.01 AndAlso tDiferenciaIVA > 0 Then
+ ' tIVA += tDiferenciaIVA
+ ' End If
+ ' End If
- ' 'le sumo el iva al concepto
- ' Importe += tIVA
+ ' 'le sumo el iva al concepto
+ ' Importe += tIVA
- ' 'codigo Provisional, para cuand tenga descuento, solo tome el subtotal * el iva,RMF
- ' If TxtDescuento.Text.ToDouble > 0 Then
- ' Importe = grp.TotalImporte * 1.16D
- ' End If
+ ' 'codigo Provisional, para cuand tenga descuento, solo tome el subtotal * el iva,RMF
+ ' If TxtDescuento.Text.ToDouble > 0 Then
+ ' Importe = grp.TotalImporte * 1.16D
+ ' End If
- ' tAjusteTotal += Importe
- ' 'valido que la sumas de lo detalles no exceda al totalgeneral
- ' If Math.Round(tAjusteTotal, 2) > tTotalGral Then
- ' 'le resto la diferencia
- ' Importe -= (tAjusteTotal - tTotalGral)
- ' End If
+ ' tAjusteTotal += Importe
+ ' 'valido que la sumas de lo detalles no exceda al totalgeneral
+ ' If Math.Round(tAjusteTotal, 2) > tTotalGral Then
+ ' 'le resto la diferencia
+ ' Importe -= (tAjusteTotal - tTotalGral)
+ ' End If
- ' 'Presupuesto Egresos
- ' DtPresupuestosTemp = DtPresupuestos.FiltraParametros(String.Format("CvePresupuestoEgreso = {0}", grp.CvePresupuestoEgreso))
- ' If DtPresupuestosTemp.Rows.Count <> 1 Then
- ' ErrorAC = True
- ' ErrorACMEnsaje.Append(" - DtPresupuestosTemp.Rows.Count <> 1 ")
- ' Exit For
- ' End If
- ' IdCuentaComprometido = DtPresupuestosTemp.Rows(0)("IdCuentaComprometido").ToString.ToEntero
- ' IdCuentaPorEjercer = DtPresupuestosTemp.Rows(0)("IdCuentaPorEjercer").ToString.ToEntero
- ' IdCuentaDevengado = DtPresupuestosTemp.Rows(0)("IdCuentaDevengado").ToString.ToEntero
- ' IdCuentaMatriz = DtPresupuestosTemp.Rows(0)("IdCuentaMatriz").ToString.ToEntero
+ ' 'Presupuesto Egresos
+ ' DtPresupuestosTemp = DtPresupuestos.FiltraParametros(String.Format("CvePresupuestoEgreso = {0}", grp.CvePresupuestoEgreso))
+ ' If DtPresupuestosTemp.Rows.Count <> 1 Then
+ ' ErrorAC = True
+ ' ErrorACMEnsaje.Append(" - DtPresupuestosTemp.Rows.Count <> 1 ")
+ ' Exit For
+ ' End If
+ ' IdCuentaComprometido = DtPresupuestosTemp.Rows(0)("IdCuentaComprometido").ToString.ToEntero
+ ' IdCuentaPorEjercer = DtPresupuestosTemp.Rows(0)("IdCuentaPorEjercer").ToString.ToEntero
+ ' IdCuentaDevengado = DtPresupuestosTemp.Rows(0)("IdCuentaDevengado").ToString.ToEntero
+ ' IdCuentaMatriz = DtPresupuestosTemp.Rows(0)("IdCuentaMatriz").ToString.ToEntero
- ' 'COMPROMETIDO DEPENDIENTE SI EXISTE SU POLIZA
- ' If grp.CveOrdencompraDetalle = -1 Then
- ' ConceptoRenglon = String.Format("GC Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
- ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
- ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaPorEjercer, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ErrorAC = True
- ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 1")
- ' Exit For
- ' End If
- ' Else
- ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 2")
- ' ErrorAC = True
- ' Exit For
- ' End If
- ' End If
+ ' 'COMPROMETIDO DEPENDIENTE SI EXISTE SU POLIZA
+ ' If grp.CveOrdencompraDetalle = -1 Then
+ ' ConceptoRenglon = String.Format("GC Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
+ ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaPorEjercer, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ErrorAC = True
+ ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 1")
+ ' Exit For
+ ' End If
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 2")
+ ' ErrorAC = True
+ ' Exit For
+ ' End If
+ ' End If
- ' ConceptoRenglon = String.Format("GD Fact:{0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
- ' 'DEVENGADO
- ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaDevengado, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
- ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 3")
- ' ErrorAC = True
- ' Exit For
- ' End If
- ' Else
- ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 4")
- ' ErrorAC = True
- ' Exit For
- ' End If
+ ' ConceptoRenglon = String.Format("GD Fact:{0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
+ ' 'DEVENGADO
+ ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaDevengado, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 3")
+ ' ErrorAC = True
+ ' Exit For
+ ' End If
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 4")
+ ' ErrorAC = True
+ ' Exit For
+ ' End If
- ' If ContadorInventario > 0 Then
+ ' If ContadorInventario > 0 Then
- ' ' CuentaMatrizAlmacen = CtaAlmacen
- ' ElseIf grp.CveActivoFijo > 0 Then
+ ' ' CuentaMatrizAlmacen = CtaAlmacen
+ ' ElseIf grp.CveActivoFijo > 0 Then
- ' Dim CtaAF As Integer = -1
- ' Dim AF As String = ""
- ' Dim CuentaInicial As Integer = -1
+ ' Dim CtaAF As Integer = -1
+ ' Dim AF As String = ""
+ ' Dim CuentaInicial As Integer = -1
- ' If ObjAF.GetActivosFijos(grp.CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1, UsuarioActual.CveEmpresa) Then
- ' CtaAF = ObjAF.Cuenta
- ' AF = ObjAF.Descripcion
- ' CuentaInicial = ObjAF.CuentaInicial
- ' Else
- ' ErrorAC = True
- ' ErrorACMEnsaje.Append(" - Error al obtener activos fijos ")
- ' Exit For
- ' End If
+ ' If ObjAF.GetActivosFijos(grp.CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1, UsuarioActual.CveEmpresa) Then
+ ' CtaAF = ObjAF.Cuenta
+ ' AF = ObjAF.Descripcion
+ ' CuentaInicial = ObjAF.CuentaInicial
+ ' Else
+ ' ErrorAC = True
+ ' ErrorACMEnsaje.Append(" - Error al obtener activos fijos ")
+ ' Exit For
+ ' End If
- ' If Not CuentaInicial > 0 Then
- ' CuentaInicial = 1241
- ' End If
+ ' If Not CuentaInicial > 0 Then
+ ' CuentaInicial = 1241
+ ' End If
- ' 'CUENTA AF
- ' If CtaAF <= 0 Then
- ' If ObjContaAC.GetCuentas(-1, String.Format("0{0}0000000000000", CuentaInicial), -1) Then
- ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("")
- ' If drCuenta IsNot Nothing Then
- ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nula")
- ' CuentaAbono = drCuenta("Id").ToString.ToEntero
- ' Dim FolioAF As String = ObjContaAC.GetFolioProveedores(String.Format("0{0}0000000000000", CuentaInicial)).ToString
- ' CtaAF = ObjContaAC.AddCuenta(String.Format("0{0}{1}000000000", CuentaInicial, FolioAF.PadLeft(4, "0"c)), AF, "A", 2, 0, 1, 0, "", 1, CuentaAbono)
+ ' 'CUENTA AF
+ ' If CtaAF <= 0 Then
+ ' If ObjContaAC.GetCuentas(-1, String.Format("0{0}0000000000000", CuentaInicial), -1) Then
+ ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("")
+ ' If drCuenta IsNot Nothing Then
+ ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nula")
+ ' CuentaAbono = drCuenta("Id").ToString.ToEntero
+ ' Dim FolioAF As String = ObjContaAC.GetFolioProveedores(String.Format("0{0}0000000000000", CuentaInicial)).ToString
+ ' CtaAF = ObjContaAC.AddCuenta(String.Format("0{0}{1}000000000", CuentaInicial, FolioAF.PadLeft(4, "0"c)), AF, "A", 2, 0, 1, 0, "", 1, CuentaAbono)
- ' ObjAF.UpdateActivosFijosCuentaAC(grp.CveActivoFijo, CtaAF, UsuarioActual.CveUsuario)
- ' Else
- ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nulo")
- ' ErrorAC = True
- ' End If
- ' Else
- ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000")
- ' ErrorAC = True
- ' End If
- ' End If
+ ' ObjAF.UpdateActivosFijosCuentaAC(grp.CveActivoFijo, CtaAF, UsuarioActual.CveUsuario)
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nulo")
+ ' ErrorAC = True
+ ' End If
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000")
+ ' ErrorAC = True
+ ' End If
+ ' End If
- ' CuentaMatrizAlmacen = CtaAF
- ' Else
- ' CuentaMatrizAlmacen = IdCuentaMatriz
- ' End If
+ ' CuentaMatrizAlmacen = CtaAF
+ ' Else
+ ' CuentaMatrizAlmacen = IdCuentaMatriz
+ ' End If
- ' ''AFECTAR MATRIZ EGRESOS
- ' If ObjContaAC.AddMovimiento(IdPoliza, CuentaMatrizAlmacen, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ''AFECTAR MATRIZ EGRESOS
+ ' If ObjContaAC.AddMovimiento(IdPoliza, CuentaMatrizAlmacen, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ''VERIFICA SI TIENE DESCUENTO (AMORTIZACION)
- ' 'If TxtDescuento.Text.ToDouble > 0 Then
- ' ' DescuentoConIVA = TxtDescuento.Text.ToDouble * 1.16
+ ' ''VERIFICA SI TIENE DESCUENTO (AMORTIZACION)
+ ' 'If TxtDescuento.Text.ToDouble > 0 Then
+ ' ' DescuentoConIVA = TxtDescuento.Text.ToDouble * 1.16
- ' ' 'Valida que el descuento con iva cuadre en los totales
- ' ' If Math.Abs(DescuentoConIVA - (Importe - TxtTotal.Text.ToDouble)) < 0.02 Then
- ' ' DescuentoConIVA = Importe - TxtTotal.Text.ToDouble
- ' ' ElseIf DescuentoConIVA <> (Importe - TxtTotal.Text.ToDouble) Then
- ' ' ErrorAC = True
- ' ' Exit For
- ' ' End If
+ ' ' 'Valida que el descuento con iva cuadre en los totales
+ ' ' If Math.Abs(DescuentoConIVA - (Importe - TxtTotal.Text.ToDouble)) < 0.02 Then
+ ' ' DescuentoConIVA = Importe - TxtTotal.Text.ToDouble
+ ' ' ElseIf DescuentoConIVA <> (Importe - TxtTotal.Text.ToDouble) Then
+ ' ' ErrorAC = True
+ ' ' Exit For
+ ' ' End If
- ' ' 'actualizo el idcuenta del presupuesto
- ' ' If ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, Importe - DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ' 'agrego a la cuenta contable anticipos
- ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, CtaProveedorAnticipos, True, DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ' ErrorAC = True
- ' ' Exit For
- ' ' End If
- ' ' Else
- ' ' ErrorAC = True
- ' ' Exit For
- ' ' End If
+ ' ' 'actualizo el idcuenta del presupuesto
+ ' ' If ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, Importe - DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ' 'agrego a la cuenta contable anticipos
+ ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, CtaProveedorAnticipos, True, DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ' ErrorAC = True
+ ' ' Exit For
+ ' ' End If
+ ' ' Else
+ ' ' ErrorAC = True
+ ' ' Exit For
+ ' ' End If
- ' 'Else
- ' ' 'actualizo el idcuenta del presupuesto
- ' ' Importe = TxtTotal.Text.ToDouble
- ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe), "", ConceptoRenglon, 0, Fecha, "") Then
- ' ' ErrorAC = True
- ' ' Exit For
- ' ' End If
+ ' 'Else
+ ' ' 'actualizo el idcuenta del presupuesto
+ ' ' Importe = TxtTotal.Text.ToDouble
+ ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe), "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ' ErrorAC = True
+ ' ' Exit For
+ ' ' End If
- ' 'End If
+ ' 'End If
- ' Else
- ' ErrorACMEnsaje.Append(" - Error AFECTAR MATRIZ EGRESOS ObjContaAC.AddMovimiento")
- ' ErrorAC = True
- ' Exit For
- ' End If
- ' ''TERMINA AFECTAR MATRIZ EGRESOS
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Error AFECTAR MATRIZ EGRESOS ObjContaAC.AddMovimiento")
+ ' ErrorAC = True
+ ' Exit For
+ ' End If
+ ' ''TERMINA AFECTAR MATRIZ EGRESOS
- ' Else
- ' ErrorACMEnsaje.Append(" - For Each grp In Presup Importe > 0 ")
- ' ErrorAC = True
- ' Exit For
- ' End If
+ ' Else
+ ' ErrorACMEnsaje.Append(" - For Each grp In Presup Importe > 0 ")
+ ' ErrorAC = True
+ ' Exit For
+ ' End If
- ' Next
+ ' Next
- ' ''actualizo el idcuenta del presupuesto
- ' 'Importe = TxtTotal.Text.ToDecimal
- ' 'If Not ObjContaAC.AddMovimiento(IdPoliza, tIdContaProveedor, True, MultiplicadorNC * (If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe)), "", ConceptoRenglon, 0, Fecha, "") Then
- ' ' ErrorACMEnsaje.Append(" - actualizo el idcuenta del presupuesto ObjContaAC.AddMovimiento 3")
- ' ' ErrorAC = True
- ' 'End If
- ' 'End If
+ ' ''actualizo el idcuenta del presupuesto
+ ' 'Importe = TxtTotal.Text.ToDecimal
+ ' 'If Not ObjContaAC.AddMovimiento(IdPoliza, tIdContaProveedor, True, MultiplicadorNC * (If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe)), "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ' ErrorACMEnsaje.Append(" - actualizo el idcuenta del presupuesto ObjContaAC.AddMovimiento 3")
+ ' ' ErrorAC = True
+ ' 'End If
+ ' 'End If
- ' 'If tRetISR > 0 Then 'CtaProveedorRetISR
- ' ' ConceptoRenglon = String.Format("GD Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
- ' ' If Not ObjContaAC.AddMovimiento(IdPoliza, 0, True, MultiplicadorNC * tRetISR, "", ConceptoRenglon, 0, Fecha, "") Then
- ' ' ErrorACMEnsaje.Append(" RetISR > 0 ObjContaAC.AddMovimiento")
- ' ' ErrorAC = True
- ' ' End If
- ' 'End If
+ ' 'If tRetISR > 0 Then 'CtaProveedorRetISR
+ ' ' ConceptoRenglon = String.Format("GD Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
+ ' ' If Not ObjContaAC.AddMovimiento(IdPoliza, 0, True, MultiplicadorNC * tRetISR, "", ConceptoRenglon, 0, Fecha, "") Then
+ ' ' ErrorACMEnsaje.Append(" RetISR > 0 ObjContaAC.AddMovimiento")
+ ' ' ErrorAC = True
+ ' ' End If
+ ' 'End If
- ' 'TERMINA: PRUEBA AGRUPACION CONCEPTOS
+ ' 'TERMINA: PRUEBA AGRUPACION CONCEPTOS
- ' 'registrar amortizar anticipos
- ' End If
+ ' 'registrar amortizar anticipos
+ ' End If
- ' Else
- ' ErrorACMEnsaje.Append(" - Id Poliza = 0 ")
- ' ErrorAC = True
- ' End If
- ' Else
- ' TieneError = True
- ' ErrorACMEnsaje.Append("- TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0")
- ' ErrorAC = True
- ' End If
- 'End If
- '-------FIN U S A A C -------------------------------------------------------------------
+ ' Else
+ ' ErrorACMEnsaje.Append(" - Id Poliza = 0 ")
+ ' ErrorAC = True
+ ' End If
+ ' Else
+ ' TieneError = True
+ ' ErrorACMEnsaje.Append("- TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0")
+ ' ErrorAC = True
+ ' End If
+ 'End If
+ '-------FIN U S A A C -------------------------------------------------------------------
- If Not ErrorAC AndAlso Not TieneError Then
+ If Not ErrorAC AndAlso Not TieneError Then
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
@@ -5465,18 +5440,6 @@ Partial Class Compras_Compras
End If
- 'Vincula Vales
- 'If IdVale.Count > 0 Then
- ' For Each cve As Integer In IdVale
- ' If Not ObjAF.UpdateValeCombustible(cve, CveCompra, -1, "", -1, -1, -1, UsuarioActual.CveEmpresa) Then
- ' ErrorAF = True
- ' Exit For
- ' End If
- ' Next
- 'End If
-
-
-
'AGREGA AF COMPRA - Cuando es Compra se guarda CveCompraDetalle en AF
If Row("TipoAF").ToString.ToEntero = 2 Then
Dim Valor As Decimal = Row("Total").ToString.ToDecimal
@@ -9951,14 +9914,15 @@ Partial Class Compras_Compras
Dim node As XmlNode
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Emisor", Prefijo), namespaces)
- If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
+ If node IsNot Nothing Then
EmisorRFC = ValorXML(node, "RFC")
+ EmisorRegimenFiscal = ValorXML(node, "RegimenFiscal")
End If
node = XMLDoc.SelectSingleNode(String.Format("//{0}:CfdiRelacionados", Prefijo), namespaces)
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Receptor", Prefijo), namespaces)
- If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
+ If node IsNot Nothing Then
ReceptorRFC = ValorXML(node, "RFC")
End If
@@ -18579,7 +18543,7 @@ Partial Class Compras_Compras
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetCxPProveedor(CveProveedor, "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, "-1", "-1") Then
GvFacturaNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0")
- TmpCXP = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0")
+
End If
ObjMovtos.Dispose()
GvFacturaNC.DataBind()
@@ -21457,6 +21421,32 @@ Partial Class Compras_Compras
#End Region
+#Region "Gastos de médicos"
+ Protected Sub LnkAddMedico_Click(sender As Object, e As EventArgs)
+
+ 'agregar un médico al listado
+
+ Dim trow As DataRow = DTMedicos.NewRow
+ trow("CveMedico") = DdlMedico.SelectedValue
+ trow("Medico") = DdlMedico.SelectedItem.Text
+ DTMedicos.Rows.Add(trow)
+ GvMedicosGastos.DataSource = DTMedicos
+ GvMedicosGastos.DataBind()
+
+ End Sub
+
+ Protected Sub LnkEliminarMedico_Click(sender As Object, e As EventArgs)
+ Dim btn As LinkButton = CType(sender, LinkButton)
+ Dim gvr As GridViewRow = CType(btn.NamingContainer, GridViewRow)
+
+ Dim DTIndex = gvr.RowIndex
+ DTMedicos.Rows(DTIndex).Delete()
+ DTMedicos.AcceptChanges()
+ GvMedicosGastos.DataSource = DTMedicos
+ GvMedicosGastos.DataBind()
+
+ End Sub
+#End Region