From 35cb7ea42b68d8852bdf72bfc72f53867efa6f5e Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 18 Jan 2024 18:05:50 -0700 Subject: [PATCH] --SMS, armado de paquetes con serie y lote --- Inventarios/PaquetesArmadoDesarmado.aspx | 1285 ++++++++++--------- Inventarios/PaquetesArmadoDesarmado.aspx.vb | 337 ++--- 2 files changed, 846 insertions(+), 776 deletions(-) diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx b/Inventarios/PaquetesArmadoDesarmado.aspx index bfd8a8fee..d3859b2fd 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx +++ b/Inventarios/PaquetesArmadoDesarmado.aspx @@ -1,134 +1,135 @@ -<%@ Page Title="SIG | Paquetes: Armado - Desarmado" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PaquetesArmadoDesarmado.aspx.vb" Inherits="Inventarios_PaquetesArmadoDesarmado" %> - - - - - - - Paquetes | Armado - Desarmado - - - - - - - - - - - - - - - - <%--FILTROS--%> - - -
-
-
- -
-
-
-
Paquete:
-
- - - -
-
Cantidad
-
- - - - - - -
-
Almacén:
-
- - - -
-
Fecha
-
-
-
- - - - - - - - - - -
-
-
-
-
-
-
-
-
Vendedor:
-
- - - -
-
-
Cliente:
-
- - - -
-
-
-
-
-
-
-
- -
- - <%--DATOS DEL MOVIMIENTO--%> -
- - -
-
-
- - Datos del movimiento -
-
-
-
-
-
- -
-
-
- - - - - - - - - +<%@ Page Title="SIG | Paquetes: Armado - Desarmado" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PaquetesArmadoDesarmado.aspx.vb" Inherits="Inventarios_PaquetesArmadoDesarmado" EnableEventValidation="false" %> + + + + + + + Paquetes | Armado - Desarmado + + + + + + + + + + + + + + + + <%--FILTROS--%> + + +
+
+
+ +
+
+
+
Paquete:
+
+ + + +
+
Cantidad
+
+ + + + + + +
+
Almacén:
+
+ + + +
+
Fecha
+
+
+
+ + + + + + + + + + +
+
+
+
+
+
+
+
+
Vendedor:
+
+ + + +
+
+
Cliente:
+
+ + + +
+
+
+
+
+
+
+
+ +
+ + <%--DATOS DEL MOVIMIENTO--%> +
+ + +
+
+
+ + Datos del movimiento +
+
+
+
+
+
+ +
+
+
+
Paquete: - -
Cantidad: - -
+ + + + + + + + + <%-- - - - - - -
Paquete: + +
Cantidad: + +

@@ -145,490 +146,520 @@
Observaciones: - -
-
-
-
-
-
- - <%--DATOS SERIE PAQUETE--%> -
- - -
-
-
- - series del paquete -
-
-
-
-
-
- -
-
-
- - - - - - - - - - -
-
-
-
-
- -
- - <%--GV DATOS ARMADO--%> -
-
- - -
-
-
- - Componentes -
-
-
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - <%--GUARDAR--%> -
- - - - - -
- -
- -
-
- - - - - <%--FILTROS DESARMADO--%> - - -
-
-
- -
-
-
-
Paquete:
-
- - - -
-
Cantidad
-
- - - - - - -
-
Almacén:
-
- - - -
-
Fecha
-
-
-
- - - - - - - - - - -
-
-
-
-
-
-
-
-
Vendedor:
-
- - - -
-
-
Cliente:
-
- - - -
-
-
-
-
-
-
-
- -
- - <%--DATOS DEL MOVIMIENTO--%> -
- - -
-
-
- - Datos del movimiento -
-
-
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
Paquete: - -
Cantidad: - -
-
-
Almacén: - -
Fecha: - -
Observaciones: - -
-
-
-
-
-
- - <%--DATOS SERIE PAQUETE--%> -
- - -
-
-
- - series del paquete -
-
-
-
-
-
- -
-
-
- -
-
Serie
-
- - - -
-
- -
-
-
- -
- - - - - - - - - - - - - -
-
-
-
-
- -
- - <%--GV DATOS DESARMADO--%> -
- -
- - -
-
-
- - Componentes -
-
-
-
-
-
- -
-
-
- - - - - - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Total: - - - -
- -
-
-
-
-
- -
- - - - - -
- -
- -
-
- -
- - - <%--AGREGAR POR SERIE LOTE--%> - + + <%--DATOS SERIE PAQUETE--%> +
+ + +
+
+
+ + series del paquete +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + +
+
+
+
+
+ + + + <%--GV DATOS ARMADO--%> +
+
+ + +
+
+
+ + Componentes +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+ + <%--GUARDAR--%> +
+ + + + + +
+ +
+ + + + + + + + <%--FILTROS DESARMADO--%> + + +
+
+
+ +
+
+
+
Paquete:
+
+ + + +
+
Cantidad
+
+ + + + + + +
+
Almacén:
+
+ + + +
+
Fecha
+
+
+
+ + + + + + + + + + +
+
+
+
+
+
+
+
+
Vendedor:
+
+ + + +
+
+
Cliente:
+
+ + + +
+
+
+
+
+
+
+
+ +
+ + <%--DATOS DEL MOVIMIENTO--%> +
+ + +
+
+
+ + Datos del movimiento +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Paquete: + +
Cantidad: + +
+
+
Almacén: + +
Fecha: + +
Observaciones: + +
+
+
+
+
+
+ + <%--DATOS SERIE PAQUETE--%> +
+ + +
+
+
+ + series del paquete +
+
+
+
+
+
+ +
+
+
+ +
+
Serie
+
+ + + +
+
+ +
+
+
+ +
+ + + + + + + + + + + + + +
+
+
+
+
+ +
+ + <%--GV DATOS DESARMADO--%> +
+ +
+ + +
+
+
+ + Componentes +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+
+
+ + + + + + + + +
Total: + + + +
+ +
+
+
+
+
+ +
+ + + + + +
+ +
+ +
+
+ + + + + <%--AGREGAR POR SERIE LOTE--%> + - - - - - -
- + + + + + + + + + + + + + + + - - + + + diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx.vb b/Inventarios/PaquetesArmadoDesarmado.aspx.vb index 65355c496..ab0db1e2a 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx.vb +++ b/Inventarios/PaquetesArmadoDesarmado.aspx.vb @@ -4,9 +4,9 @@ Option Strict On Imports System.Data Imports Extensiones Partial Class Inventarios_PaquetesArmadoDesarmado - Inherits ClsPaginas - - + Inherits ClsPaginas + + #Region " PROPIEDADES " Public Property CveAlmacenArmado As Integer Get @@ -123,17 +123,17 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Set(value As DataTable) ViewState("DtExistenciasDesarmado") = value End Set - End Property + End Property #End Region - - + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then InicializaValores() End If - End Sub - - + End Sub + + #Region " INICIALIZA VALORES " Private Sub InicializaValores() CreaDtSeriesDesarmado() @@ -188,9 +188,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado CveVendedor = -1 CveCliente = -1 - End Sub + End Sub #End Region - + #Region " APARTADOS " Protected Sub DdlAlmacenArmado_SelectedIndexChanged(sender As Object, e As EventArgs) RowApartadosArmado.Visible = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveAlmacen = {DdlAlmacenArmado.SelectedValue.ToEntero} AND CveTipoAlmacen = 9").ToEntero > 0 @@ -199,9 +199,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Protected Sub DdlAlmacenDesarmado_SelectedIndexChanged(sender As Object, e As EventArgs) RowApartadosDesarmado.Visible = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveAlmacen = {DdlAlmacenDesarmado.SelectedValue.ToEntero} AND CveTipoAlmacen = 9").ToEntero > 0 UpFiltraDesarmado.Update() - End Sub + End Sub #End Region - + #Region " PROCESAR - VERIFICAR EXISTENCIAS " Protected Sub BtnVerificarExistenciasArmado_Click(sender As Object, e As EventArgs) TipoMovimiento = 1 @@ -271,17 +271,17 @@ Partial Class Inventarios_PaquetesArmadoDesarmado LbPaqueteArmado.Text = DdlPaqueteArmado.SelectedItem.Text CvePaqueteArmado = DdlPaqueteArmado.SelectedValue.ToEntero LbCantidadArmado.Text = TxtCantidadArmado.Text - LbAlmacenArmado.Text = DdlAlmacenArmado.SelectedItem.Text + 'LbAlmacenArmado.Text = DdlAlmacenArmado.SelectedItem.Text CveAlmacenArmado = DdlAlmacenArmado.SelectedValue.ToEntero - LbFechaArmado.Text = TxtFechaArmado.Text + 'LbFechaArmado.Text = TxtFechaArmado.Text GvDatosArmado.DataSource = DtDatos GvDatosArmado.DataBind() GvDatosArmado.Columns(4).Visible = DtDatos.MAX("AplicaSerie", "") = "True" GvDatosArmado.Columns(5).Visible = DtDatos.MAX("AplicaSeccion") = "True" - GvDatosArmado.Columns(6).Visible = False 'DtDatos.MAX("Lote", "") <> "" - GvDatosArmado.Columns(7).Visible = False 'DtDatos.MAX("FechaCaducidad", "FechaCaducidad is not null").ToDate > MinFecha + GvDatosArmado.Columns(6).Visible = DtDatos.MAX("AplicaLote") = "True" + GvDatosArmado.Columns(7).Visible = DtDatos.MAX("AplicaCaducidad") = "True" 'If ErrorExistencias Then ' GvDatosArmado.Columns(4).Visible = False @@ -374,8 +374,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado GvDatosDesarmado.DataSource = DtDatos GvDatosDesarmado.DataBind() - GvDatosDesarmado.Columns(4).Visible = CBool(DtDatos.MAX("AplicaSerie")) - GvDatosDesarmado.Columns(5).Visible = CBool(DtDatos.MAX("AplicaSeccion")) + GvDatosArmado.Columns(4).Visible = DtDatos.MAX("AplicaSerie", "") = "True" + GvDatosArmado.Columns(5).Visible = DtDatos.MAX("AplicaSeccion") = "True" + GvDatosArmado.Columns(6).Visible = DtDatos.MAX("AplicaLote") = "True" + GvDatosArmado.Columns(7).Visible = DtDatos.MAX("AplicaCaducidad") = "True" BtnGuadarDesarmado.Visible = True @@ -383,10 +385,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado UpDatosDesarmado.Update() UpGeneralesDesarmado.Update() - End Sub + End Sub #End Region - - + + #Region " GUARDAR " Protected Sub BtnGuadarArmado_Click(sender As Object, e As EventArgs) If Not GvDatosArmado.Rows.Count > 0 Then @@ -455,8 +457,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If - Dim ObjInventario As New ClsInventarios - ObjInventario.IniciaTransacSQL() 'Inicia la transacción + Dim ObjInventario As New ClsInventarios + Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) + Dim TieneError As Boolean = False Dim MensajeError As String = "" @@ -464,10 +467,19 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim FolioSalida As Integer = 0 Dim CveMovimientoEntrada As Integer = 0 Dim FolioEntrada As Integer = 0 - Dim Fecha As Date = If(Tipo = 1, LbFechaArmado.Text.ToDate, LbFechaDesarmado.Text.ToDate) + Dim Fecha As Date = If(Tipo = 1, TxtFechaArmado.Text.ToDate, LbFechaDesarmado.Text.ToDate) Dim DtDetalle As New DataTable + Dim ConcepPrePoliza1 = "ARMPAQ1" + Dim ConcepPrePoliza2 = "ARMPAQ2" + Dim Concepto As String = "ARMPAQ2" + Dim Modulo As String = "ARMPAQ1/ARMPAQ2" + Try + + Catch ex As Exception + + End Try Select Case (Tipo) Case 1 ' ARMADO @@ -585,47 +597,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado MensajeError = "Ocurrió un error al guardar los movimientos de entrada" End If End If - End If - - - Dim ImportePrePoliza As Decimal = 0D - - If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - ImportePrePoliza = ObjInventario.DtResultados.SUMD("Total") - End If - - - Dim MovAlmacen As Boolean = True - - Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 19).ToEntero - - If OrigenMov = 1 Then - MovAlmacen = True - Else - MovAlmacen = False - End If - - Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL) - - Dim Concepto As String = "ARMPAQ2" - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ARMPAQ1/ARMPAQ2", 74, ImportePrePoliza, ImportePrePoliza, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, "ARMPAQ2", "ARMPAQ2", CveMovimientoAlmacen:=CveMovimientoEntrada, CveSubProyecto:=-1, Contabilizable:=True) Then - TieneError = True - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, "ARMPAQ1", "ARMPAQ1", CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=True) Then - TieneError = True - End If - - If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=6) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - TieneError = True - End If - End If - + End If + + + Case 2 'DESARMADO @@ -682,77 +657,111 @@ Partial Class Inventarios_PaquetesArmadoDesarmado TieneError = True Else For Each Gvr As GridViewRow In GvDatosDesarmado.Rows - If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then - If CBool(Gvr.DataKey("AplicaSeccion")) Then - CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero - End If + 'If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then + ' If CBool(Gvr.DataKey("AplicaSeccion")) Then + ' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + ' End If - If CBool(Gvr.DataKey("AplicaSerie")) Then - For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString) Then - MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada. Por favor vuelva a intentar." - TieneError = True - Exit For - End If - Next - Else - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen) Then - MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada. Por favor vuelva a intentar." - TieneError = True - Exit For - End If - End If + ' If CBool(Gvr.DataKey("AplicaSerie")) Then + ' For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows + ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString) Then + ' MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada. Por favor vuelva a intentar." + ' TieneError = True + ' Exit For + ' End If + ' Next + ' Else + ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen) Then + ' MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada. Por favor vuelva a intentar." + ' TieneError = True + ' Exit For + ' End If + ' End If + 'End If + + Dim Lote As String = If(Gvr.FCTextBox("TxtLote").Text = "", "-1", Gvr.FCTextBox("TxtLote").Text) + Dim FechaCaducidad As String = If(Gvr.FCTextBox("TxtCaducidad").Text = "", "-1", Gvr.FCTextBox("TxtCaducidad").Text) + If CBool(Gvr.DataKey("AplicaSeccion")) Then + CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + End If + + If CBool(Gvr.DataKey("AplicaSerie")) Then + For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows + If Not ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenArmado.SelectedValue.ToEntero, FechaMovto:=Fecha.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr("Serie").ToString, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) >= 1 Then + MensajeError = String.Format("El Producto {0} con Serie: {1} no tiene existencia suficiente", Dr("PS"), Dr("Serie")) + TieneError = True + Exit For + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, + CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Lote, FechaCaducidad:=FechaCaducidad.ToDate) Then + MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida. Por favor vuelva a intentar." + TieneError = True + Exit For + End If + Next + + If TieneError Then + Exit For + End If + + Else + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero, + Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, + FechaCaducidad:=FechaCaducidad.ToDate) Then + MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." + TieneError = True + Exit For + End If End If Next End If End If + ConcepPrePoliza1 = "ARMPAQ3" + ConcepPrePoliza1 = "ARMPAQ4" - - - - Dim ImportePrePoliza As Decimal = 0D - - If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - ImportePrePoliza = ObjInventario.DtResultados.SUMD("Total") - End If - - - Dim MovAlmacen As Boolean = True - - Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 4).ToEntero - - If OrigenMov = 1 Then - MovAlmacen = True - Else - MovAlmacen = False - End If - - Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL) - - Dim Concepto As String = "ARMPAQ2" - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ARMPAQ1/ARMPAQ2", 74, ImportePrePoliza, ImportePrePoliza, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, "ARMPAQ4", "ARMPAQ4", CveMovimientoAlmacen:=CveMovimientoEntrada, CveSubProyecto:=-1, Contabilizable:=True) Then - TieneError = True - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, "ARMPAQ3", "ARMPAQ3", CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=True) Then - TieneError = True - End If - - If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=6) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - TieneError = True - End If - End If - - End Select + End Select + + 'CONTABILIZAR MOVIMIENTOS + If Not TieneError Then + Dim ImportePrePoliza As Decimal = 0D + + If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then + ImportePrePoliza = ObjInventario.DtResultados.SUMD("Total") + End If + + + Dim MovAlmacen As Boolean = True + + Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 19).ToEntero + + If OrigenMov = 1 Then + MovAlmacen = True + Else + MovAlmacen = False + End If + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 74, ImportePrePoliza, ImportePrePoliza, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + 'Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, ConcepPrePoliza2, ConcepPrePoliza2, CveMovimientoAlmacen:=CveMovimientoEntrada, CveSubProyecto:=-1, Contabilizable:=True) Then + TieneError = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, ConcepPrePoliza1, ConcepPrePoliza1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=True) Then + TieneError = True + End If + + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=6) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + TieneError = True + End If + End If + End If If Not TieneError Then - Dim Msg As New StringBuilder Msg.AppendFormat("
El Movimiento de salida se registro con el Folio: {1}", CveMovimientoSalida, FolioSalida) Msg.AppendFormat("
Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) @@ -786,9 +795,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado LbPaqueteArmado.Text = "" CvePaqueteArmado = -1 LbCantidadArmado.Text = "" - LbAlmacenArmado.Text = "" + 'LbAlmacenArmado.Text = "" CveAlmacenArmado = -1 - LbFechaArmado.Text = "" + 'LbFechaArmado.Text = "" TxtObservacionesArmado.Text = "" UpGeneralesArmado.Update() @@ -823,10 +832,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'End If - End Sub + End Sub #End Region - - + + #Region " GV ARMADO " Protected Sub GvDatosArmado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosArmado.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -839,8 +848,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString 'If AplicaSerie Then - e.Row.FCLinkButton("BtnSeriePaquete").Visible = True - e.Row.FCLinkButton("BtnSeriePaquete").Attributes.Add("data-toggle", "tooltip") + e.Row.FCLinkButton("BtnSeriePaquete").Visible = True + e.Row.FCLinkButton("BtnSeriePaquete").Attributes.Add("data-toggle", "tooltip") 'End If Else @@ -851,11 +860,24 @@ Partial Class Inventarios_PaquetesArmadoDesarmado e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False Else CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenArmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa) + End If + + If e.Row.DataKey("AplicaCaducidad") = "True" Then + e.Row.FCTextBox("TxtCaducidad").Visible = True + e.Row.FCLinkButton("LnkCaducidad").Visible = True - End If - - e.Row.FCTextBox("TxtCaducidad").Visible = e.Row.DataKey("AplicaCaducidad") = "True" - + e.Row.FCTextBox("TxtCaducidad").ReadOnly = False + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True + e.Row.FCTextBox("TxtCaducidad").Enabled = True + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + e.Row.FCTextBox("TxtCaducidad").Enabled = True + + e.Row.FCTextBox("TxtCaducidad").ReadOnly = True + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False + End If + e.Row.FCTextBox("TxtLote").Visible = e.Row.DataKey("AplicaLote") = "True" ''FUNCIONALIDAD PISTOLA DE CODIGOS @@ -864,9 +886,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'End If End If - End Sub + End Sub #End Region - + #Region " GV DESARMADO " Protected Sub GvDatosDesarmado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosDesarmado.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -883,12 +905,29 @@ Partial Class Inventarios_PaquetesArmadoDesarmado CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenDesarmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa) End If + If e.Row.DataKey("AplicaCaducidad") = "True" Then + e.Row.FCTextBox("TxtCaducidad").Visible = True + e.Row.FCLinkButton("LnkCaducidad").Visible = True + + e.Row.FCTextBox("TxtCaducidad").ReadOnly = False + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True + e.Row.FCTextBox("TxtCaducidad").Enabled = True + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + e.Row.FCTextBox("TxtCaducidad").Enabled = True + + e.Row.FCTextBox("TxtCaducidad").ReadOnly = True + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False + End If + e.Row.FCTextBox("TxtLote").Visible = e.Row.DataKey("AplicaLote") = "True" + e.Row.FCTextBox("TxtCosto").Attributes.Add("onkeyup", "SumaValores();") End If - End Sub + End Sub #End Region - + #Region " SERIE LOTE " Private Sub CreaDtDetalle() If DtDatosDetalle Is Nothing Then @@ -1082,11 +1121,11 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting DtDatosDetalle.Rows.Remove(DtDatosDetalle.Rows(e.RowIndex)) CargaSerie(2) - End Sub + End Sub #End Region - + #Region " SERIE DEL PAQUETE " - 'SERIES ARMADO + 'SERIES ARMADO Protected Sub BtnSeriePaquete_Click(sender As Object, e As EventArgs) Dim i = 1 Dim Dt As New DataTable @@ -1187,8 +1226,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado GvSeriesPaqueteDesarmado.DataBind() UpSeriesPaqueteDesarmado.Update() - End Sub + End Sub #End Region - - + + End Class