diff --git a/AF/AF.aspx b/AF/AF.aspx index d4756bf89..d5eab06f6 100644 --- a/AF/AF.aspx +++ b/AF/AF.aspx @@ -218,21 +218,21 @@
- +
- +
- - + + @@ -248,6 +248,35 @@
+ + + +
+
+ +
+ +
+
+
+ + + + +
+ + + + <%-- + + + + --%> + +
+
+ +
@@ -1153,68 +1182,82 @@ - + -
-
-
- Servicios + + + + + + +
+
+
+
+
+ + Mantenimientos + +
+
+
+ Agregar +
+
+ +
+ <%-- + + + --%> + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
-
- - - - -
+ + + + + + @@ -2076,7 +2119,147 @@ + + + + + + + + + +
+
+
+
+
+ + Producción + +
+
+
+ Agregar +
+
+ +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + + + + + +
+
+
+
+
+ + Plagas Enfermedades + +
+
+
+ Agregar +
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + + + + + @@ -3106,6 +3289,261 @@
+ + + <%--MODAL PRODUCCION--%> + + + + + + + <%--MODAL MANTENIMIENTO--%> + + + + + + diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index 8dad34b1f..2b9409625 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -14,7 +14,11 @@ Partial Class AF_AF 'Configuración #Region "PROPIEDADES" Private Property CveActivoFijo As Integer - Get + Get + + If ViewState("CveActivoFijo") Is Nothing Then + ViewState("CveActivoFijo") = -1 + End If Return ViewState("CveActivoFijo").ToString.ToEntero End Get Set(value As Integer) @@ -22,7 +26,10 @@ Partial Class AF_AF End Set End Property Private Property CodigoAF As String - Get + Get + If ViewState("CodigoAF") Is Nothing Then + ViewState("CodigoAF") = "" + End If Return ViewState("CodigoAF").ToString End Get Set(value As String) @@ -245,8 +252,125 @@ Partial Class AF_AF #End Region + + Private Property CveProduccion As Integer + Get + If ViewState("CveProduccion") Is Nothing Then + ViewState("CveProduccion") = -1 + End If + Return ViewState("CveProduccion").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveProduccion") = value + End Set + End Property + + Private Property IndexProduccion As Integer + Get + If ViewState("IndexProduccion") Is Nothing Then + ViewState("IndexProduccion") = -1 + End If + Return ViewState("IndexProduccion").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IndexProduccion") = value + End Set + End Property + + + Private Property CveMantenimiento As Integer + Get + If ViewState("CveMantenimiento") Is Nothing Then + ViewState("CveMantenimiento") = -1 + End If + Return ViewState("CveMantenimiento").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMantenimiento") = value + End Set + End Property + + + Private Property IndexMantenimiento As Integer + Get + If ViewState("IndexMantenimiento") Is Nothing Then + ViewState("IndexMantenimiento") = -1 + End If + Return ViewState("IndexMantenimiento").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IndexMantenimiento") = value + End Set + End Property + + Private Property CvePlagaEnfermedad As Integer + Get + If ViewState("CvePlagaEnfermedad") Is Nothing Then + ViewState("CvePlagaEnfermedad") = -1 + End If + Return ViewState("CvePlagaEnfermedad").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CvePlagaEnfermedad") = value + End Set + End Property + + + Private Property IndexPlagaEnfermedad As Integer + Get + If ViewState("IndexPlagaEnfermedad") Is Nothing Then + ViewState("IndexPlagaEnfermedad") = -1 + End If + Return ViewState("IndexPlagaEnfermedad").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IndexPlagaEnfermedad") = value + End Set + End Property + #End Region + + + Private Property DT_Produccion As DataTable + Get + If ViewState("DT_Produccion") Is Nothing Then + ViewState("DT_Produccion") = CreaDTProduccion() + End If + Return DirectCast(ViewState("DT_Produccion"), DataTable) + End Get + Set(value As DataTable) + ViewState("DT_Produccion") = value + End Set + End Property + + + Private Property DT_PlgaEfermedad As DataTable + Get + If ViewState("DT_PlgaEfermedad") Is Nothing Then + ViewState("DT_PlgaEfermedad") = CreaDTPlagaEngermedad() + End If + Return DirectCast(ViewState("DT_PlgaEfermedad"), DataTable) + End Get + Set(value As DataTable) + ViewState("DT_PlgaEfermedad") = value + End Set + End Property + + + Private Property DT_Mantenimiento As DataTable + Get + If ViewState("DT_Mantenimiento") Is Nothing Then + ViewState("DT_Mantenimiento") = CreaDTMantenimiento() + End If + Return DirectCast(ViewState("DT_Mantenimiento"), DataTable) + End Get + Set(value As DataTable) + ViewState("DT_Mantenimiento") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -256,13 +380,19 @@ Partial Class AF_AF CargaCuentasContables() End If + CargaCombos() + If Request("CveActivoFijo") IsNot Nothing AndAlso IsNumeric(Request("CveActivoFijo")) AndAlso Request("CveActivoFijo").ToEntero > 0 Then ViewState("CveActivoFijo") = Request("CveActivoFijo") CargaDatos() CargaEventos() - CargaActividades() - - 'Configuración de Modalidad Update + CargaActividades() + CargaProduccion() + CargaMantenimento() + CargaPlagaEnfermedad() + ModalidadesPaginaAF() + + 'Configuración de Modalidad Update BtnGuardar.Text = "Guardar Cambios" LtlTitulo.Text = "Consulta del Activo Fijo:" @@ -270,9 +400,10 @@ Partial Class AF_AF HlEvento.Visible = True HlEvento.NavigateUrl = String.Format("/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveActivoFijo=" & CveActivoFijo & "&TB_iframe=true&height=370&width=600;") Else - ViewState("CveActivoFijo") = -1 - CargaCombos() - 'Configuración de Modalidad Insert + ViewState("CveActivoFijo") = -1 + + + 'Configuración de Modalidad Insert ImgAddObs.Visible = False LblFechaCaptura.Text = Now.ToShortDateString() LblUsuarioCapturo.Text = UsuarioActual.Usuario @@ -288,6 +419,15 @@ Partial Class AF_AF CargaAFInv() cargaOrdenesdeservicio() + + + + If Request("Op") IsNot Nothing Then + ModalidadesPaginaAFInicial(Request("Op").ToString) + End If + + + End If End Sub Private Sub cargaOrdenesdeservicio() @@ -374,6 +514,127 @@ Partial Class AF_AF End Sub + + Private Sub ModalidadesPaginaAFInicial(Optional Op As String = "") + + TabProduccion.Visible = False + TabPlagaEnfermedad.Visible = False + TabServyMant.Visible = False + + LblFechaCompra.Text = "Fecha de Compra:" + LblFechaBaja.Text = "Fecha de Baja:" + + + If Op.Length > 0 Then + + 'Arbol Frutal + If Op = "AR" Then + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + + LblFechaCompra.Text = "Fecha de Nacimiento" + LblFechaBaja.Text = "Fecha de Muerte" + TabProduccion.Visible = True + + End If + + 'Arbol Apicola + If Op = "AP" Then + + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'APICOLAS'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'APICOLAS'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + TabPlagaEnfermedad.Visible = True + + End If + + 'Pozos + If Op = "PO" Then + + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'POZOS'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'POZOS'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + TabServyMant.Visible = True + End If + + 'Inmuebles + If Op = "IN" Then + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'INMUEBLES'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'INMUEBLES'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + End If + + UpDatos.Update() + + End If + + End Sub + + + Private Sub ModalidadesPaginaAF() + + TabProduccion.Visible = False + TabPlagaEnfermedad.Visible = False + TabServyMant.Visible = False + + LblFechaCompra.Text = "Fecha de Compra:" + LblFechaBaja.Text = "Fecha de Baja:" + + + If DdlTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" And DdlSubTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" Then + LblFechaCompra.Text = "Fecha de Nacimiento" + LblFechaBaja.Text = "Fecha de Muerte" + TabProduccion.Visible = True + End If + + 'Arbol Apicola + If DdlTipoActivoFijo.SelectedItem.Text = "APICOLAS" And DdlSubTipoActivoFijo.SelectedItem.Text = "APICOLAS" Then + TabPlagaEnfermedad.Visible = True + End If + + 'Pozos + If DdlTipoActivoFijo.SelectedItem.Text = "POZOS" And DdlSubTipoActivoFijo.SelectedItem.Text = "POZOS" Then + TabServyMant.Visible = True + End If + + 'Inmuebles + If DdlTipoActivoFijo.SelectedItem.Text = "INMUEBLES" And DdlSubTipoActivoFijo.SelectedItem.Text = "INMUEBLES" Then + + End If + + + + + + UpDatos.Update() + + End Sub + #Region " CARGA COMBOS " Private Sub CargaCombos() CargaTipoActivoFijo() @@ -398,17 +659,24 @@ Partial Class AF_AF DdlResponsable.Enabled = False End If + CargaCultivos() + End Sub Private Sub CargaTipoActivoFijo() DdlTipoActivoFijo.DataSource = GlobalDTTipoActivoFijo(CveEmpresaActual).FiltraParametros("", "TipoActivoFijo") DdlTipoActivoFijo.DataBind() + CargaSubTipoActivoFijo() End Sub Private Sub CargaSubTipoActivoFijo() + DdlSubTipoActivoFijo.Items.Clear() DdlSubTipoActivoFijo.DataSource = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format("CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo") DdlSubTipoActivoFijo.DataBind() DdlSubTipoActivoFijo.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlSubTipoActivoFijo.SelectedIndex = 0 + + UpDatos.Update() + End Sub Private Sub CargaDispositivos() DivDispositivo.Visible = False @@ -476,16 +744,94 @@ Partial Class AF_AF ' DdlClientes.DataBind() 'End Sub + Private Sub CargaCultivos() + DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlModalCultivosCuadro.DataBind() + DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + End Sub + + + Private Function CreaDTProduccion() As DataTable + 'CveProduccion, CveActivoFijo, CveCultivoCuadroDetalle, Cantidad, Fecha, CveUsuario, FechaIng, Codigo, Descripcion, Usuario, Cuadro + + Dim DTProduccion As New DataTable + + + DTProduccion.Columns.Add("CveProduccion", GetType(Integer)) + DTProduccion.Columns.Add("CveActivoFijo", GetType(Integer)) + DTProduccion.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) + DTProduccion.Columns.Add("Cantidad", GetType(Decimal)) + DTProduccion.Columns.Add("Fecha", GetType(Date)) + DTProduccion.Columns.Add("Cuadro", GetType(String)) + + DTProduccion.Columns.Add("CveUsuario", GetType(Integer)) + DTProduccion.Columns.Add("FechaIng", GetType(Date)) + DTProduccion.Columns.Add("Codigo", GetType(String)) + DTProduccion.Columns.Add("Descripcion", GetType(String)) + DTProduccion.Columns.Add("Usuario", GetType(String)) + + + Return DTProduccion + + End Function + + Private Function CreaDTPlagaEngermedad() As DataTable + 'CvePlagaEnfermedad,CveActivoFijo,Observaciones,Fecha,CveUsuario,FechaIng + Dim DTPlgaEfermedad As New DataTable + + DTPlgaEfermedad.Columns.Add("CvePlagaEnfermedad", GetType(Integer)) + DTPlgaEfermedad.Columns.Add("CveActivoFijo", GetType(Integer)) + + DTPlgaEfermedad.Columns.Add("Observaciones", GetType(String)) + DTPlgaEfermedad.Columns.Add("Fecha", GetType(Date)) + + DTPlgaEfermedad.Columns.Add("CveUsuario", GetType(Integer)) + DTPlgaEfermedad.Columns.Add("FechaIng", GetType(Date)) + + DTPlgaEfermedad.Columns.Add("Usuario", GetType(String)) + + + + Return DTPlgaEfermedad + + End Function + + Private Function CreaDTMantenimiento() As DataTable + 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion,Usuario,Archivo + Dim DTMantenimiento As New DataTable + + DTMantenimiento.Columns.Add("CveMantenimiento", GetType(Integer)) + DTMantenimiento.Columns.Add("CveActivoFijo", GetType(Integer)) + + DTMantenimiento.Columns.Add("Mantenimiento", GetType(String)) + DTMantenimiento.Columns.Add("Observaciones", GetType(String)) + DTMantenimiento.Columns.Add("Fecha", GetType(Date)) + DTMantenimiento.Columns.Add("FechaIng", GetType(Date)) + + DTMantenimiento.Columns.Add("CveUsuario", GetType(Integer)) + DTMantenimiento.Columns.Add("Codigo", GetType(String)) + DTMantenimiento.Columns.Add("Descripcion", GetType(String)) + DTMantenimiento.Columns.Add("Usuario", GetType(String)) + DTMantenimiento.Columns.Add("Archivo", GetType(String)) + + + Return DTMantenimiento + + End Function + + Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged CargaSubProyecto() End Sub Private Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubProyecto.SelectedIndexChanged CargaFolios() + CargaCultivos() End Sub Protected Sub DdlTipoActivoFijo_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlTipoActivoFijo.SelectedIndexChanged CargaFolios() + ModalidadesPaginaAF() End Sub Private Sub CargaFolios() @@ -562,6 +908,13 @@ Partial Class AF_AF DdlModelos.DataBind() DdlModelos.Items.Insert(0, New ListItem("-", "-1")) End Sub + + Private Sub CargaProduccionCuadros() + DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlModalCultivosCuadro.DataBind() + DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + End Sub + #End Region Private Sub CargaDatos() @@ -579,7 +932,13 @@ Partial Class AF_AF TxtDescripcion.Text = ObjActivoFijo.Descripcion TxtCodigo.Text = ObjActivoFijo.Codigo TxtValorCompra.Text = ObjActivoFijo.ValorCompra.ToString.FormatoNumero - TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString + TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString + + + + TxtFechaBaja.Text = If(ObjActivoFijo.FechaBaja = New Date(1900, 1, 1), "", ObjActivoFijo.FechaBaja.ToString("dd/MM/yyyy")) + + DdlTipoActivoFijo.SelectedValue = ObjActivoFijo.CveTipoActivoFijo.ToString CargaSubTipoActivoFijo() DdlSubTipoActivoFijo.SelectedValue = ObjActivoFijo.CveSubTipoActivoFijo.ToString @@ -654,8 +1013,8 @@ Partial Class AF_AF CargaPlacas() CargaLicencias() - CargaSeguros() - CargaServicios() + CargaSeguros() + CargaFallas() CargaAccidentes() @@ -1062,31 +1421,22 @@ Partial Class AF_AF #End Region #Region "S E R V I C I O S - M A N T E M I E N T O" - Public Sub CargaServicios() - Dim TmpServicios As New DataTable - TmpServicios.Columns.Add("CveProveedor", GetType(Integer)) - TmpServicios.Columns.Add("CveCompra", GetType(Integer)) - TmpServicios.Columns.Add("Tipo", GetType(String)) - TmpServicios.Columns.Add("Fecha", GetType(Date)) - TmpServicios.Columns.Add("Proveedor", GetType(String)) - TmpServicios.Columns.Add("Factura", GetType(String)) - TmpServicios.Columns.Add("OdHorometro", GetType(Double)) - TmpServicios.Columns.Add("Observaciones", GetType(String)) - - 'Dim Row As DataRow = TmpServicios.NewRow - 'Row("CveProveedor") = 3100 - 'Row("CveCompra") = 181656 - 'Row("Tipo") = "Preventivo" - 'Row("Fecha") = "01/02/2016" - 'Row("Proveedor") = "EMPRESAS MATCO, S.A. DE C.V." - 'Row("Factura") = "HERAA-158591" - 'Row("OdHorometro") = "198,567" - 'Row("Observaciones") = "Servicio Preventivo 200,000 Kilometros - Servicio Completo" - 'TmpServicios.Rows.Add(Row) - - GvServiciosMant.DataSource = TmpServicios - GvServiciosMant.DataBind() - End Sub + 'Public Sub CargaServicios() + ' Dim TmpServicios As New DataTable + ' TmpServicios.Columns.Add("CveProveedor", GetType(Integer)) + ' TmpServicios.Columns.Add("CveCompra", GetType(Integer)) + ' TmpServicios.Columns.Add("Tipo", GetType(String)) + ' TmpServicios.Columns.Add("Fecha", GetType(Date)) + ' TmpServicios.Columns.Add("Proveedor", GetType(String)) + ' TmpServicios.Columns.Add("Factura", GetType(String)) + ' TmpServicios.Columns.Add("OdHorometro", GetType(Double)) + ' TmpServicios.Columns.Add("Observaciones", GetType(String)) + + + + ' GvServiciosMant.DataSource = TmpServicios + ' GvServiciosMant.DataBind() + 'End Sub #End Region #Region "F A L L A S" @@ -2106,6 +2456,8 @@ Partial Class AF_AF Dim ObjContabilidad As New ClsContabilidad(ObjAF.IniciaTransacSQL()) Dim ErrorGuardar As Boolean = False + Dim FechaBaja As Date = If(TxtFechaBaja.Text = "", MinFecha, TxtFechaBaja.Text.ToDate) + If CveActivoFijo <= 0 Then 'SALIDA DE ALMACEN PARA IMPORTACION @@ -2123,16 +2475,96 @@ Partial Class AF_AF End If + + If Not ErrorGuardar Then If ObjAF.AddActivosFijos(TxtCodigo.Text.Trim, TxtDescripcion.Text.Trim, TxtValorCompra.Text.Trim.ToDouble, TxtFechaCompra.Text.Trim.ToDate, DdlSubTipoActivoFijo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, TxtNoSerie.Text.Trim, TxtAño.Text.Trim.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.Trim.ToEntero, DdlEstadoActivoFijo.SelectedValue.ToEntero, DdlCtaContableDepreciacion.SelectedValue.ToEntero, TxtPorDepreciacion.Text.Trim.ToDouble, - TxtObservaciones.Text.Trim, DdlClientes.SelectedValue.ToEntero, CveMovimientoSalidaInv, UsuarioActual.CveUsuario, CveEmpresaActual, CveMarca:=DdlMarcas.SelectedValue.ToEntero, - CveModelo:=DdlModelos.SelectedValue.ToEntero, CveGrupo:=DdlGrupo.SelectedValue.ToEntero, CveAFPadre:=DdlAFPadres.SelectedValue.ToEntero, CveDispositivo:=DdlDispositivo.SelectedValue.ToEntero) > 0 Then + TxtObservaciones.Text.Trim, Ddlclientes.SelectedValue.ToEntero, CveMovimientoSalidaInv, UsuarioActual.CveUsuario, CveEmpresaActual, CveMarca:=DdlMarcas.SelectedValue.ToEntero, + CveModelo:=DdlModelos.SelectedValue.ToEntero, CveGrupo:=DdlGrupo.SelectedValue.ToEntero, CveAFPadre:=DdlAFPadres.SelectedValue.ToEntero, CveDispositivo:=DdlDispositivo.SelectedValue.ToEntero, + FechaBaja:=FechaBaja) > 0 Then ViewState("CveActivoFijo") = ObjAF.CveActivoFijo Else ErrorGuardar = True End If + + If Not ErrorGuardar Then + + For Each GvRowProduccion As GridViewRow In GvProduccion.Rows + If Not ObjAF.AddProduccion(ObjAF.CveActivoFijo, GvRowProduccion.DataKey("CveCultivoCuadroDetalle").ToEntero, GvRowProduccion.DataKey("Cantidad").ToDecimal, GvRowProduccion.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then + ErrorGuardar = True + Exit For + End If + Next + + + If Not ErrorGuardar Then + For Each GvRowPlagaEnfermedad As GridViewRow In GvPlagaEnfermedad.Rows + If Not ObjAF.AddPlagaEnfermedad(ObjAF.CveActivoFijo, GvRowPlagaEnfermedad.DataKey("Observaciones"), GvRowPlagaEnfermedad.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then + ErrorGuardar = True + Exit For + End If + Next + End If + + + + If Not ErrorGuardar Then + + + For Each GvRowMantenimiento As GridViewRow In GvMantenimientos.Rows + + Dim CveMantenimientoTemp As Integer = ObjAF.AddMantenimientos(ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, "") + + If CveMantenimientoTemp > 0 Then + + If GvRowMantenimiento.DataKey("Archivo").Trim.Length > 0 Then + + Dim fi As New FileInfo(GvRowMantenimiento.DataKey("Archivo").Trim) + + If fi.Exists Then + + Dim Filename As String = fi.Name + Dim FileExtension As String = IO.Path.GetExtension(fi.FullName) + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorGuardar = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + If Not ErrorGuardar Then + If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}{FileExtension}") Then + ErrorGuardar = True + End If + End If + + End If + + End If + + + Else + ErrorGuardar = True + Exit For + End If + + Next + + + + End If + + + + + End If + End If 'PREPOLIZA DE IMPORTACION DESDE ALMACEN @@ -2155,8 +2587,9 @@ Partial Class AF_AF If Not ObjAF.UpdateActivosFijos(CveActivoFijo.ToString.ToEntero, TxtCodigo.Text.Trim, TxtDescripcion.Text.Trim, TxtValorCompra.Text.Trim.ToDouble, TxtFechaCompra.Text.Trim.ToDate, DdlSubTipoActivoFijo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, TxtNoSerie.Text.Trim, TxtAño.Text.Trim.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.Trim.ToEntero, DdlEstadoActivoFijo.SelectedValue.ToEntero, DdlCtaContableDepreciacion.SelectedValue.ToEntero, - TxtPorDepreciacion.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, DdlClientes.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CveEmpresaActual, - CveMarca:=DdlMarcas.SelectedValue.ToEntero, CveModelo:=DdlModelos.SelectedValue.ToEntero, CveGrupo:=DdlGrupo.SelectedValue.ToEntero, CveAFPadre:=DdlAFPadres.SelectedValue.ToEntero, CveDispositivo:=DdlDispositivo.SelectedValue.ToEntero) Then + TxtPorDepreciacion.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, Ddlclientes.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CveEmpresaActual, + CveMarca:=DdlMarcas.SelectedValue.ToEntero, CveModelo:=DdlModelos.SelectedValue.ToEntero, CveGrupo:=DdlGrupo.SelectedValue.ToEntero, CveAFPadre:=DdlAFPadres.SelectedValue.ToEntero, CveDispositivo:=DdlDispositivo.SelectedValue.ToEntero, + FechaBaja:=FechaBaja) Then 'Comentado porque te redirecciona no se ocupa - 22 Enero 2016 - Israel Piña 'CargaDatos() @@ -2664,6 +3097,8 @@ Partial Class AF_AF Protected Sub DdlSubTipoActivoFijo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubTipoActivoFijo.SelectedIndexChanged CargaCaracteristicas() CargaDispositivos() + ModalidadesPaginaAF() + End Sub #Region "CARGAR CUENTA CONTABLE" @@ -3097,7 +3532,8 @@ Partial Class AF_AF TxtDescripcion.Text = DdlAFInvPS.SelectedText TxtValorCompra.Text = Costo.FormatoNumero - TxtFechaCompra.Text = Now.ToShortDateString + TxtFechaCompra.Text = Now.ToShortDateString + TxtFechaBaja.Text = "" TxtNoSerie.Text = TxtAFInvSerie.Text.Trim TxtValorCompra.Enabled = False @@ -3727,5 +4163,721 @@ Partial Class AF_AF ImprimirPDF("Empresas/Grales/Formatos/RepComprasInsumos.rdlc", DTCompras, params, "RepComprasInsumos", Formato) - End Sub + End Sub + + +#Region "Produccion" + + + + Private Sub CargaProduccion() + + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetProduccion(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvProduccion.DataSource = ObjAF.DtResultados + Else + GvProduccion.DataSource = Nothing + End If + + ObjAF.Dispose() + + + Else + GvProduccion.DataSource = DT_Produccion + End If + + + GvProduccion.DataBind() + + UpProduccion.Update() + + End Sub + + + Protected Sub LnkAgregarProduccion_Click(sender As Object, e As EventArgs) + + + CveProduccion = -1 + IndexProduccion = -1 + + LblModaProduccionTitulo.Text = "Agregar Producción" + LnkModalAgregarProduccion.Text = "Agregar" + + + DdlModalCultivosCuadro.SelectedValueExist(-1) + TxtModalProduccionCantidad.Text = "" + TxtModalProduccionFecha.Text = "" + + RegistraScript("$('#DVModalProduccion').modal('show');") + + UpModalProduccion.Update() + End Sub + + Protected Sub LnkGvProduccionEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + + If CveActivoFijo > 0 Then + CveProduccion = GvRow.DataKey("CveProduccion").ToEntero + Else + IndexProduccion = GvRow.RowIndex + End If + + + Dim CveCultivoCuadroDetalle As Integer = GvRow.DataKey("CveCultivoCuadroDetalle").ToEntero + Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + DdlModalCultivosCuadro.SelectedValueExist(CveCultivoCuadroDetalle) + TxtModalProduccionCantidad.Text = Cantidad.ToString("###,###,###.00") + TxtModalProduccionFecha.Text = Fecha.ToString("dd/MM/yyyy") + + + LblModaProduccionTitulo.Text = "Actualizar Producción" + LnkModalAgregarProduccion.Text = "Actualizar" + + UpModalProduccion.Update() + + + RegistraScript("$('#DVModalProduccion').modal('show');") + End Sub + + Protected Sub LnkGvProduccionRemove_Click(sender As Object, e As EventArgs) + + Dim ErrorProceso As Boolean = False + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + If CveActivoFijo > 0 Then + + Dim CveProduccionEliminar As Integer = GvRow.DataKey("CveProduccion").ToEntero + Dim ObjAF As New ClsAF + If ObjAF.RemoveProduccion(CveProduccionEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + ObjAF.Dispose() + + Else + Dim IndexProduccionEliminar As Integer = GvRow.RowIndex + + DT_Produccion.Rows(IndexProduccionEliminar).Delete() + DT_Produccion.AcceptChanges() + ErrorProceso = False + + End If + + + If Not ErrorProceso Then + Alert("Producción Eliminada Correctamente.") + CargaProduccion() + End If + + End Sub + + + + Protected Sub LnkModalAgregarProduccion_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + + + + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + + If CveProduccion > 0 Then + If ObjAF.UpdateProduccion(CveProduccion, CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + Else + If ObjAF.AddProduccion(CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + End If + + ObjAF.Dispose() + + Else + + + If IndexProduccion >= 0 Then + DT_Produccion.Rows(IndexProduccion)("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text + DT_Produccion.Rows(IndexProduccion)("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero + DT_Produccion.Rows(IndexProduccion)("Fecha") = TxtModalProduccionFecha.Text.ToDate + DT_Produccion.Rows(IndexProduccion)("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal + Else + + Dim nRow As DataRow = DT_Produccion.NewRow + + nRow("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text + nRow("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero + nRow("Fecha") = TxtModalProduccionFecha.Text.ToDate + nRow("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal + + DT_Produccion.Rows.Add(nRow) + ErrorProceso = False + + End If + + DT_Produccion.AcceptChanges() + + End If + + + If Not ErrorProceso Then + RegistraScript("$('#DVModalProduccion').modal('hide');") + Alert("Producción Agregada Correctamente.") + CargaProduccion() + End If + + End Sub + +#End Region + +#Region "MANTENIMIENTO" + + + + + Private Sub CargaMantenimento() + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.GetMantenimientos(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvMantenimientos.DataSource = ObjAF.DtResultados + Else + GvMantenimientos.DataSource = Nothing + End If + ObjAF.Dispose() + + Else + GvMantenimientos.DataSource = DT_Mantenimiento + End If + + + GvMantenimientos.DataBind() + + UpMantenimientos.Update() + + End Sub + + + Protected Sub LnkAgregarMantenimiento_Click(sender As Object, e As EventArgs) + + + CveMantenimiento = -1 + IndexMantenimiento = -1 + + LblModaMantenimientoTitulo.Text = "Agregar Mantenimiento" + LnkModalAgregarMantenimiento.Text = "Agregar" + + + + TxtModalMantenimiento.Text = "" + TxtModalMantenimientoObservaciones.Text = "" + TxtModalMantenimientoFecha.Text = "" + TxtArchivoMantenimiento.Text = "[]" + + RegistraScript("$('#DVModalMantenimiento').modal('show');") + + UpModalMantenimiento.Update() + End Sub + + Protected Sub LnkGvMantenimientoEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion, Usuario + + + If CveActivoFijo > 0 Then + CveMantenimiento = GvRow.DataKey("CveMantenimiento").ToEntero + Else + IndexMantenimiento = GvRow.RowIndex + End If + + + Dim Mantenimiento As String = GvRow.DataKey("Mantenimiento") + Dim Observaciones As String = GvRow.DataKey("Observaciones") + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + TxtModalMantenimiento.Text = Mantenimiento + TxtModalMantenimientoObservaciones.Text = Observaciones + TxtModalMantenimientoFecha.Text = Fecha.ToString("dd/MM/yyyy") + TxtArchivoMantenimiento.Text = "[]" + + + LblModaMantenimientoTitulo.Text = "Actualizar Mantenimiento" + LnkModalAgregarMantenimiento.Text = "Actualizar" + + UpModalMantenimiento.Update() + + + RegistraScript("$('#DVModalMantenimiento').modal('show');") + End Sub + + Protected Sub LnkGvMantenimientoRemove_Click(sender As Object, e As EventArgs) + + Dim ErrorProceso As Boolean = False + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim IndexMantenimientoEliminar As Integer = GvRow.RowIndex + + If CveActivoFijo > 0 Then + Dim CveMantenimientoEliminar As Integer = GvRow.DataKey("CveMantenimiento").ToEntero + Dim ObjAF As New ClsAF + If ObjAF.RemoveMantenimientos(CveMantenimientoEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + ObjAF.Dispose() + + Else + + DT_Mantenimiento.Rows(IndexMantenimientoEliminar).Delete() + DT_Mantenimiento.AcceptChanges() + + End If + + + + + If Not ErrorProceso Then + Alert("Mantenimiento Eliminado Correctamente.") + CargaMantenimento() + End If + + End Sub + + + + Protected Sub LnkModalAgregarMantenimiento_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + Dim ObjAF As New ClsAF + ObjAF.IniciaTransacSQL() + + + If CveActivoFijo > 0 Then + + If CveMantenimiento > 0 Then + + Dim FileExtension As String = "" + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + Dim Filename As String = "-1" + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Filename = fileItem.filename + Exit For + Next + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimiento}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimiento.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorProceso = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + End If + + If Not ErrorProceso Then + If Not ObjAF.UpdateMantenimientos(CveMantenimiento, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimiento}.{FileExtension}") Then + ErrorProceso = True + End If + End If + Else + + Dim CveMantenimientoTemp As Integer = -1 + + CveMantenimientoTemp = ObjAF.AddMantenimientos(CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, "-1") + If CveMantenimientoTemp > 0 Then + ErrorProceso = False + Else + ErrorProceso = True + End If + + If Not ErrorProceso Then + + Dim FileExtension As String = "" + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + Dim Filename As String = "" + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Filename = fileItem.filename + Exit For + Next + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorProceso = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + If Not ErrorProceso Then + If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}.{FileExtension}") Then + ErrorProceso = True + End If + End If + End If + End If + End If + + + + If Not ErrorProceso Then + TxtArchivoMantenimiento.Text = "" + UpModalMantenimiento.Update() + End If + + + If Not ErrorProceso Then + ObjAF.Commit() + ObjAF.Dispose() + + 'RegistraScript("$('#DVModalMantenimiento').modal('hide');") + 'Alert("Mantenimiento Guardado Correctamente.") + 'CargaMantenimento() + Else + ObjAF.RollBack() + ObjAF.Dispose() + End If + + + Else + + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + + + If IndexMantenimiento >= 0 Then + + DT_Mantenimiento.Rows(IndexMantenimiento)("Mantenimiento") = TxtModalMantenimiento.Text + DT_Mantenimiento.Rows(IndexMantenimiento)("Observaciones") = TxtModalMantenimientoObservaciones.Text + DT_Mantenimiento.Rows(IndexMantenimiento)("Fecha") = TxtModalMantenimientoFecha.Text.ToDate + + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + + Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) + + If fi.Exists Then + DT_Mantenimiento.Rows(IndexMantenimiento)("Archivo") = fi.FullName + End If + + Exit For + Next + End If + + DT_Mantenimiento.AcceptChanges() + + Else + + Dim nRow As DataRow = DT_Mantenimiento.NewRow + + nRow("Mantenimiento") = TxtModalMantenimiento.Text + nRow("Observaciones") = TxtModalMantenimientoObservaciones.Text + nRow("Fecha") = TxtModalMantenimientoFecha.Text.ToDate + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + + Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) + + If fi.Exists Then + nRow("Archivo") = fi.FullName + End If + + Exit For + Next + End If + + DT_Mantenimiento.Rows.Add(nRow) + DT_Mantenimiento.AcceptChanges() + + End If + + TxtArchivoMantenimiento.Text = "" + + End If + + If Not ErrorProceso Then + RegistraScript("$('#DVModalMantenimiento').modal('hide');") + Alert("Mantenimiento Guardado Correctamente.") + CargaMantenimento() + End If + + + + End Sub + + Protected Sub LnkDescargaArcgivo_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Archivo As String = GvRow.DataKey("Archivo") + + Dim InfArchivo As FileInfo + + If CveActivoFijo > 0 Then + InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") + Else + InfArchivo = New FileInfo(Archivo) + End If + + If InfArchivo.Exists Then + + Response.Clear() + Response.AppendHeader("Content-Disposition", "attachment; filename=" + InfArchivo.Name) + Response.AppendHeader("Content-Length", InfArchivo.Length.ToString()) + Response.ContentType = "application/octet-stream" + Response.WriteFile(InfArchivo.FullName) + + Response.End() + + End If + + + + End Sub + + Protected Sub GvMantenimientos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Archivo As String = e.Row.DataKey("Archivo") + + If Archivo.Length > 0 Then + + + Dim InfArchivo As FileInfo + + If CveActivoFijo > 0 Then + InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") + Else + InfArchivo = New FileInfo(Archivo) + End If + + If InfArchivo.Exists Then + e.Row.FCLinkButton("LnkDescargaArcgivo").Visible = True + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkDescargaArcgivo")) + End If + + + End If + + + End If + + End Sub + +#End Region + + +#Region "PLAGA ENFERMEDAD" + + + + Private Sub CargaPlagaEnfermedad() + + + + If CveActivoFijo > 0 Then + Dim ObjAF As New ClsAF + If ObjAF.GetPlagaEnfermedad(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvPlagaEnfermedad.DataSource = ObjAF.DtResultados + Else + GvPlagaEnfermedad.DataSource = Nothing + End If + + ObjAF.Dispose() + Else + GvPlagaEnfermedad.DataSource = DT_PlgaEfermedad + End If + + + GvPlagaEnfermedad.DataBind() + + UpPlagaEnfermedad.Update() + + End Sub + + + Protected Sub LnkAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) + + + If CveActivoFijo > 0 Then + CvePlagaEnfermedad = -1 + Else + IndexProduccion = -1 + End If + + + LblModalTituloPlagaEnfermedad.Text = "Agregar Plaga Enfermedad" + LnkModalAgregarProduccion.Text = "Agregar" + + + + TxtModalPlagaEnfermedadObservaciones.Text = "" + TxtModalPlagaEnfermedadFecha.Text = "" + + RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") + + UpModalPlagaEnfermedad.Update() + End Sub + + Protected Sub LnkGvPlagaEnfermedadEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + If CveActivoFijo > 0 Then + CvePlagaEnfermedad = GvRow.DataKey("CvePlagaEnfermedad").ToEntero + Else + IndexPlagaEnfermedad = GvRow.RowIndex + End If + + Dim Observaciones As String = GvRow.DataKey("Observaciones") + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + + TxtModalPlagaEnfermedadObservaciones.Text = Observaciones + TxtModalPlagaEnfermedadFecha.Text = Fecha.ToString("dd/MM/yyyy") + + + LblModalTituloPlagaEnfermedad.Text = "Actualizar plaga enfermedad" + LnkModalAgregarPlagaEnfermedad.Text = "Actualizar" + + UpModalPlagaEnfermedad.Update() + + + RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") + End Sub + + Protected Sub LnkGvPlagaEnfermedadRemove_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim ErrorProceso As Boolean = False + + If CveActivoFijo > 0 Then + Dim CvePlagaEnfermedadEliminar As Integer = GvRow.DataKey("CvePlagaEnfermedad").ToEntero + Dim ObjAF As New ClsAF + + If ObjAF.RemovePlagaEnfermedad(CvePlagaEnfermedadEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + Else + + Dim IndexPlagaEnfermedadEliminar As Integer = GvRow.RowIndex + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedadEliminar).Delete() + DT_PlgaEfermedad.AcceptChanges() + ErrorProceso = False + + End If + + + If Not ErrorProceso Then + Alert("Plaga Enfermedad Eliminada Correctamente.") + CargaPlagaEnfermedad() + End If + + End Sub + + + + Protected Sub LnkModalAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + If CvePlagaEnfermedad > 0 Then + If ObjAF.UpdatePlagaEnfermedad(CvePlagaEnfermedad, CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + Else + If ObjAF.AddPlagaEnfermedad(CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + End If + ObjAF.Dispose() + + Else + + If IndexPlagaEnfermedad >= 0 Then + + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Usuario") = UsuarioActual.Usuario + + Else + + Dim nRow As DataRow = DT_PlgaEfermedad.NewRow + + nRow("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text + nRow("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate + nRow("Usuario") = UsuarioActual.Usuario + + DT_PlgaEfermedad.Rows.Add(nRow) + + DT_PlgaEfermedad.AcceptChanges() + + + + End If + ErrorProceso = False + End If + + + + + If Not ErrorProceso Then + RegistraScript("$('#DVModalPlagaEnfermedad').modal('hide');") + Alert("Plaga Enfermedad guardada Correctamente.") + CargaPlagaEnfermedad() + End If + + End Sub + +#End Region + + + + End Class \ No newline at end of file diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx b/Acumuladores/RepEntradasUsadosClientes.aspx index d5b839932..5bb9a18ac 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx +++ b/Acumuladores/RepEntradasUsadosClientes.aspx @@ -81,16 +81,27 @@ + ToolTip="Listado de Movimientos" DataKeyNames="EsDistribuidor,Codigo,Codigo_Clientes,Total,CveCliente,NombreComercial,CvePS,CveVenta,SerieFolio,Cantidad" CssClass="Widthall table table-striped table-hover ScrollAD" GridLines="None"> - - - <%--OnClick="CargarVentasGrupo"--%> - + + + <%----%> + + + + + + + + + + + + diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx.vb b/Acumuladores/RepEntradasUsadosClientes.aspx.vb index 25e180f3d..ed0a413f1 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx.vb +++ b/Acumuladores/RepEntradasUsadosClientes.aspx.vb @@ -65,10 +65,29 @@ Partial Class Acumuladores_RepEntradasUsadosClientes Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("EsHeader").ToString = "-1" Or e.Row.DBCampo("Codigo").ToString = "" Then + If e.Row.DBCampo("EsHeader").ToString = "-1" Or e.Row.DBCampo("Codigo").ToString = "" And e.Row.DataKey("CveVenta").ToString.ToEntero = 0 Then e.Row.CssClass = "SubTotales2" + End If + + If e.Row.DataKey("CvePS").ToString.ToEntero > 0 And e.Row.DataKey("CveVenta").ToString.ToEntero = 0 Then + e.Row.CssClass = "SubTotales" + End If + + + If e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then + e.Row.Cells(1).Text = $"{e.Row.DataKey("SerieFolio")}" + Else + e.Row.Cells(2).Text = "" + e.Row.Cells(3).Text = "" + e.Row.Cells(4).Text = "" + 'e.Row.Cells(6).Text = "" End If + If e.Row.DataKey("EsDistribuidor") <> "" Then + e.Row.Cells(5).Text = $"{e.Row.DataKey("Total").ToDecimal.ToString("#########")}" + End If + + End If End Sub diff --git a/App_Code/ADSBase.vb b/App_Code/ADSBase.vb index 979b1af09..708cac5cb 100644 --- a/App_Code/ADSBase.vb +++ b/App_Code/ADSBase.vb @@ -180,6 +180,10 @@ Public Class ADSBase If Not IsNothing(pr.SqlDataType) Then If Not IsNothing(pr.ParameterDirection) Then SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection + If (Not IsNothing(pr.SqlValue)) Then + + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) + End If Else SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) End If diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index ad8c046c4..fd6191f40 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -47,6 +47,7 @@ Public Class ClsAF Public Property CveCompra As Integer Public Property ValorCompra As Double Public Property FechaCompra As Date + Public Property FechaBaja As Date Public Property CuentaInicial As Integer Public Property CveTipoActivoFijo As Integer Public Property TipoActivoFijo As String @@ -230,6 +231,7 @@ Public Class ClsAF Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero Me.Usuario = Data.Rows(0)("Usuario").ToString Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + Me.FechaBaja = Data.Rows(0)("FechaBaja").ToString.ToDate End If Retorno = True Catch ex As Exception @@ -344,6 +346,9 @@ Public Class ClsAF Me.CveGrupoAF = Data.Rows(0)("CveGrupo").ToString.ToEntero Me.CveAFPadre = Data.Rows(0)("CveAFPadre").ToString.ToEntero Me.CveDispositivo = Data.Rows(0)("CveDispositivo").ToString.ToEntero + Me.FechaBaja = Data.Rows(0)("FechaBaja").ToString.ToDate + + End If Retorno = True Catch ex As Exception @@ -397,7 +402,7 @@ Public Class ClsAF Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, Cuenta As Integer, CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, CveMovimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, - Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Integer + Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1, Optional FechaBaja As Date = MinFecha) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_AF_ActivosFijosAdd") @@ -427,6 +432,7 @@ Public Class ClsAF .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@FechaBaja", SqlDbType.Date).Value = FechaBaja .Add("@CveActivoFijo", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue @@ -458,7 +464,7 @@ Public Class ClsAF CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, IdCtaContActivoFijo As Integer, CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, CveUsuarioModifico As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, - Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Boolean + Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1, Optional FechaBaja As Date = MinFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_ActivosFijosUpdate") @@ -490,6 +496,7 @@ Public Class ClsAF .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@FechaBaja", SqlDbType.Date).Value = FechaBaja End With Try @@ -4514,6 +4521,339 @@ Public Class ClsAF #End Region +#Region " P R O D U C C C I Ó N " + + Public Function AddProduccion(CveActivoFijo As Integer, CveCultivoCuadroDetalle As Integer, Cantidad As Decimal, Fecha As Date, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ProduccionAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la producción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function UpdateProduccion(CveProduccion As Integer, CveActivoFijo As Integer, CveCultivoCuadroDetalle As Integer, Cantidad As Decimal, Fecha As Date, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ProduccionUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProduccion", SqlDbType.Int).Value = CveProduccion + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la producción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetProduccion(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ProduccionGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar la producción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function RemoveProduccion(CveProduccion As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ProduccionRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProduccion", SqlDbType.Int).Value = CveProduccion + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la producción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + +#End Region + +#Region " M A N T E N I M I E N T O S " + + + Public Function AddMantenimientos(CveActivoFijo As Integer, Mantenimiento As String, Observaciones As String, Fecha As Date, CveUsuario As Integer, Archivo As String) As Integer + + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_MantenimientosAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Mantenimiento", SqlDbType.VarChar).Value = Mantenimiento + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Archivo", SqlDbType.VarChar).Value = Archivo + .Add("@CveMantenimiento", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveMantenimiento").Value.ToString.ToEntero + + Catch ex As Exception + OnError("Ocurrió un error al agregar el mantenimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function UpdateMantenimientos(CveMantenimiento As Integer, CveActivoFijo As Integer, Mantenimiento As String, Observaciones As String, Fecha As Date, CveUsuario As Integer, Archivo As String) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MantenimientosUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveMantenimiento", SqlDbType.Int).Value = CveMantenimiento + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Mantenimiento", SqlDbType.VarChar).Value = Mantenimiento + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Archivo", SqlDbType.VarChar).Value = Archivo + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el mantenimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetMantenimientos(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MantenimientosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar los mantenimientos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function RemoveMantenimientos(CveMantenimiento As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MantenimientosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMantenimiento", SqlDbType.Int).Value = CveMantenimiento + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el mantenimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + +#End Region + + + +#Region " PLAGAS ENFERMEDADES " + + + Public Function AddPlagaEnfermedad(CveActivoFijo As Integer, Observaciones As String, Fecha As Date, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_PlagaEnfermedadAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la enfermedad/plaga.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function UpdatePlagaEnfermedad(CvePlagaEnfermedad As Integer, CveActivoFijo As Integer, Observaciones As String, Fecha As Date, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_PlagaEnfermedadUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CvePlagaEnfermedad", SqlDbType.Int).Value = CvePlagaEnfermedad + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la enfermedad/plaga.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetPlagaEnfermedad(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_PlagaEnfermedadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar la enfermedad/plaga.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function RemovePlagaEnfermedad(CvePlagaEnfermedad As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_PlagaEnfermedadRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePlagaEnfermedad", SqlDbType.Int).Value = CvePlagaEnfermedad + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la enfermedad/plaga.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + +#End Region + + #Region " IDisposable Support " ' IDisposable diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 55ee851fb..d416a98bb 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -141,6 +141,7 @@ Public Class ClsBancos Public Property UsaLayoutGrupos As Boolean Public Property UsaTarjeta As Boolean + Public Property TieneTerminal As Boolean #End Region @@ -428,6 +429,7 @@ Public Class ClsBancos Me.UsaLayout = If(Data.Rows(0)("UsaLayout").ToString = "True", True, False) Me.UsaLayoutGrupos = If(Data.Rows(0)("UsaLayoutGrupos").ToString = "True", True, False) Me.UsaTarjeta = If(Data.Rows(0)("UsaTarjeta").ToString = "True", True, False) + Me.TieneTerminal = If(Data.Rows(0)("TieneTerminal").ToString = "True", True, False) End If @@ -462,7 +464,7 @@ Public Class ClsBancos Public Function AddBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, CveUsuario As Integer, CveEmpresa As Integer, ConvenioPagoElectronico As String, - UsaLayout As Boolean, UsaTarjeta As Boolean, Optional SaldoInicial As Double = 0, Optional UsaLayoutGrupos As Boolean = False) As Boolean + UsaLayout As Boolean, UsaTarjeta As Boolean, Optional SaldoInicial As Double = 0, Optional UsaLayoutGrupos As Boolean = False, Optional TieneTerminal As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_BancosCuentasAdd") @@ -489,6 +491,7 @@ Public Class ClsBancos .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta .Add("@SaldoInicial", SqlDbType.Money).Value = SaldoInicial .Add("@UsaLayoutGrupos", SqlDbType.Bit).Value = UsaLayoutGrupos + .Add("@TieneTerminal", SqlDbType.Bit).Value = TieneTerminal @@ -513,7 +516,7 @@ Public Class ClsBancos Public Function UpdateBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, Estatus As Boolean, CveCuenta As Integer, ConvenioPagoElectronico As String, - UsaLayout As Boolean, UsaTarjeta As Boolean, Optional UsaLayoutGrupos As Boolean = False) As Boolean + UsaLayout As Boolean, UsaTarjeta As Boolean, Optional UsaLayoutGrupos As Boolean = False, Optional TieneTerminal As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_BancosCuentasUpdate") @@ -538,6 +541,7 @@ Public Class ClsBancos .Add("@UsaLayout", SqlDbType.Bit).Value = UsaLayout .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta .Add("@UsaLayoutGrupos", SqlDbType.Bit).Value = UsaLayoutGrupos + .Add("@TieneTerminal", SqlDbType.Bit).Value = TieneTerminal End With diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 3a0ec3593..0916d36a0 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -1665,7 +1665,7 @@ Public Class ClsClientes End Function Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, CveEstado As Integer, RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer, - NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1) As Boolean + NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1, Optional RegimenSociedad As String = "-1", Optional TipoPersona As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClientesNoFrecuenteAdd") @@ -1690,6 +1690,8 @@ Public Class ClsClientes .Add("@CveFormaPago33", SqlDbType.Int).Value = CveFormaPago33 .Add("@NumCuentaPago", SqlDbType.VarChar).Value = NumCuentaPago .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@CvePrecioLista", SqlDbType.VarChar).Value = RegimenSociedad + .Add("@TipoPersona", SqlDbType.Bit).Value = TipoPersona End With diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 77de3378d..75e8cd605 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1156,7 +1156,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetMovimientosDetalle(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveCompra As Integer = -1, Optional CveMovimientoDetalle As Integer = -1) As Boolean + Public Function GetMovimientosDetalle(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveCompra As Integer = -1, Optional CveMovimientoDetalle As Integer = -1, Optional Resumen As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleGet") @@ -1165,6 +1165,8 @@ Public Class ClsInventarios .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveCompra", SqlDbType.Int).Value = CveCompra .Add("@CveMovimientoDetalle", SqlDbType.Int).Value = CveMovimientoDetalle + .Add("@Resumen", SqlDbType.Int).Value = Resumen + End With Try SqlAdapter.Fill(Data) @@ -1209,13 +1211,14 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetMovimientosDetalleImpresion(CveMovimiento As Integer, CveEmpresa As Integer) As Boolean + Public Function GetMovimientosDetalleImpresion(CveMovimiento As Integer, CveEmpresa As Integer, Optional Resumen As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleImpresionGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Resumen", SqlDbType.Bit).Value = Resumen End With Try SqlAdapter.Fill(Data) @@ -1287,7 +1290,8 @@ Public Class ClsInventarios Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Observaciones As String = "", Optional CveMovimientoDetalleEntrada As Integer = -1, Optional PUTC As Decimal = -1, Optional CostoIndirecto As Decimal = 0, Optional CveCompraDetalle As Integer = -1, Optional CveOrdenCompraDetalle As Integer = -1, Optional CveVentaDetalle As Integer = -1, - Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1, Optional CveVentaDetalleRemision As Integer = -1) As Boolean + Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1, Optional CveVentaDetalleRemision As Integer = -1, + Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleAdd") @@ -1314,6 +1318,7 @@ Public Class ClsInventarios .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@EsInterno", SqlDbType.Int).Value = EsInterno .Add("@CveVentaDetalleRemision", SqlDbType.Int).Value = CveVentaDetalleRemision + .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle .Add("@CveMovimientoDetalle", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -1349,7 +1354,7 @@ Public Class ClsInventarios Return Retorno End Function Public Function UpdateMovimientoDetalle(Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Double, CveAF As Integer, CveMovimientoDetalle As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", - Optional Observaciones As String = "-1", Optional PUTC As Double = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean + Optional Observaciones As String = "-1", Optional PUTC As Double = -1, Optional CveUsuarioModifico As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleUpdate") @@ -1366,6 +1371,7 @@ Public Class ClsInventarios .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle End With Try diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 8823cda54..73bf24f1a 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -2482,12 +2482,13 @@ Public Class ClsNominas Return retorno End Function + Public Function CalculoISRAnual(ejercicio As Integer, cveEmpresa As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_CalculoISRAnual", CommandType.StoredProcedure) addParameters("@Ejercicio", SqlDbType.Int, ejercicio) addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) - retorno = RunQuery("Ocurrió un error al obtener el PA_Nom_CalculoISRAnual.") + retorno = RunQuery("Ocurrió un error al obtener el Calculo ISR anual.") Return retorno End Function Public Function GetNominaAcumulado(Ejercicio As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodoI As Integer, CvePeriodoF As Integer, CveEmpresa As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1, Optional CveTipoPeriodo As Integer = -1) As Boolean @@ -3180,7 +3181,63 @@ Public Class ClsNominas retorno = RunQuery("Ocurrió un error al obtener el PA_Agro_Embarque_PalletGet.") Return retorno End Function +#Region "Visor sat" + Public Function SATSolicitudTimbreNominaGral(IDsolicitud As Integer, cveEmpresa As Integer, fechaInicio As String, fechaFin As String) As Boolean + Dim retorno As Boolean = False + DataAdapter("[PA_SAT_SolicitudTimbreNominaGral]", CommandType.StoredProcedure) + addParameters("@IDsolicitud", SqlDbType.Int, IDsolicitud) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@FechaInicio", SqlDbType.VarChar, fechaInicio) + addParameters("@FechaFin", SqlDbType.VarChar, fechaFin) + retorno = RunQuery("Ocurrió un error al obtener el Calculo ISR anual.") + Return retorno + End Function +#Region "CRUD_SolicitudesNominas" + Public Function SolicitudesNominasGet(idSolicitudNominas As Integer, CveEmpresa As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_SAT_SolicitudesNominasGet", CommandType.StoredProcedure) + addParameters("@idSolicitudNominas", SqlDbType.Int, idSolicitudNominas) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al obtener el SolicitudesNominas.") + Return retorno + End Function + Public Function SolicitudesNominasAdd(idSolicitudCFDI As Integer, idSolicitudMetadata As Integer, estatus As Integer, observaciones As String, fechaInicio As DateTime, fechaFin As DateTime, cveUsuarioIng As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_SAT_SolicitudesNominasAdd", CommandType.StoredProcedure) + addParameters("@idSolicitudCFDI", SqlDbType.Int, idSolicitudCFDI) + addParameters("@idSolicitudMetadata", SqlDbType.Int, idSolicitudMetadata) + addParameters("@Estatus", SqlDbType.Int, estatus) + addParameters("@Observaciones", SqlDbType.VarChar, observaciones) + addParameters("@FechaInicio", SqlDbType.DateTime, fechaInicio) + addParameters("@FechaFin", SqlDbType.DateTime, fechaFin) + addParameters("@CveUsuarioIng", SqlDbType.Int, cveUsuarioIng) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + retorno = RunQuery("Ocurrió un error al agregar el SolicitudesNominas.") + Return retorno + End Function + Public Function SolicitudesNominasUp(idSolicitudNominas As Int32, idSolicitudCFDI As Int32, idSolicitudMetadata As Int32, estatus As Int32, observaciones As String, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_SAT_SolicitudesNominasUp", CommandType.StoredProcedure) + addParameters("@idSolicitudNominas", SqlDbType.Int, idSolicitudNominas) + addParameters("@idSolicitudCFDI", SqlDbType.Int, idSolicitudCFDI) + addParameters("@idSolicitudMetadata", SqlDbType.Int, idSolicitudMetadata) + addParameters("@Estatus", SqlDbType.Int, estatus) + addParameters("@Observaciones", SqlDbType.VarChar, observaciones) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + retorno = RunQuery("Ocurrió un error al actualizar el SolicitudesNominas.") + Return retorno + End Function + Public Function SolicitudesNominasRemove(idSolicitudNominas As Int32, CveEmpresa As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_SAT_SolicitudesNominasRemove", CommandType.StoredProcedure) + addParameters("@idSolicitudNominas", SqlDbType.Int, idSolicitudNominas) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al eliminar el SolicitudesNominas.") + Return retorno + End Function +#End Region +#End Region #Region "IDisposable Support" ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 156eaff82..e3b6570c4 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5380,6 +5380,7 @@ Public Class ClsPaginas PaginaDict.Add("/RH/MiPerfil.aspx".ToUpper(), -1) ' se dejará libre el módulo para que cualquier que tenga cvepersonal, pueda acceder PaginaDict.Add("/RH/CatChecadores.aspx".ToUpper(), 694) PaginaDict.Add("/RH/CatRegistroPatronal.aspx".ToUpper(), 1324) + PaginaDict.Add("/SAT/SolicitudesNominaSat.aspx".ToUpper(), 545) #End Region #Region "Sistema" 'Cargo las páginas que deben tener restricción diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index fa31af006..a340074f6 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -144,6 +144,25 @@ Public Class ClsVentas End Sub #End Region + Public Function GuardaTimbre(CveVenta As Integer, CveNomina As Integer, UUID As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GuardaTimbreGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveNomina", SqlDbType.Int).Value = CveNomina + .Add("@UUID", SqlDbType.VarChar).Value = UUID + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar los dataos del timbre.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetVenta(CveVenta As Integer, CveEmpresa As Integer, Optional VerificaAlmacen As Boolean = True) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasGet") diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index e5b7003f2..2499c1de1 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -211,7 +211,7 @@ Public Class Timbrado Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True, Optional CveSATMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As RespuestaCancelacionSAT Dim Retorno As New RespuestaCancelacionSAT Dim MsgCancelacion As New StringBuilder - + 'dim Error If CvePACCancelacion = 3 Then ValidaFactura = False End If @@ -1238,7 +1238,7 @@ Public Class Timbrado If Ret <> "" Then MensajeErrorCFDI = Ret Retorno = If(Ret = "", True, False) End If - + 'Dim error End Select diff --git a/Bancos/CuentasBancariasDetalle.aspx b/Bancos/CuentasBancariasDetalle.aspx index d2a0f9b05..dc51da521 100644 --- a/Bancos/CuentasBancariasDetalle.aspx +++ b/Bancos/CuentasBancariasDetalle.aspx @@ -95,6 +95,11 @@ Layout Grupos: + + + Tiene Terminal: + + Convenio: diff --git a/Bancos/CuentasBancariasDetalle.aspx.vb b/Bancos/CuentasBancariasDetalle.aspx.vb index 24f611f58..ddfc4d03c 100644 --- a/Bancos/CuentasBancariasDetalle.aspx.vb +++ b/Bancos/CuentasBancariasDetalle.aspx.vb @@ -183,7 +183,9 @@ Partial Class Bancos_CuentasBancariasDetalle TxtConvenio.Text = ObjCuentasBancariasDetalle.ConvenioPagoElectronico.ToString ChkLayout.Checked = ObjCuentasBancariasDetalle.UsaLayout ChkLayoutGrupos.Checked = ObjCuentasBancariasDetalle.UsaLayoutGrupos - ChkUsaTarjeta.Checked = ObjCuentasBancariasDetalle.UsaTarjeta + ChkUsaTarjeta.Checked = ObjCuentasBancariasDetalle.UsaTarjeta + + ChkTieneTerminal.Checked = ObjCuentasBancariasDetalle.TieneTerminal ChkUsaTarjeta_CheckedChanged(Nothing, Nothing) @@ -265,7 +267,8 @@ Partial Class Bancos_CuentasBancariasDetalle If ObjCuentasBancariasDetalle.AddBancosCuentas(DdlBanco.SelectedValue.ToEntero, DdlTipoCuenta.SelectedValue.ToEntero, TxtNumCuenta.Text.Trim, TxtCLABE.Text.Trim, DdlMoneda.SelectedValue.ToEntero, 0, TxtFInicial.Text.Trim.ToEntero, 0, 0, TxtLimiteCredito.Text.Trim.ToDouble, DDlCuentaContable.SelectedValue.ToEntero, - DdlCuentaContableComplementaria.SelectedValue.ToEntero, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkLayout.Checked, TxtConvenio.Text, ""), ChkLayout.Checked, ChkUsaTarjeta.Checked, UsaLayoutGrupos:=ChkLayoutGrupos.Checked) Then + DdlCuentaContableComplementaria.SelectedValue.ToEntero, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkLayout.Checked, TxtConvenio.Text, ""), ChkLayout.Checked, ChkUsaTarjeta.Checked, UsaLayoutGrupos:=ChkLayoutGrupos.Checked, + TieneTerminal:=ChkTieneTerminal.Checked) Then ViewState("CveCuenta") = ObjCuentasBancariasDetalle.TCveCuenta Else ErrorUsuarios = True @@ -296,7 +299,9 @@ Partial Class Bancos_CuentasBancariasDetalle End If Else - If ObjCuentasBancariasDetalle.UpdateBancosCuentas(DdlBanco.SelectedValue.ToEntero, DdlTipoCuenta.SelectedValue.ToEntero, TxtNumCuenta.Text.Trim, TxtCLABE.Text.Trim, DdlMoneda.SelectedValue.ToEntero, 0, TxtFInicial.Text.Trim.ToEntero, 0, 0, TxtLimiteCredito.Text.Trim.ToDouble, DDlCuentaContable.SelectedValue.ToEntero, DdlCuentaContableComplementaria.SelectedValue.ToEntero, "", ChkEstatus.Checked, CveCuenta, TxtConvenio.Text, ChkLayout.Checked, ChkUsaTarjeta.Checked, UsaLayoutGrupos:=ChkLayoutGrupos.Checked) Then + If ObjCuentasBancariasDetalle.UpdateBancosCuentas(DdlBanco.SelectedValue.ToEntero, DdlTipoCuenta.SelectedValue.ToEntero, TxtNumCuenta.Text.Trim, TxtCLABE.Text.Trim, DdlMoneda.SelectedValue.ToEntero, 0, TxtFInicial.Text.Trim.ToEntero, 0, 0, + TxtLimiteCredito.Text.Trim.ToDouble, DDlCuentaContable.SelectedValue.ToEntero, DdlCuentaContableComplementaria.SelectedValue.ToEntero, "", ChkEstatus.Checked, CveCuenta, TxtConvenio.Text, + ChkLayout.Checked, ChkUsaTarjeta.Checked, UsaLayoutGrupos:=ChkLayoutGrupos.Checked, TieneTerminal:=ChkTieneTerminal.Checked) Then 'CargaDatos() GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) = Nothing 'If ObjCuentasBancariasDetalle.GetBancosCuentasUsuarios(-1) Then diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 61ecb326a..c07e6faa8 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -539,6 +539,12 @@ Partial Class PopUpVerFactura End If End If + If UrlParametros("OP").ToString = "Almr" Then + If UrlParametros("CVEMOVIMIENTO") IsNot Nothing AndAlso UrlParametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then + CargaMovimientosAlmacen(UrlParametros("CVEMOVIMIENTO").ToString.ToEntero, Resumen:=True) + End If + End If + If UrlParametros("OP").ToString = "Etiqueta" Then If UrlParametros("CVEMOVIMIENTO") IsNot Nothing AndAlso UrlParametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then ImprimirEtiqueta(UrlParametros("CVEMOVIMIENTO").ToString.ToEntero, UrlParametros("MODALIDAD").ToString) @@ -2270,7 +2276,7 @@ Partial Class PopUpVerFactura #Region " - OP = 'Alm' - REPORTE ENTRADAS ALMACEN " - Private Sub CargaMovimientosAlmacen(CveMovimiento As Integer) + Private Sub CargaMovimientosAlmacen(CveMovimiento As Integer, Optional Resumen As Boolean = False) Dim ObjInventarios As New ClsInventarios ObjInventarios.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) @@ -2366,11 +2372,11 @@ Partial Class PopUpVerFactura Dim CantidadUsados As Decimal = 0 If CveConcepto = 3 Or CveConcepto = 18 Or CveConcepto = 30 Or CveConcepto = 34 Or CveConcepto = 35 Or CveConcepto = 16 Or CveConcepto = 7 Or CveConcepto = 40 Then 'SALIDA Y DEVOLUCION DEL CLIENTE - If ObjInventarios.GetMovimientosDetalleImpresion(CveMovimiento, UsuarioActual.CveEmpresa) Then + If ObjInventarios.GetMovimientosDetalleImpresion(CveMovimiento, UsuarioActual.CveEmpresa, Resumen:=Resumen) Then DtMovimientos = ObjInventarios.DtResultados If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveMovimientoRelacionado > 0 Then - If ObjInventarios.GetMovimientosDetalleImpresion(CveMovimientoRelacionado, UsuarioActual.CveEmpresa) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then + If ObjInventarios.GetMovimientosDetalleImpresion(CveMovimientoRelacionado, UsuarioActual.CveEmpresa, Resumen:=Resumen) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then Dim CveAlmacenRelacionado As Integer = ObjInventarios.DtResultados.Rows(0)("CveAlmacen").ToString().ToEntero() Dim CveTipoAlmacenRelacionado As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenRelacionado}").ToString.ToEntero @@ -2400,7 +2406,7 @@ Partial Class PopUpVerFactura DtMovimientos.PrimaryKey = keys End If Else - If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa, Resumen:=Resumen) Then DtMovimientos = ObjInventarios.DtResultados.Copy() CantidadProductos = DtMovimientos.SUM("Cantidad").ToDecimal() If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveMovimientoRelacionado > 0 Then diff --git a/Documentacion/TableroMaterialidad.aspx b/Documentacion/TableroMaterialidad.aspx index 3c43bafe2..ae6341363 100644 --- a/Documentacion/TableroMaterialidad.aspx +++ b/Documentacion/TableroMaterialidad.aspx @@ -287,12 +287,12 @@ - + <%# string.Format("{1}", Eval("CveCliente"), Eval("Cliente")) %> - - + + @@ -449,7 +449,7 @@ - <%----%> +