diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 3156bdd13..a35ba56ab 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5809,6 +5809,27 @@ Public Class ClsContabilidad #End Region +#Region "OCDETALLE ALMACEN" + + Public Function GetOCDetalleAlmacen(MaxDiferencia As Decimal, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_OCDetalleAlmacen") + With SqlAdapter.SelectCommand.Parameters + .Add("@MaxDiferencia", SqlDbType.Money).Value = MaxDiferencia + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos de oc detalle almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + +#End Region + #Region "IDisposable Support" ' IDisposable Protected Overridable Sub Dispose(disposing As Boolean) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4588d1c1e..f0d7a5286 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4531,31 +4531,38 @@ Public Class ClsPaginas 'Pyme 2017 PaginaDict.Add("/PyME/Sistemas/RegistroEmpresa.aspx".ToUpper(), -1) - PaginaDict.Add("/PyME/Sistemas/WizardRegistro.aspx".ToUpper(), -1) - 'PaginaDict.Add("/Compras/Efacturas.aspx".ToUpper(), 2007) - 'PaginaDict.Add("/Compras/Compras.aspx".ToUpper(), 2008) - 'PaginaDict.Add("/Compras/Proveedores.aspx".ToUpper(), 2009) - 'PaginaDict.Add("/OC/OC.aspx".ToUpper(), 2011) - 'PaginaDict.Add("/OC/RepOC.aspx".ToUpper(), 2012) - - - 'PaginaDict.Add("/Ventas/CatPS.aspx".ToUpper(), 2033) - 'PaginaDict.Add("/Ventas/CatPS.aspx".ToUpper(), 2034) - - ''PaginaDict.Add("/Sistemas/WizardRegistro.aspx".ToUpper(), 2035) - 'PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 2036) - 'PaginaDict.Add("/Planeacion/CatFolios.aspx".ToUpper(), 2037) - 'PaginaDict.Add("/Sistemas/CatRoles.aspx".ToUpper(), 2038) - 'PaginaDict.Add("/Sistemas/Usuarios.aspx".ToUpper(), 2039) - 'PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 2040) - - - - - 'CONTSIG (CONTabilidad al SIGuiente nivel) - - - + PaginaDict.Add("/PyME/Sistemas/WizardRegistro.aspx".ToUpper(), -1) + + + PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1) + + + + + 'PaginaDict.Add("/Compras/Efacturas.aspx".ToUpper(), 2007) + 'PaginaDict.Add("/Compras/Compras.aspx".ToUpper(), 2008) + 'PaginaDict.Add("/Compras/Proveedores.aspx".ToUpper(), 2009) + 'PaginaDict.Add("/OC/OC.aspx".ToUpper(), 2011) + 'PaginaDict.Add("/OC/RepOC.aspx".ToUpper(), 2012) + + + 'PaginaDict.Add("/Ventas/CatPS.aspx".ToUpper(), 2033) + 'PaginaDict.Add("/Ventas/CatPS.aspx".ToUpper(), 2034) + + ''PaginaDict.Add("/Sistemas/WizardRegistro.aspx".ToUpper(), 2035) + 'PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 2036) + 'PaginaDict.Add("/Planeacion/CatFolios.aspx".ToUpper(), 2037) + 'PaginaDict.Add("/Sistemas/CatRoles.aspx".ToUpper(), 2038) + 'PaginaDict.Add("/Sistemas/Usuarios.aspx".ToUpper(), 2039) + 'PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 2040) + + + + + 'CONTSIG (CONTabilidad al SIGuiente nivel) + + + PaginaDict.Add("/Compras/RepCxPCaudillo.aspx".ToUpper(), -1) diff --git a/Contabilidad/OCDetalleAlmacen.aspx b/Contabilidad/OCDetalleAlmacen.aspx new file mode 100644 index 000000000..49a17fbd0 --- /dev/null +++ b/Contabilidad/OCDetalleAlmacen.aspx @@ -0,0 +1,53 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OCDetalleAlmacen.aspx.vb" Inherits="Contabilidad_OCDetalleAlmacen" %> + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + + diff --git a/Contabilidad/OCDetalleAlmacen.aspx.vb b/Contabilidad/OCDetalleAlmacen.aspx.vb new file mode 100644 index 000000000..1c74b5520 --- /dev/null +++ b/Contabilidad/OCDetalleAlmacen.aspx.vb @@ -0,0 +1,163 @@ + +Imports System.Data +Imports Extensiones + +Partial Class Contabilidad_OCDetalleAlmacen + Inherits ClsPaginas + + + Property DTDatos As DataTable + Get + If ViewState("DTDatos") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTDatos"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTDatos") = value + End Set + End Property + + + Private Sub Contabilidad_OCDetalleAlmacen_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + Private Sub CargaDatos() + + + Dim ObjConta As New ClsContabilidad + + + + If ObjConta.GetOCDetalleAlmacen(1000D, UsuarioActual.CveEmpresa) Then + + If ObjConta.DtResultados.Rows.Count > 0 Then + DTDatos = ObjConta.DtResultados + GvDAtos.DataSource = DTDatos + Alert($"Se encontraron {ObjConta.DtResultados.Rows.Count} registros.") + Else + DTDatos = Nothing + Alert("Nos se encontraron registros por proocesar ") + GvDAtos.DataSource = Nothing + End If + Else + DTDatos = Nothing + GvDAtos.DataSource = Nothing + End If + + GvDAtos.DataBind() + + ObjConta.Dispose() + + End Sub + + + Protected Sub BtnProcesarRegistros_Click(sender As Object, e As EventArgs) + + + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + + Dim modulo As String = "OC Ajuste Manual" + Dim ErrorProcesamiento As Boolean = False + Dim mensaje As String = "" + Dim ContadorProcesados As Integer = 0 + + For Each GvDrow As GridViewRow In GvDAtos.Rows + + Dim CvePrePoliza As Integer = 0 + Dim Cargo As Decimal = GvDrow.DataKey("Cargo").ToString.ToDecimal + Dim Abono As Decimal = GvDrow.DataKey("Abono").ToString.ToDecimal + Dim Diferencia As Decimal = Math.Abs(GvDrow.DataKey("dif").ToString.ToDecimal) + Dim CveMoneda As Integer = GvDrow.DataKey("CveMoneda").ToString.ToEntero + Dim Fecha As Date = GvDrow.DataKey("Fecha").ToString.ToDate + Dim Referencia As String = GvDrow.DataKey("Referencia").ToString + Dim CveOCDetalle As Integer = GvDrow.DataKey("CveOrdenCompraDetalle").ToString.ToEntero + Dim CveOC As Integer = GvDrow.DataKey("CveOrdenCompra").ToString.ToEntero + Dim CveProveedor As Integer = GvDrow.DataKey("CveProveedor").ToString.ToEntero + Dim CveCompra As Integer = GvDrow.DataKey("CveCompra").ToString.ToEntero + Dim Folio As String = GvDrow.DataKey("Folio").ToString + + + Dim CveCuenta176 As Integer = 55169 + Dim IdCtaCuenta176 As Integer = 1245 + + Dim CveCuenta177 As Integer = 55294 + Dim IdCtaCuenta177 As Integer = 1148 + + Dim Chk As CheckBox = GvDrow.FCCheckBox("Chk") + + + If Chk IsNot Nothing AndAlso Chk.Checked Then + CvePrePoliza = ObjConta.AddPrePolizas(modulo, 3, Diferencia, Diferencia, CveMoneda, Fecha, modulo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + GvDrow.Cells(1).Text = CvePrePoliza.ToString + mensaje = mensaje & $"CvePrePoliza {CvePrePoliza } OC: {Folio} Importe :{Diferencia}
" + + + If CvePrePoliza > 0 Then + + If Cargo > Abono Then + If (ObjConta.AddPrePolizasDetalle(CvePrePoliza, 1, Diferencia, Referencia, 176, Referencia, Fecha, IdCtaCuenta176, -1, ImporteME:=0, ImporteMX:=Diferencia, CveCompra:=CveCompra, Contabilizable:=1, CveOC:=CveOC, CveOCDetalle:=CveOCDetalle, CveProveedor:=CveProveedor)) Then + + If (ObjConta.AddPrePolizasDetalle(CvePrePoliza, 1, -Diferencia, Referencia, 177, Referencia, Fecha, IdCtaCuenta177, -1, ImporteME:=-0, ImporteMX:=-Diferencia, CveCompra:=CveCompra, Contabilizable:=1, CveOC:=CveOC, CveOCDetalle:=CveOCDetalle, CveProveedor:=CveProveedor)) Then + ContadorProcesados = ContadorProcesados + 1 + Else + ErrorProcesamiento = True + Exit For + End If + Else + ErrorProcesamiento = True + Exit For + End If + + Else + If (ObjConta.AddPrePolizasDetalle(CvePrePoliza, 1, -Diferencia, Referencia, 176, Referencia, Fecha, IdCtaCuenta176, -1, ImporteME:=-0, ImporteMX:=-Diferencia, CveCompra:=CveCompra, Contabilizable:=1, CveOC:=CveOC, CveOCDetalle:=CveOCDetalle, CveProveedor:=CveProveedor)) Then + + If (ObjConta.AddPrePolizasDetalle(CvePrePoliza, 1, Diferencia, Referencia, 177, Referencia, Fecha, IdCtaCuenta177, -1, ImporteME:=0, ImporteMX:=Diferencia, CveCompra:=CveCompra, Contabilizable:=1, CveOC:=CveOC, CveOCDetalle:=CveOCDetalle, CveProveedor:=CveProveedor)) Then + ContadorProcesados = ContadorProcesados + 1 + Else + ErrorProcesamiento = True + Exit For + End If + Else + ErrorProcesamiento = True + Exit For + End If + + End If + + End If + End If + + + Next + + + DTDatos.AcceptChanges() + + If Not ErrorProcesamiento Then + + ObjConta.Commit() + 'ObjConta.RollBack() ' + 'BtnProcesarRegistros.Enabled = False + Alert($"PrePolizas agregadas correctamente
registros procesados: {ContadorProcesados}
{mensaje}") + Else + ObjConta.RollBack() + End If + + ObjConta.Dispose() + + + CargaDatos() + + End Sub + + +End Class