Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -116,43 +116,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
<table width="100%">
|
<tr>
|
||||||
<tr>
|
<td>Observaciones:</td>
|
||||||
<td>Paquete:</td>
|
<td>
|
||||||
<td>
|
<asp:TextBox ID="TxtObservacionesArmado" TextMode="MultiLine" Rows="2" CssClass="form-control input-sm" runat="server" MaxLength="200"></asp:TextBox>
|
||||||
<asp:Label Font-Bold="true" Text="" ID="LbPaqueteArmado" runat="server" />
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cantidad:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbCantidadArmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<%--
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<hr />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Almacén:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbAlmacenArmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Fecha:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbFechaArmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>--%>
|
|
||||||
<tr>
|
|
||||||
<td>Observaciones:</td>
|
|
||||||
<td>
|
|
||||||
<asp:TextBox ID="TxtObservacionesArmado" TextMode="MultiLine" Rows="2" CssClass="form-control input-sm" runat="server" MaxLength="200"></asp:TextBox>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -376,35 +345,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
|
||||||
<td>Paquete:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Font-Bold="true" Text="" ID="LbPaqueteDesarmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cantidad:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbCantidadDesarmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<hr />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Almacén:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbAlmacenDesarmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Fecha:</td>
|
|
||||||
<td>
|
|
||||||
<asp:Label Text="" ID="LbFechaDesarmado" runat="server" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Observaciones:</td>
|
<td>Observaciones:</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -268,12 +268,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
End If
|
End If
|
||||||
UpSeriesPaqueteArmado.Update()
|
UpSeriesPaqueteArmado.Update()
|
||||||
|
|
||||||
LbPaqueteArmado.Text = DdlPaqueteArmado.SelectedItem.Text
|
|
||||||
CvePaqueteArmado = DdlPaqueteArmado.SelectedValue.ToEntero
|
CvePaqueteArmado = DdlPaqueteArmado.SelectedValue.ToEntero
|
||||||
LbCantidadArmado.Text = TxtCantidadArmado.Text
|
|
||||||
'LbAlmacenArmado.Text = DdlAlmacenArmado.SelectedItem.Text
|
|
||||||
CveAlmacenArmado = DdlAlmacenArmado.SelectedValue.ToEntero
|
CveAlmacenArmado = DdlAlmacenArmado.SelectedValue.ToEntero
|
||||||
'LbFechaArmado.Text = TxtFechaArmado.Text
|
|
||||||
|
|
||||||
GvDatosArmado.DataSource = DtDatos
|
GvDatosArmado.DataSource = DtDatos
|
||||||
GvDatosArmado.DataBind()
|
GvDatosArmado.DataBind()
|
||||||
@@ -364,12 +360,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
End If
|
End If
|
||||||
UpSeriesPaqueteDesarmado.Update()
|
UpSeriesPaqueteDesarmado.Update()
|
||||||
|
|
||||||
LbPaqueteDesarmado.Text = DdlPaqueteDesarmado.SelectedItem.Text
|
|
||||||
CvePaqueteDesarmado = DdlPaqueteDesarmado.SelectedValue.ToEntero
|
CvePaqueteDesarmado = DdlPaqueteDesarmado.SelectedValue.ToEntero
|
||||||
LbCantidadDesarmado.Text = TxtCantidadDesarmado.Text
|
|
||||||
LbAlmacenDesarmado.Text = DdlAlmacenDesarmado.SelectedItem.Text
|
|
||||||
CveAlmacenDesarmado = DdlAlmacenDesarmado.SelectedValue.ToEntero
|
CveAlmacenDesarmado = DdlAlmacenDesarmado.SelectedValue.ToEntero
|
||||||
LbFechaDesarmado.Text = TxtFechaDesarmado.Text
|
|
||||||
|
|
||||||
GvDatosDesarmado.DataSource = DtDatos
|
GvDatosDesarmado.DataSource = DtDatos
|
||||||
GvDatosDesarmado.DataBind()
|
GvDatosDesarmado.DataBind()
|
||||||
@@ -449,7 +441,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Case 2 ' DESARMADO
|
Case 2 ' DESARMADO
|
||||||
If LbCantidadDesarmado.Text.ToEntero <> DtSeriesDesarmado.Rows.Count Then
|
If TxtCantidadDesarmado.Text.ToEntero <> DtSeriesDesarmado.Rows.Count Then
|
||||||
Alert("Es necesario indicar las series del paquete a desarmar.", TipoMensaje.MsgAdvertencia)
|
Alert("Es necesario indicar las series del paquete a desarmar.", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
@@ -467,224 +459,32 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
Dim FolioSalida As Integer = 0
|
Dim FolioSalida As Integer = 0
|
||||||
Dim CveMovimientoEntrada As Integer = 0
|
Dim CveMovimientoEntrada As Integer = 0
|
||||||
Dim FolioEntrada As Integer = 0
|
Dim FolioEntrada As Integer = 0
|
||||||
Dim Fecha As Date = If(Tipo = 1, TxtFechaArmado.Text.ToDate, LbFechaDesarmado.Text.ToDate)
|
Dim Fecha As Date = If(Tipo = 1, TxtFechaArmado.Text.ToDate, TxtFechaDesarmado.Text.ToDate)
|
||||||
Dim DtDetalle As New DataTable
|
Dim DtDetalle As New DataTable
|
||||||
|
|
||||||
Dim ConcepPrePoliza1 = "ARMPAQ1"
|
Dim ConcepPrePoliza1 = "ARMPAQ1"
|
||||||
Dim ConcepPrePoliza2 = "ARMPAQ2"
|
Dim ConcepPrePoliza2 = "ARMPAQ2"
|
||||||
|
|
||||||
Dim Concepto As String = "ARMPAQ2"
|
|
||||||
Dim Modulo As String = "ARMPAQ1/ARMPAQ2"
|
Dim Modulo As String = "ARMPAQ1/ARMPAQ2"
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
Select Case (Tipo)
|
||||||
|
Case 1 ' ARMADO
|
||||||
|
|
||||||
Catch ex As Exception
|
'SALIDA COMPONENTES
|
||||||
|
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenArmado, 5, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ1")
|
||||||
|
FolioSalida = ObjInventario.Folio
|
||||||
|
|
||||||
End Try
|
If CveMovimientoSalida <= 0 Then
|
||||||
Select Case (Tipo)
|
TieneError = True
|
||||||
Case 1 ' ARMADO
|
MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar."
|
||||||
|
Exit Select
|
||||||
'SALIDA COMPONENTES
|
End If
|
||||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenArmado, 5, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ1")
|
|
||||||
FolioSalida = ObjInventario.Folio
|
|
||||||
|
|
||||||
If CveMovimientoSalida <= 0 Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar."
|
|
||||||
Exit Select
|
|
||||||
End If
|
|
||||||
|
|
||||||
For Each Gvr As GridViewRow In GvDatosArmado.Rows
|
|
||||||
If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then
|
|
||||||
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)
|
|
||||||
Dim CveSeccionAlmacen As Integer = Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero()
|
|
||||||
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 <b>{0}</b> con Serie: <b>{1}</b> no tiene existencia suficiente", Dr("PS"), Dr("Serie"))
|
|
||||||
TieneError = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 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(CveMovimientoSalida, 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
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
|
|
||||||
'ENTRADA PAQUETE
|
|
||||||
If Not TieneError Then
|
|
||||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenArmado, 19, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ2")
|
|
||||||
FolioEntrada = ObjInventario.Folio
|
|
||||||
|
|
||||||
If CveMovimientoEntrada <= 0 Then
|
|
||||||
MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar."
|
|
||||||
TieneError = True
|
|
||||||
Else
|
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
|
||||||
Dim PUTemp As Decimal = 0
|
|
||||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
|
||||||
PUTemp += Dr("PU").ToString.ToDecimal * Dr("Cantidad").ToString.ToDecimal
|
|
||||||
Next
|
|
||||||
PUTemp = PUTemp / LbCantidadArmado.Text.ToDecimal
|
|
||||||
Dim CvePSTemp = CvePaqueteArmado
|
|
||||||
Dim CveSeccionAlmacen As Integer = -1
|
|
||||||
Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimero("")
|
|
||||||
|
|
||||||
Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero
|
|
||||||
Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion"))
|
|
||||||
If AplicaSeccion Then
|
|
||||||
CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenArmado, CvePaqueteArmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If AplicaSerie Then
|
|
||||||
Dim ContadorPaquete = 1
|
|
||||||
Dim DtSeriesComponentes As New DataTable
|
|
||||||
For Each Gvr As GridViewRow In GvSeriesPaqueteArmado.Rows
|
|
||||||
'AGREGA MOVTO DETALLE DE LA ENTRADA DEL PAQUETE
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Gvr.FCTextBox("TxtSerie").Text.Trim) Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada"
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
'INGRESA EN TABLA DE CONTROL DE PAQUETES CON SERIE
|
|
||||||
For Each Gvr2 As GridViewRow In GvDatosArmado.Rows
|
|
||||||
If CBool(Gvr2.DataKey("AplicaSerie")) Then
|
|
||||||
DtSeriesComponentes = New DataTable
|
|
||||||
DtSeriesComponentes = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Copy
|
|
||||||
Dim CantidadComponente = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Rows.Count / LbCantidadArmado.Text.ToEntero
|
|
||||||
|
|
||||||
For index As Integer = (ContadorPaquete - 1) * CantidadComponente.ToEntero To (ContadorPaquete * CantidadComponente.ToEntero) - 1
|
|
||||||
If Not ObjInventario.AddPaqueteRelacionSeries(CvePSTemp, Gvr.FCTextBox("TxtSerie").Text.Trim, DtSeriesComponentes.Rows(index)("CvePS").ToString.ToEntero, DtSeriesComponentes.Rows(index)("Serie").ToString) Then
|
|
||||||
TieneError = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
|
|
||||||
ContadorPaquete = ContadorPaquete + 1
|
|
||||||
Next
|
|
||||||
Else
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, LbCantidadArmado.Text.ToDecimal, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen) Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los movimientos de entrada"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
For Each Gvr As GridViewRow In GvDatosArmado.Rows
|
||||||
|
If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then
|
||||||
Case 2 'DESARMADO
|
|
||||||
|
|
||||||
|
|
||||||
'SALIDA PAQUETE
|
|
||||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 20, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ3")
|
|
||||||
FolioSalida = ObjInventario.Folio
|
|
||||||
|
|
||||||
If CveMovimientoSalida <= 0 Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar."
|
|
||||||
Exit Select
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim CvePSTemp As Integer = CvePaqueteDesarmado
|
|
||||||
Dim CveSeccionAlmacen As Integer = -1
|
|
||||||
Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("")
|
|
||||||
|
|
||||||
Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero
|
|
||||||
'Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion"))
|
|
||||||
'If AplicaSeccion Then
|
|
||||||
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
|
|
||||||
'End If
|
|
||||||
If AplicaSerie Then
|
|
||||||
For Each Gvr As GridViewRow In GvSeriesPaqueteDesarmado.Rows
|
|
||||||
'AGREGA MOVTO DETALLE DE LA SALIDA DEL PAQUETE
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=-3, Serie:=Gvr.DataKey("Serie").ToString) Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida"
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
'ELIMINA EN TABLA DE CONTROL DE PAQUETES CON SERIE
|
|
||||||
If Not ObjInventario.RemovePaqueteRelacionSeries(CvePSTemp, Gvr.DataKey("Serie").ToString) Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida"
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Else
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, TxtCantidadDesarmado.Text.ToDecimal, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=CveSeccionAlmacen) Then
|
|
||||||
TieneError = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los movimientos de salida"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
'ENTRADA COMPONENTES
|
|
||||||
If Not TieneError Then
|
|
||||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 4, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ4")
|
|
||||||
FolioEntrada = ObjInventario.Folio
|
|
||||||
|
|
||||||
If CveMovimientoEntrada <= 0 Then
|
|
||||||
MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar."
|
|
||||||
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 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 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)
|
Dim FechaCaducidad As String = If(Gvr.FCTextBox("TxtCaducidad").Text = "", "-1", Gvr.FCTextBox("TxtCaducidad").Text)
|
||||||
If CBool(Gvr.DataKey("AplicaSeccion")) Then
|
Dim CveSeccionAlmacen As Integer = Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero()
|
||||||
CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
|
|
||||||
End If
|
|
||||||
|
|
||||||
If CBool(Gvr.DataKey("AplicaSerie")) Then
|
If CBool(Gvr.DataKey("AplicaSerie")) Then
|
||||||
For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows
|
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
|
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
|
||||||
@@ -693,8 +493,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1,
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 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
|
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."
|
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida. Por favor vuelva a intentar."
|
||||||
TieneError = True
|
TieneError = True
|
||||||
Exit For
|
Exit For
|
||||||
@@ -706,61 +506,229 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero,
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero,
|
||||||
Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote,
|
Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote,
|
||||||
FechaCaducidad:=FechaCaducidad.ToDate) Then
|
FechaCaducidad:=FechaCaducidad.ToDate) Then
|
||||||
MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar."
|
MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar."
|
||||||
TieneError = True
|
TieneError = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
End If
|
||||||
End If
|
Next
|
||||||
End If
|
|
||||||
|
|
||||||
ConcepPrePoliza1 = "ARMPAQ3"
|
|
||||||
ConcepPrePoliza1 = "ARMPAQ4"
|
|
||||||
|
|
||||||
End Select
|
|
||||||
|
|
||||||
'CONTABILIZAR MOVIMIENTOS
|
'ENTRADA PAQUETE
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
Dim ImportePrePoliza As Decimal = 0D
|
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenArmado, 19, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ2")
|
||||||
|
FolioEntrada = ObjInventario.Folio
|
||||||
|
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
|
If CveMovimientoEntrada <= 0 Then
|
||||||
ImportePrePoliza = ObjInventario.DtResultados.SUMD("Total")
|
MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar."
|
||||||
End If
|
TieneError = True
|
||||||
|
Else
|
||||||
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||||
|
Dim PUTemp As Decimal = 0
|
||||||
|
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||||
|
PUTemp += Dr("PU").ToString.ToDecimal * Dr("Cantidad").ToString.ToDecimal
|
||||||
|
Next
|
||||||
|
PUTemp = PUTemp / TxtCantidadArmado.Text.ToDecimal
|
||||||
|
Dim CvePSTemp = CvePaqueteArmado
|
||||||
|
Dim CveSeccionAlmacen As Integer = -1
|
||||||
|
Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimero("")
|
||||||
|
|
||||||
|
Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero
|
||||||
|
Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion"))
|
||||||
|
If AplicaSeccion Then
|
||||||
|
CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenArmado, CvePaqueteArmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Dim MovAlmacen As Boolean = True
|
If AplicaSerie Then
|
||||||
|
Dim ContadorPaquete = 1
|
||||||
|
Dim DtSeriesComponentes As New DataTable
|
||||||
|
For Each Gvr As GridViewRow In GvSeriesPaqueteArmado.Rows
|
||||||
|
'AGREGA MOVTO DETALLE DE LA ENTRADA DEL PAQUETE
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Gvr.FCTextBox("TxtSerie").Text.Trim) Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 19).ToEntero
|
'INGRESA EN TABLA DE CONTROL DE PAQUETES CON SERIE
|
||||||
|
For Each Gvr2 As GridViewRow In GvDatosArmado.Rows
|
||||||
|
If CBool(Gvr2.DataKey("AplicaSerie")) Then
|
||||||
|
DtSeriesComponentes = New DataTable
|
||||||
|
DtSeriesComponentes = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Copy
|
||||||
|
Dim CantidadComponente = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Rows.Count / TxtCantidadArmado.Text.ToEntero
|
||||||
|
|
||||||
If OrigenMov = 1 Then
|
For index As Integer = (ContadorPaquete - 1) * CantidadComponente.ToEntero To (ContadorPaquete * CantidadComponente.ToEntero) - 1
|
||||||
MovAlmacen = True
|
If Not ObjInventario.AddPaqueteRelacionSeries(CvePSTemp, Gvr.FCTextBox("TxtSerie").Text.Trim, DtSeriesComponentes.Rows(index)("CvePS").ToString.ToEntero, DtSeriesComponentes.Rows(index)("Serie").ToString) Then
|
||||||
Else
|
TieneError = True
|
||||||
MovAlmacen = False
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 74, ImportePrePoliza, ImportePrePoliza, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
ContadorPaquete = ContadorPaquete + 1
|
||||||
'Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
|
Next
|
||||||
|
Else
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, TxtCantidadArmado.Text.ToDecimal, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen) Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, ConcepPrePoliza2, ConcepPrePoliza2, CveMovimientoAlmacen:=CveMovimientoEntrada, CveSubProyecto:=-1, Contabilizable:=True) Then
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
MensajeError = "Ocurrió un error al guardar los movimientos de entrada"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
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
|
Case 2 'DESARMADO
|
||||||
GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
|
||||||
|
|
||||||
|
'SALIDA PAQUETE
|
||||||
|
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 20, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ3")
|
||||||
|
FolioSalida = ObjInventario.Folio
|
||||||
|
|
||||||
|
If CveMovimientoSalida <= 0 Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar."
|
||||||
|
Exit Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim CvePSTemp As Integer = CvePaqueteDesarmado
|
||||||
|
Dim CveSeccionAlmacen As Integer = -1
|
||||||
|
Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("")
|
||||||
|
|
||||||
|
Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero
|
||||||
|
'Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion"))
|
||||||
|
'If AplicaSeccion Then
|
||||||
|
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
|
||||||
|
'End If
|
||||||
|
If AplicaSerie Then
|
||||||
|
For Each Gvr As GridViewRow In GvSeriesPaqueteDesarmado.Rows
|
||||||
|
'AGREGA MOVTO DETALLE DE LA SALIDA DEL PAQUETE
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=-3, Serie:=Gvr.DataKey("Serie").ToString) Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
'ELIMINA EN TABLA DE CONTROL DE PAQUETES CON SERIE
|
||||||
|
If Not ObjInventario.RemovePaqueteRelacionSeries(CvePSTemp, Gvr.DataKey("Serie").ToString) Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, TxtCantidadDesarmado.Text.ToDecimal, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=CveSeccionAlmacen) Then
|
||||||
|
TieneError = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los movimientos de salida"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
'ENTRADA COMPONENTES
|
||||||
|
If Not TieneError Then
|
||||||
|
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 4, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ4")
|
||||||
|
FolioEntrada = ObjInventario.Folio
|
||||||
|
|
||||||
|
If CveMovimientoEntrada <= 0 Then
|
||||||
|
MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar."
|
||||||
|
TieneError = True
|
||||||
|
Else
|
||||||
|
For Each Gvr As GridViewRow In GvDatosDesarmado.Rows
|
||||||
|
|
||||||
|
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 <b>{0}</b> con Serie: <b>{1}</b> 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, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, -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, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, -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"
|
||||||
|
ConcepPrePoliza2 = "ARMPAQ4"
|
||||||
|
Modulo = "ARMPAQ3/ARMPAQ4"
|
||||||
|
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, Modulo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ImportePrePoliza, ImportePrePoliza, 68, ConcepPrePoliza2, ConcepPrePoliza2, CveMovimientoAlmacen:=CveMovimientoEntrada, CveSubProyecto:=-1, Contabilizable:=True) Then
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
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
|
End If
|
||||||
End If
|
Catch ex As Exception
|
||||||
|
TieneError = True
|
||||||
|
OnError("Ocurrió un error al generar el movimiento", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
Dim Msg As New StringBuilder
|
Dim Msg As New StringBuilder
|
||||||
Msg.AppendFormat("<br/>El Movimiento de salida se registro con el Folio: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoSalida, FolioSalida)
|
Msg.AppendFormat("<br/>El Movimiento de salida se registro con el Folio: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoSalida, FolioSalida)
|
||||||
@@ -778,6 +746,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
ObjInventario.Dispose() 'elimino la instancia
|
ObjInventario.Dispose() 'elimino la instancia
|
||||||
|
ObjConta.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Limpia(Tipo As Integer)
|
Private Sub Limpia(Tipo As Integer)
|
||||||
@@ -792,12 +761,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
DivSeriesPaqueteArmado.Visible = False
|
DivSeriesPaqueteArmado.Visible = False
|
||||||
GvDatosArmado.Columns(4).Visible = False
|
GvDatosArmado.Columns(4).Visible = False
|
||||||
|
|
||||||
LbPaqueteArmado.Text = ""
|
|
||||||
CvePaqueteArmado = -1
|
CvePaqueteArmado = -1
|
||||||
LbCantidadArmado.Text = ""
|
|
||||||
'LbAlmacenArmado.Text = ""
|
|
||||||
CveAlmacenArmado = -1
|
CveAlmacenArmado = -1
|
||||||
'LbFechaArmado.Text = ""
|
|
||||||
TxtObservacionesArmado.Text = ""
|
TxtObservacionesArmado.Text = ""
|
||||||
UpGeneralesArmado.Update()
|
UpGeneralesArmado.Update()
|
||||||
|
|
||||||
@@ -806,12 +771,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
UpSeriesPaqueteArmado.Update()
|
UpSeriesPaqueteArmado.Update()
|
||||||
'Else
|
'Else
|
||||||
|
|
||||||
LbPaqueteDesarmado.Text = ""
|
|
||||||
CvePaqueteDesarmado = -1
|
CvePaqueteDesarmado = -1
|
||||||
LbCantidadDesarmado.Text = ""
|
|
||||||
LbAlmacenDesarmado.Text = ""
|
|
||||||
CveAlmacenDesarmado = -1
|
CveAlmacenDesarmado = -1
|
||||||
LbFechaDesarmado.Text = ""
|
|
||||||
TxtObservacionesDesarmado.Text = ""
|
TxtObservacionesDesarmado.Text = ""
|
||||||
UpGeneralesDesarmado.Update()
|
UpGeneralesDesarmado.Update()
|
||||||
|
|
||||||
@@ -1133,7 +1094,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
Dt.Columns.Add("Serie", GetType(String))
|
Dt.Columns.Add("Serie", GetType(String))
|
||||||
|
|
||||||
For Each Row As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CType(sender, LinkButton).CommandArgument.ToEntero)).Rows
|
For Each Row As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CType(sender, LinkButton).CommandArgument.ToEntero)).Rows
|
||||||
If i > LbCantidadArmado.Text.ToEntero Then
|
If i > TxtCantidadArmado.Text.ToEntero Then
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -1164,7 +1125,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
'VERIFICA EXISTENCIAS
|
'VERIFICA EXISTENCIAS
|
||||||
Dim ObjInventarios As New ClsInventarios
|
Dim ObjInventarios As New ClsInventarios
|
||||||
Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero
|
Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero
|
||||||
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePaqueteDesarmado, CveUMTemp, UsuarioActual.CveEmpresa, CveAlmacenDesarmado, FechaMovto:=LbFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente))
|
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePaqueteDesarmado, CveUMTemp, UsuarioActual.CveEmpresa, CveAlmacenDesarmado, FechaMovto:=TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente))
|
||||||
|
|
||||||
If Existencia < 1 Then
|
If Existencia < 1 Then
|
||||||
Alert($"No hay existencia suficiente con la Serie definida <b>""{Serie}""</b>. Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
Alert($"No hay existencia suficiente con la Serie definida <b>""{Serie}""</b>. Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -1190,7 +1151,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
|
|
||||||
TxtSerieDesarmado.Text = ""
|
TxtSerieDesarmado.Text = ""
|
||||||
|
|
||||||
If DtSeriesDesarmado.Rows.Count >= LbCantidadDesarmado.Text.ToEntero Then
|
If DtSeriesDesarmado.Rows.Count >= TxtCantidadDesarmado.Text.ToEntero Then
|
||||||
BtnAgregarSerieDesarmado.Enabled = False
|
BtnAgregarSerieDesarmado.Enabled = False
|
||||||
Else
|
Else
|
||||||
BtnAgregarSerieDesarmado.Enabled = True
|
BtnAgregarSerieDesarmado.Enabled = True
|
||||||
@@ -1216,7 +1177,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
|
|||||||
|
|
||||||
dtTemp.Dispose()
|
dtTemp.Dispose()
|
||||||
|
|
||||||
If DtSeriesDesarmado.Rows.Count >= LbCantidadDesarmado.Text.ToEntero Then
|
If DtSeriesDesarmado.Rows.Count >= TxtCantidadDesarmado.Text.ToEntero Then
|
||||||
BtnAgregarSerieDesarmado.Enabled = False
|
BtnAgregarSerieDesarmado.Enabled = False
|
||||||
Else
|
Else
|
||||||
BtnAgregarSerieDesarmado.Enabled = True
|
BtnAgregarSerieDesarmado.Enabled = True
|
||||||
|
|||||||
Reference in New Issue
Block a user