-- option explicit

-- repie, filtro por usuario
This commit is contained in:
2023-08-31 21:54:13 -07:00
parent 3c3268bef1
commit f4d4d5f264
23 changed files with 356 additions and 418 deletions

View File

@@ -671,10 +671,6 @@ Partial Class OC_OC
End Try
End If
End If
End If
@@ -981,16 +977,16 @@ Partial Class OC_OC
Dim Total As Decimal = 0
For Each Dr As DataRow In DtDetalle.Rows
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("")
If DrPS IsNot Nothing AndAlso DrPS("IVA").ToString.ToEntero = -1 Then
Total += Dr("Total").ToString.ToDecimal
End If
Next
Dim Porcentaje = TxtIVA.Text.ToDecimal / Total
Dim Porcentaje As Decimal = TxtIVA.Text.ToDecimal / Total
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("")
If DrPS IsNot Nothing AndAlso DrPS("IVA").ToString.ToEntero = -1 Then
Dr("IVA") = Math.Round(Dr("Total").ToString.ToDecimal * Porcentaje, 6)
Dr("IVAPorcentaje") = Math.Round(Porcentaje, 2)
@@ -1020,7 +1016,7 @@ Partial Class OC_OC
#Region " FUNCIONALIDAD 105-141 "
Private Sub CargaFuncionalidad105()
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
DdlP2.setEsWebService(EsWS)
@@ -1182,7 +1178,7 @@ Partial Class OC_OC
For Each RowV As DataRow In ObjVentas.DtResultados.Rows
'If Not IsNothing(RowV) Then
Dim dr As DataRow = DtDetalle.NewRow
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=RowV("CvePS").ToString.ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=RowV("CvePS").ToString.ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información de los productos. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -1874,10 +1870,9 @@ Partial Class OC_OC
TotalCotizacionesGanadoras = 0
Dim objCotizaciones As New ClsOC
'------------------------------------------------------------------------
Dim Ds As DataSet = objCotizaciones.GetCotizacionesTabla(CveOrdenCompra)
For i = 1 To 10
For i As Integer = 1 To 10
gvCotizaciones.Columns(i + 2).Visible = False
Next
@@ -1891,7 +1886,7 @@ Partial Class OC_OC
NumCotizaciones = DtCotizaciones.Rows.Count
For i = 1 To NumCotizaciones
For i As Integer = 1 To NumCotizaciones
gvCotizaciones.Columns(i + 2).Visible = True
Next
@@ -2176,7 +2171,6 @@ Partial Class OC_OC
End If
'Valida cantidad en contrato
Dim TieneError As Boolean = False
Dim dttemp As New DataTable ' GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
dttemp.Columns.Add("CveSubProyecto", GetType(Integer))
@@ -2184,7 +2178,7 @@ Partial Class OC_OC
dttemp.Columns.Add("Cantidad", GetType(Decimal))
dttemp.Columns.Add("PU", GetType(Decimal))
Dim DrPSValidar = dttemp.NewRow
Dim DrPSValidar As DataRow = dttemp.NewRow
DrPSValidar("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero
DrPSValidar("CvePS") = DdlP2.SelectedValue.ToString.ToEntero
DrPSValidar("Cantidad") = TxtCant.Text.Trim.ToDecimal
@@ -2198,10 +2192,8 @@ Partial Class OC_OC
End If
End If
If DtDetalle IsNot Nothing Then
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -2383,7 +2375,7 @@ Partial Class OC_OC
#Region " GUARDAR "
Private Function ValidaGuardar() As Boolean
Dim TieneError = False
Dim TieneError As Boolean = False
If CboE.SelectedValue.ToEntero = 0 AndAlso TipoOC = "OC" Then
Alert("Las ordenes de compra no puede tener el estatus 'Pre Solicitud'. Debe ser una requisición", TipoMensaje.MsgAdvertencia)
@@ -2622,11 +2614,11 @@ Partial Class OC_OC
Dim CveProveedorContacto As Integer = -1
Dim TieneError As Boolean = False
Dim CveProveedor As Integer = -1
Dim GeneraReq = False
Dim GeneraReq As Boolean = False
Dim IDPoliza As Integer = 0
Dim IVA = If(TxtIVA.Visible, TxtIVA.Text.ToDecimal, LblIVA.Text.ToDecimal)
Dim IVA As Decimal = If(TxtIVA.Visible, TxtIVA.Text.ToDecimal, LblIVA.Text.ToDecimal)
If TxtFechaEstimadaEntrega.Text.Trim = "__/__/____" Then TxtFechaEstimadaEntrega.Text = ""
Dim Promocion = TxtPromocion.Text.Trim
Dim Promocion As String = TxtPromocion.Text.Trim
'EMPIEZA OBJETOS Y TRASACCIONES
@@ -2643,7 +2635,7 @@ Partial Class OC_OC
End If
'LUGAR ENTREGA
Dim LugarEntrega = If(txtLugarEntrega.Text.Trim = "", "-1", txtLugarEntrega.Text.Trim)
Dim LugarEntrega As String = If(txtLugarEntrega.Text.Trim = "", "-1", txtLugarEntrega.Text.Trim)
LugarEntrega = If(DivLugarEntrega1.Visible, LugarEntrega, If(TxtLugarEntregaDirecta.Visible, TxtLugarEntregaDirecta.Text.Trim, ""))
'GUARDA'
@@ -2834,7 +2826,7 @@ Partial Class OC_OC
ViewState("LigaOCs") = If(CveEstatusNuevo <> CboE.SelectedValue.ToEntero, String.Format("<a href='/OC/OC.aspx?OC={0}'>{1}</a>", CveOrdenCompra, Folio), "")
If CveOrdenCompra > 0 Then
Dim ImprimirOC = String.Format("<a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Orden de Compra</a> ", Encripta(String.Format("OP=OC&CVEOC={0}", CveOrdenCompra)))
Dim ImprimirOC As String = String.Format("<a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Orden de Compra</a> ", Encripta(String.Format("OP=OC&CVEOC={0}", CveOrdenCompra)))
Dim Msg As New StringBuilder
'Cuando Estatus = "Autorizada"
@@ -2858,7 +2850,7 @@ Partial Class OC_OC
'IMPRIME LIGA A POLIZAS
If IDPolizasGeneradas.Count > 0 Then
Msg.Append("<br/><br/> <b>Polizas generadas:</b>")
For i = 0 To IDPolizasGeneradas.Count - 1
For i As Integer = 0 To IDPolizasGeneradas.Count - 1
Msg.AppendFormat("<br/> Poliza: <b><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">{1}</a></b>", IDPolizasGeneradas(i), FoliosPolizas(i))
Next
End If
@@ -2987,22 +2979,22 @@ Partial Class OC_OC
If DtInvOCDiferencias.Rows.Count > 0 And TipoOC = "OC" Then
'VARIABLES
Dim DiferenciaInvOC = 0.0D
Dim CveMovimientoAlmacen = -1
Dim CveOCDetalle = -1
Dim CveAlmacen = -1
Dim DiferenciaInvOC As Decimal = 0.0D
Dim CveMovimientoAlmacen As Integer = -1
Dim CveOCDetalle As Integer = -1
Dim CveAlmacen As Integer = -1
Dim Fecha As Date = Now
Dim CveProveedorInvOC As Integer = -1
Dim ProveedorNombre As String = ""
Dim SerieFolio As String = ""
Dim CvePrePoliza As Integer = -1
Dim ConceptoSalida = -1
Dim TCInvOC = 0.0D
Dim ImporteME = 0.0D
Dim ImporteMEComp = 0.0D
Dim SumatoriaMN = 0.0D
Dim SumatoriaME = 0.0D
Dim SumatoriaMEComp = 0.0D
Dim ConceptoSalida As Integer = -1
Dim TCInvOC As Decimal = 0.0D
Dim ImporteME As Decimal = 0.0D
Dim ImporteMEComp As Decimal = 0.0D
Dim SumatoriaMN As Decimal = 0.0D
Dim SumatoriaME As Decimal = 0.0D
Dim SumatoriaMEComp As Decimal = 0.0D
Dim PS As String = ""
If Not TieneError Then
@@ -3218,7 +3210,7 @@ Partial Class OC_OC
Alert(String.Format("La {0} se guardó correctamente", TipoLargo), TipoMensaje.MsgDosBotones, Liga1, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Reporte", JSBtn2:=Liga2)
Else
Dim ImprimirOC = ""
Dim ImprimirOC As String = ""
Dim Msg As New StringBuilder
If CveOCGeneradas.Count = 1 Then
@@ -3231,34 +3223,25 @@ Partial Class OC_OC
'IMPRIME LIGA A POLIZAS
If IDPolizasGeneradas.Count > 0 Then
Msg.Append("<br/><br/> <b>Polizas generadas:</b>")
For i = 0 To IDPolizasGeneradas.Count - 1
For i As Integer = 0 To IDPolizasGeneradas.Count - 1
Msg.AppendFormat("<br/> Poliza: <b><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">{1}</a></b>", IDPolizasGeneradas(i), FoliosPolizas(i))
Next
End If
'Alert(Msg.ToString, TipoMensaje.MsgInformacion, $"document.location.href=""/OC/OC.aspx?Tipo={TipoOC}""")
'Edicion
Dim Liga1 As String = $"document.location.href=""/OC/OC.aspx?Tipo={TipoOC}"""
Dim Liga2 As String = $"document.location.href=""/OC/RepOC.aspx"""
Alert(Msg.ToString(), TipoMensaje.MsgDosBotones, Liga1, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Reporte", JSBtn2:=Liga2)
End If
DrEliminados.Clear()
Else
OC.RollBack()
If Conta IsNot Nothing Then Conta.RollBack()
Alert(MsgError, TipoMensaje.MsgError)
End If
End If
'TERMINA TODO POR SI OCURRIÓ ALGO RARO
If TieneError Then
If OC IsNot Nothing Then OC.RollBack()
@@ -3291,7 +3274,6 @@ Partial Class OC_OC
End Sub
Protected Function GeneraOrdenes(ByRef objOrdenCompra As ClsOC, Conta As ClsContPAQi, ByRef ObjInventarios As ClsInventarios) As Boolean
'If Ddlcliente.txtValue.Value.ToEntero > 0 And DdlVendedor.SelectedValue.ToEntero <= 0 Then
' Alert("Debe de seleccionar Un vendedor ", TipoMensaje.MsgAdvertencia)
' Exit Function
@@ -3302,26 +3284,25 @@ Partial Class OC_OC
Dim CveCotizacion As Integer = 0
Dim CveColectiva As Integer = 0
Dim HuboError As Boolean = False
Dim IVA = If(TxtIVA.Visible, TxtIVA.Text.ToDecimal, LblIVA.Text.ToDecimal)
Dim IVA As Decimal = If(TxtIVA.Visible, TxtIVA.Text.ToDecimal, LblIVA.Text.ToDecimal)
Dim LigaOcsTemp = ""
Dim CveOCGeneradasTemp = New List(Of Integer)
Dim FolioOCGeneradasTemp = New List(Of Integer)
Dim LigaOcsTemp As String = ""
Dim CveOCGeneradasTemp As List(Of Integer) = New List(Of Integer)
Dim FolioOCGeneradasTemp As List(Of Integer) = New List(Of Integer)
Dim LugarEntrega = If(txtLugarEntrega.Text.Trim = "", "-1", txtLugarEntrega.Text.Trim)
Dim LugarEntrega As String = If(txtLugarEntrega.Text.Trim = "", "-1", txtLugarEntrega.Text.Trim)
LugarEntrega = If(DivLugarEntrega1.Visible, LugarEntrega, If(TxtLugarEntregaDirecta.Visible, TxtLugarEntregaDirecta.Text.Trim, ""))
Dim Promocion = "-1"
Dim Promocion As String = "-1"
Promocion = TxtPromocion.Text.Trim
Try
Dim NoProveedoresCot As Integer = DtDetalle.COUNT("CveProveedor", "CveProveedor > 0")
If ChkCotizacion.Checked AndAlso NoProveedoresCot > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then
Dim CveProveedor = -1
Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0
Dim CveProveedor As Integer = -1
Dim TotalCot As Decimal = 0, IVACot As Decimal = 0D, RetIVA As Decimal = 0, RetISR As Decimal = 0
Dim PorIVA As Decimal = 0
Dim IdPoliza = -1
Dim IdPoliza As Integer = -1
For Each dr As DataRow In DtDetalle.FiltraParametros("CveProveedor > 0", "CveProveedor").Rows
@@ -3398,7 +3379,7 @@ Partial Class OC_OC
'SI NO HUBO ERROR AGREGA LAS LIGAS OC DE TODAS LAS OC GENERADAS
If Not HuboError Then
ViewState("LigaOCs") = String.Format("{0}{1}", LigaOCs, LigaOcsTemp)
Dim Index = 0
Dim Index As Integer = 0
For Each CveOC As Integer In CveOCGeneradasTemp
CveOCGeneradas.Add(CveOC)
FolioOCGeneradas.Add(FolioOCGeneradasTemp(Index))
@@ -3471,10 +3452,9 @@ Partial Class OC_OC
Return HuboError
End Function
Private Function GuardaAC(Conta As ClsContPAQi, OC As ClsOC, CveOC As Integer, FolioOC As Integer, Optional CveProveedor As Integer = -1) As Integer
Dim TieneError = False
Dim IDPoliza = -1
Dim Folio = -1
Dim TieneError As Boolean = False
Dim IDPoliza As Integer = -1
Dim Folio As Integer = -1
'SI TIENE POLIZA ANTERIOR LA ELIMINA
If IDPolizaPresupuestal > 0 Then
@@ -3507,7 +3487,7 @@ Partial Class OC_OC
Dim IdCuentaComprometido, IdCuentaPorEjercer As Integer
'SI VIENE CON PROVEEDOR FILTRA SOLO LOS CONCEPTOS DEL PROVEEDOR
Dim DT = If(CveProveedor = -1, DtDetalle.Copy, DtDetalle.FiltraParametros(String.Format("CveProveedor = {0}", CveProveedor)).Copy)
Dim DT As DataTable = If(CveProveedor = -1, DtDetalle.Copy, DtDetalle.FiltraParametros(String.Format("CveProveedor = {0}", CveProveedor)).Copy)
Dim Presup = From gvr As DataRow In DT.Rows.Cast(Of DataRow)()
Group gvr By Grp = New With {
@@ -3517,7 +3497,7 @@ Partial Class OC_OC
TotalImporte = Group.Sum(Function(r) r("Total").ToString.ToDecimal)
Dim tTotalIVA, tTotalGral, tIVA, tDiferenciaIVA, Importe, TotalDetalle As Decimal
Dim tPorIVA = 0D, tAjusteTotal = 0D, ipresup = 0
Dim tPorIVA As Decimal = 0D, tAjusteTotal As Decimal = 0D, ipresup As Decimal = 0
If CveProveedor > 0 Then
'CUANDO VIENE DE COTIZACION
@@ -3871,7 +3851,7 @@ Partial Class OC_OC
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
e.Row.FCTextBox("TxtObsPS").Attributes.Add("maxlength", "750")
Dim FiltroClasificacion = ""
Dim FiltroClasificacion As String = ""
'DDL CLASIFICACION
If isWithFamily() Then
e.Row.FCDropDownList("DdlClasificacion").DataSource = GlobalDTSubFamilias(CveEmpresaActual) 'GlobalDTClasificaciones(CveEmpresaActual).FiltraParametros("Codigo is null OR Codigo = ''")
@@ -4031,26 +4011,26 @@ Partial Class OC_OC
Clasificacion = gvr.FCDropDownList("DdlClasificacion").SelectedItem.Text
'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR
Dim CvePSAnterior = gvr.DataKey("CvePS").ToEntero
Dim CvePSAnterior As Integer = gvr.DataKey("CvePS").ToEntero
PS = gvr.DataKey("PS").ToString
Dim RetISR = gvr.DataKey("RetISRPorcentaje").ToDecimal
Dim RetIVA = gvr.DataKey("RetIVAPorcentaje").ToDecimal
Dim RetISR As Decimal = gvr.DataKey("RetISRPorcentaje").ToDecimal
Dim RetIVA As Decimal = gvr.DataKey("RetIVAPorcentaje").ToDecimal
'Dim IvaPS = gvr.DataKey("IVAPorcentaje").ToDecimal
Dim IEPSPS = gvr.DataKey("IEPSPSPorcentaje").ToDecimal
Dim IEPSPSIVA = gvr.DataKey("IEPSPSIVAPorcentaje").ToDecimal
Dim Total = Importe * Cantidad - Descuento
Dim IEPSPS As Decimal = gvr.DataKey("IEPSPSPorcentaje").ToDecimal
Dim IEPSPSIVA As Decimal = gvr.DataKey("IEPSPSIVAPorcentaje").ToDecimal
Dim Total As Decimal = Importe * Cantidad - Descuento
'VALORES DEL PS
CvePS = gvr.FCDropDownList("DdlPS").SelectedValue.ToEntero
PS = gvr.FCDropDownList("DdlPS").SelectedItem.Text
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto para actualizar. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim IvaPS = DrPS("IVA").ToString.ToDecimal
Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal
IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDecimal
IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0)
@@ -4314,15 +4294,15 @@ Partial Class OC_OC
Protected Sub SeleccionarPOA_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim gvr As GridViewRow = CType(CType(sender, LinkButton).BindingContainer, GridViewRow)
Dim Clave As String = gvr.DataKey("CvePresupuestoEgreso")
Dim CuentaporEjercer = gvr.DataKey("IdCuentaPorEjercer")
Dim CuentaComprometido = gvr.DataKey("IdCuentaComprometido")
Dim CuentaporEjercer As String = gvr.DataKey("IdCuentaPorEjercer")
Dim CuentaComprometido As String = gvr.DataKey("IdCuentaComprometido")
Dim Presupuesto As String = gvr.DataKey("Total")
If Presupuesto.ToEntero < TxtImporte.Text.ToEntero Then
Alert("El Presupuesto seleccionado no cubre el gasto. Favor de seleccionar otro.", TipoMensaje.MsgAdvertencia)
Else
LblCvePOA.Text = Clave.ToString
HdnCveCuentaPorEjercer.Value = CuentaporEjercer.ToString
HdnCveCuentaPorEjercer.Value = CuentaporEjercer
HdnCveCuentaComprometido.Value = CuentaComprometido.ToString
LbAgregar.Enabled = True
UpPoaClave.Update()
@@ -4368,7 +4348,7 @@ Partial Class OC_OC
End Sub
Private Sub CargaPresupuesto()
Dim AC As New ClsAC
Dim Ejercicio = If(IsDate(TxtFecha.Text), Year(TxtFecha.Text.ToDate), UsuarioActual.Empresa.EjercicioActual)
Dim Ejercicio As Integer = If(IsDate(TxtFecha.Text), Year(TxtFecha.Text.ToDate), UsuarioActual.Empresa.EjercicioActual)
If AC.GetPresupuestoEgresos(-1, True, Ejercicio, CveEmpresaActual, True) Then
DtPresupuestos = AC.DtResultados.Copy
@@ -4382,11 +4362,6 @@ Partial Class OC_OC
UpPresupuestosAC.Update()
End Sub
Private Sub MuestraPresupuestosEgresos()
Dim Width = GvD.Width
Dim Width2 = DivConceptosContenido.Style("Width")
'Seccion Grid
If VerificaPresupuesto Then
GvD.Width = 1750
@@ -4445,7 +4420,7 @@ Partial Class OC_OC
CambiaEjercicioAC()
End Sub
Private Sub CambiaEjercicioAC(Optional CargaTodo As Boolean = True)
Dim Ejercicio = If(IsDate(TxtFecha.Text), Year(TxtFecha.Text.ToDate), UsuarioActual.Empresa.EjercicioActual)
Dim Ejercicio As Integer = If(IsDate(TxtFecha.Text), Year(TxtFecha.Text.ToDate), UsuarioActual.Empresa.EjercicioActual)
If Ejercicio = EjercicioAC Then
Exit Sub
@@ -4502,7 +4477,7 @@ Partial Class OC_OC
Private Sub ConservaAC()
'Guarda valores AC en TmpDT
Dim Index = 0
Dim Index As Integer = 0
For Each gvr As GridViewRow In GvD.Rows
DtDetalle.Rows(Index)("CveProgramaOperativo") = gvr.FCDropDownList("DdlAC1").SelectedValue.ToEntero
DtDetalle.Rows(Index)("CveUnidadAdministrativa") = gvr.FCDropDownList("DdlAC2").SelectedValue.ToEntero
@@ -4552,7 +4527,7 @@ Partial Class OC_OC
End Sub
Private Sub CalculaSaldoACGeneral()
Dim ContPaq As New ClsContPAQi(UsuarioActual.Empresa)
Dim DtPresupuestosTemp = DtPresupuestos.FiltraParametros(String.Format("CveProgramaOperativo = {0} and CveUnidadAdministrativa = {1} and CveFuenteFinanciamiento = {2} and CveTipoGasto= {3} and CveClasificacion = {4}", DdlACGeneral1.SelectedValue.ToString, DdlACGeneral2.SelectedValue.ToString, DdlACGeneral3.SelectedValue.ToString, DdlACGeneral4.SelectedValue.ToString, DdlACGeneral5.SelectedValue.ToString))
Dim DtPresupuestosTemp As DataTable = DtPresupuestos.FiltraParametros(String.Format("CveProgramaOperativo = {0} and CveUnidadAdministrativa = {1} and CveFuenteFinanciamiento = {2} and CveTipoGasto= {3} and CveClasificacion = {4}", DdlACGeneral1.SelectedValue.ToString, DdlACGeneral2.SelectedValue.ToString, DdlACGeneral3.SelectedValue.ToString, DdlACGeneral4.SelectedValue.ToString, DdlACGeneral5.SelectedValue.ToString))
If DtPresupuestosTemp IsNot Nothing AndAlso DtPresupuestosTemp.Rows.Count > 0 Then
LbACGeneralSaldo.Text = ContPaq.GetSaldoCuenta(DtPresupuestosTemp.Rows(0)("IdCuentaPorEjercer").ToString.ToEntero, 0, TxtFecha.Text.ToDate.Year).ToString.FormatoNumero
Else
@@ -4568,7 +4543,7 @@ Partial Class OC_OC
Dim ContPaq As New ClsContPAQi(UsuarioActual.Empresa)
Dim disponible As Decimal
Dim ErrorPresupuesto = False
Dim ErrorPresupuesto As Boolean = False
Dim Ddl1 As DropDownList
Dim Ddl2 As DropDownList
@@ -5335,13 +5310,9 @@ Partial Class OC_OC
Protected Sub BtnSolicitarAnticipo_Click(sender As Object, e As EventArgs) Handles BtnSolicitarAnticipo.Click
If TxtSAImporte.Text.ToDecimal > SaldoOCAnticipo Then
Alert("El importe solicitado supera el saldo de la orden de compra", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim Descripcion As New StringBuilder
@@ -5349,10 +5320,10 @@ Partial Class OC_OC
Descripcion.AppendFormat("Orden de compra : {0} - <a target=""_blank"" href=""/OC/OC.aspx?OC={1}"">Ir a la orden de compra</a> - <a target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={2}"">Imprimir OC</a>", Folio, CveOrdenCompra, Encripta(String.Format("OP=OC&CVEOC={0}", CveOrdenCompra)))
'Dim Descripcion = $"Importe anticipo : ${TxtSAImporte.Text.FormatoNumero} ({TxtSAImPorcentaje.Text}%) - <a target=""_blank"" href=""/Bancos/IE.aspx?Opcion=EGSSINFACT&CveOC={CveOrdenCompra}"">Pagar anticipo</a> - <b>Observacion:</b> {TxtSAObservaciones.Text} "
Dim Asunto = $"{lblFolio.Text} - Solicitud de anticipo "
Dim Asunto As String = $"{lblFolio.Text} - Solicitud de anticipo "
Dim ObjOC As New ClsOC
Dim ObjOI As New ClsOIEventos(ObjOC.IniciaTransacSQL)
Dim TieneError = False
Dim TieneError As Boolean = False
If ObjOI.AddEventoTarea(Asunto, Descripcion.ToString, 1, UsuarioActual.CveUsuario, DdlSAUsuario.SelectedValue.ToString.ToEntero, DateTime.Now, DateTime.Now.AddMinutes(15), -1, 1, -1, "-1", -1, -1, -1, -1, -1, CveOrdenCompra.ToEntero, -1, -1, UsuarioActual.CveUsuario, -1, CveEmpresaActual) Then
If Not ObjOC.AddSolicitudAnticipo(CveOrdenCompra, TxtSAImporte.Text.ToDecimal, CveEmpresaActual) Then
@@ -5362,27 +5333,21 @@ Partial Class OC_OC
TieneError = True
End If
If Not ObjOI.AddEventoBitacora($"Solicitud de anticipo de orden de compra por ${TxtSAImporte.Text.FormatoNumero}", "-1", UsuarioActual.CveUsuario, CveEmpresaActual, CveOC:=CveOrdenCompra) Then
TieneError = True
End If
If Not TieneError Then
RegistraScript("$('#ModalSolicitarAnticipo').modal('hide');", "ModalSolicitarAnticipoHide")
ObjOC.Commit()
EnviaCorreoSolicitudAnticipo(ObjOI.CveEvento)
'LIMPIA
BtnSolicitudAnticipo.Visible = False
DdlSAUsuario.SelectedValue = "-1"
TxtSAImporte.Text = ""
TxtSAObservaciones.Text = ""
TxtSAImPorcentaje.Text = ""
Alert("La solicitud de anticipo ha sido enviada correctamente.", TipoMensaje.MsgInformacion)
Else
ObjOC.RollBack()
Alert("Ocurrió un error al hacer la solicitud de anticipo.", TipoMensaje.MsgError)
@@ -5579,14 +5544,14 @@ Partial Class OC_OC
Dim PorcentajeGanancia As Decimal = 0.3D
For Each Row As DataRow In DtDetalle.Rows
Dim CvePS As Integer = Row("CvePS").ToString.ToEntero
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal
Dim PU As Decimal = Row("Importe").ToString.ToDecimal() + (Row("Importe").ToString.ToDecimal() * PorcentajeGanancia)
Dim TotalCalculableImpuestos = (Cantidad * (PU))
Dim TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Dim TotalCalculableImpuestos As Decimal = (Cantidad * (PU))
Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Dim PorcentajeIEPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal
@@ -5617,7 +5582,7 @@ Partial Class OC_OC
#End Region
Private Function notienepresupuesto() As Boolean
Dim notienerecursos = False
Dim notienerecursos As Boolean = False
Dim SinRecursos As New StringBuilder
SinRecursos.AppendFormat("No se cuenta con los Recursos Suficientes en los siguientes subproyectos ")
Dim subproyectosSr As New List(Of Integer)
@@ -7278,7 +7243,7 @@ Partial Class OC_OC
'SE ACTUALIZA EL IVA DEL DtDetalle SI ES QUE AHORA SE VA A TOMAR EN CUENTA EL IVA
For Each Row As DataRow In DtDetalle.Rows
If Not Math.Round(DdlIVA.SelectedValue.ToDecimal, 2) = 1 Then
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=Row("CvePS").ToString.ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=Row("CvePS").ToString.ToEntero).FiltroPrimero("")
If DrPS IsNot Nothing Then
Row("IVAPorcentaje") = If(DrPS("IVA").ToString.ToEntero = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0)
Row("IVA") = Row("IVAPorcentaje").ToString.ToDecimal * Row("Total").ToString.ToDecimal
@@ -7413,12 +7378,12 @@ Partial Class OC_OC
TxtDescuento.Text = TxtDescuento.Text.FormatoNumero
HdnDescuento.Value = TxtDescuento.Text
Dim Total = 0.0D
Dim Descuento = 0.0D
Dim Porcentaje = TxtDescuento.Text.ToDecimal / DtDetalle.SUM("Total")
Dim Total As Decimal = 0.0D
Dim Descuento As Decimal = 0.0D
Dim Porcentaje As Decimal = TxtDescuento.Text.ToDecimal / DtDetalle.SUMD("Total")
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
Descuento = ((Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100).ToDecimal
Descuento = ((Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100.0)) / 100.0).ToDecimal
Dr("Descuento") = Descuento
Total = (Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal) - Descuento
Dr("Total") = Math.Round(Total, 2)
@@ -7461,10 +7426,10 @@ Partial Class OC_OC
UPPDetalle.Update()
End Sub
Private Function ValidarDescuentos() As Boolean
Dim Retorno = True
Dim Retorno As Boolean = True
Dim DescuentoConceptos = DtDetalle.SUM("Descuento")
Dim DescuentoGeneral = TxtDescuento.Text.ToDecimal
Dim DescuentoConceptos As Decimal = DtDetalle.SUMD("Descuento")
Dim DescuentoGeneral As Decimal = TxtDescuento.Text.ToDecimal
If DescuentoConceptos <> DescuentoGeneral Then
Alert(String.Format("Los descuentos no cuadran. Por favor de verificar.({0}-{1})", DescuentoConceptos, DescuentoGeneral), TipoMensaje.MsgAdvertencia)
@@ -7580,7 +7545,7 @@ Partial Class OC_OC
TxtRetISR.Text = TxtRetISR.Text.FormatoNumero
HdnRetISR.Value = TxtRetISR.Text
Dim Porcentaje = TxtRetISR.Text.ToDecimal / DtDetalle.SUM("Total")
Dim Porcentaje As Decimal = TxtRetISR.Text.ToDecimal / DtDetalle.SUMD("Total")
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
Dr("RetISR") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
@@ -7686,7 +7651,7 @@ Partial Class OC_OC
Dim Cantidad As Decimal = row.FCTextBox("TxtCantContrato").Text.Trim.ToDecimal
Dim Importe As Decimal = row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDecimal
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimero("")
Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -7754,7 +7719,6 @@ Partial Class OC_OC
#End Region
#Region "DIRECCION ENVIO"
Protected Sub CargaDdlSucursalCliente()
Dim ObjCliente As New ClsClientes
@@ -7796,8 +7760,8 @@ Partial Class OC_OC
End If
Dim ObjClientes As New ClsClientes
Dim TieneError = False
Dim Estatus = If(ChkEstatus.Checked, 1, 0)
Dim TieneError As Boolean = False
Dim Estatus As Integer = If(ChkEstatus.Checked, 1, 0)
CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(Ddlcliente.txtValue.Value.ToEntero, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""))
@@ -7805,8 +7769,6 @@ Partial Class OC_OC
TieneError = True
End If
If TieneError Then
Alert("Ocurrio un error al agregar/actualizar la dirección de envío", TipoMensaje.MsgError)
Else
@@ -7954,7 +7916,7 @@ Partial Class OC_OC
Dim FileExcel As New ExcelFile()
Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
Dim worksheet As ExcelWorksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
@@ -7964,7 +7926,7 @@ Partial Class OC_OC
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
Dim columnCount = worksheet.CalculateMaxUsedColumns()
Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns()
For i = 0 To columnCount
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
Next
@@ -7976,7 +7938,7 @@ Partial Class OC_OC
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim dt As DataTable = Nothing
Dim ErrorArchivo = False
Dim ErrorArchivo As Boolean = False
Try
dt = ReadExcelFile(Ruta + FileName, True)
@@ -8047,7 +8009,7 @@ Partial Class OC_OC
If CveProveedor > 0 Then
If objCotizacion.AddCotizacion(CveOrdenCompra, CveProveedor, -1, Folio, TxtFecha.Text, "", DdlMoneda.SelectedValue.ToEntero, 0, UsuarioActual.CveUsuario) Then
For Each dr As DataRow In dt.Rows
Dim RowPS = DtOCDetalle.FiltroPrimero(String.Format("Codigo='{0}'", dr("Codigo").ToString()))
Dim RowPS As DataRow = DtOCDetalle.FiltroPrimero(String.Format("Codigo='{0}'", dr("Codigo").ToString()))
Dim CveOrdenCompraDetalle As Integer = RowPS("CveOrdenCompraDetalle").ToString().ToEntero()
Dim CvePS As Integer = RowPS("CvePS").ToString().ToEntero()