-- movimiento de prepolizas

This commit is contained in:
rrene
2020-10-06 09:58:46 -07:00
parent c0ba71fdd7
commit 94d3066c09
2 changed files with 35 additions and 8 deletions

View File

@@ -80,7 +80,7 @@
<asp:TemplateField ItemStyle-Width="7%"> <asp:TemplateField ItemStyle-Width="7%">
<ItemTemplate> <ItemTemplate>
<%--<asp:Literal ID="LtlExistencia" runat="server" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>'></asp:Literal>--%> <%--<asp:Literal ID="LtlExistencia" runat="server" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>'></asp:Literal>--%>
<asp:TextBox ID="TxtCantidad" runat="server" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>' Width="100%" /> <asp:TextBox ID="TxtCantidad" runat="server" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>' Width="35px" />
<asp:RangeValidator ID="RVR" Display="Dynamic" ControlToValidate="TxtCantidad" runat="server" MinimumValue="0" Type="Double" ErrorMessage="No cumple con la cantidad especificada"></asp:RangeValidator> <asp:RangeValidator ID="RVR" Display="Dynamic" ControlToValidate="TxtCantidad" runat="server" MinimumValue="0" Type="Double" ErrorMessage="No cumple con la cantidad especificada"></asp:RangeValidator>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>

View File

@@ -65,11 +65,13 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Private Sub BtnCambiarSeccion_Click(sender As Object, e As EventArgs) Handles BtnCambiarSeccion.Click Private Sub BtnCambiarSeccion_Click(sender As Object, e As EventArgs) Handles BtnCambiarSeccion.Click
Dim ObjInventario As New ClsInventarios Dim ObjInventario As New ClsInventarios
Dim ObjPS As New ClsProductosServicios(ObjInventario.IniciaTransacSQL) Dim ObjPS As New ClsProductosServicios(ObjInventario.IniciaTransacSQL)
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL)
Dim Dtt As DataTable = Nothing Dim Dtt As DataTable = Nothing
Dim CveMovimientoEntrada As Integer = 0 Dim CveMovimientoEntrada As Integer = 0
Dim Folio = 0 Dim Folio = 0
Dim ErrorMovInv As Boolean = False Dim ErrorMovInv As Boolean = False
Dim TextoError = "" Dim TextoError = ""
Dim Contador As Integer = 0
Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero
@@ -106,12 +108,13 @@ Partial Class Inventarios_AjustesSeccionAlmacen
TextoError = "Ocurrió un error al guardar los movimientos de salida" TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For Exit For
End If End If
Contador += 1
End If End If
Next Next
If Not ErrorMovInv Then If Not ErrorMovInv AndAlso Contador > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
@@ -121,7 +124,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
For Each Row As DataRow In resultado.Rows For Each Row As DataRow In resultado.Rows
Dim CvePS = Row("CvePS").ToString().ToEntero() Dim CvePS = Row("CvePS").ToString().ToEntero()
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() Cantidad = Row("Cantidad").ToString.ToDecimal()
Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal() Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal()
Dim CveUM As Integer = Row("CveUM").ToString().ToEntero() Dim CveUM As Integer = Row("CveUM").ToString().ToEntero()
Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero() Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero()
@@ -143,8 +146,23 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End If End If
ind += 1 ind += 1
Next Next
resultado.Dispose()
'inserto la prepoliza
If CveMovimientoEntrada > 0 AndAlso CveMovimientoSalida > 0 Then
Dim Concepto As String = "Ajuste Sección"
Dim IdCtaContableOrigen As Integer = 0
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/AjusteAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim importe As Decimal = resultado.SUMD("Total").RoundSQL
Dim contabilizable As Boolean = False
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, Concepto, 68, Concepto, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=contabilizable, ImporteMX:=importe) Then
ErrorMovInv = True
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, Concepto, 68, Concepto, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=contabilizable, ImporteMX:=importe) Then
ErrorMovInv = True
End If
End If
resultado.Dispose()
Else Else
TextoError = "No se pudo registrar el movimiento" TextoError = "No se pudo registrar el movimiento"
ErrorMovInv = True ErrorMovInv = True
@@ -155,16 +173,25 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End If End If
If Not ErrorMovInv Then If Not ErrorMovInv Then
ObjInventario.Commit()
GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, -1, -1) = Nothing If Contador > 0 Then
CargaDatos() ObjInventario.Commit()
Alert("El Movimiento quede registrado correctamente", TipoMensaje.MsgInformacion) GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, -1, -1) = Nothing
CargaDatos()
Alert("El Movimiento quede registrado correctamente", TipoMensaje.MsgInformacion)
Else
ObjInventario.RollBack()
Alert("No se especificaron productos", TipoMensaje.MsgError)
End If
Else Else
ObjInventario.RollBack() ObjInventario.RollBack()
Alert("Ocurrio un error al registrar el movimiento", TipoMensaje.MsgError) Alert("Ocurrio un error al registrar el movimiento", TipoMensaje.MsgError)
End If End If
ObjInventario.Dispose() ObjInventario.Dispose()
ObjConta.Dispose()
ObjPS.Dispose()
End Sub End Sub
Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles LbDescargarExcel.Click, BtnDescargar.Click Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles LbDescargarExcel.Click, BtnDescargar.Click