diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb index fa1ae71b7..fa03b1f8e 100644 --- a/App_Code/ClsCGame.vb +++ b/App_Code/ClsCGame.vb @@ -773,6 +773,21 @@ Public Class ClsCGame #Region "HUERTAS" + Public Function GetOrigen(CveEmpresa As Integer, Optional CveOrigen As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_CGame_OrigenGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrigen", SqlDbType.Int).Value = CveOrigen + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las huertas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function Public Function GetHuerta(CveEmpresa As Integer, Optional CveHuerta As Integer = -1, Optional Estatus As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CGame_HuertaGet") diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 87bb5d529..8da82fc41 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1153,7 +1153,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function MovimientoRemove(CveMovimiento As Integer, CveEmpresa As Integer) As Boolean + Public Function MovimientoRemove(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveUsuario As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1162,6 +1162,7 @@ Public Class ClsInventarios With SqlAdapter.SelectCommand.Parameters .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario End With diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index d0cf74241..248134785 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -609,7 +609,7 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function CalculosISRAguinaldo(fraccionII_1 As Decimal, salariomensual As Decimal, diasmes As Int32, ejercicio As Int32) As Boolean + Public Function CalculosISRAguinaldo(fraccionII_1 As Decimal, salariomensual As Decimal, diasmes As Decimal, ejercicio As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_CalculosISRAguinaldo", CommandType.StoredProcedure) addParameters("@FraccionII_1", SqlDbType.Money, fraccionII_1) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 1dac5ec5c..f62a5b548 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5599,7 +5599,7 @@ Public Class ClsVentas End Function - Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean + Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, TipoCambioConsulta As Decimal, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_LineasAdicionalesSaldoGet") @@ -5611,6 +5611,7 @@ Public Class ClsVentas .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo + .Add("@TipoCambioConsulta", SqlDbType.Decimal).Value = TipoCambioConsulta .Add("@FechaVencimientoConsulta", SqlDbType.Date).Value = FechaVencimientoConsulta End With Try diff --git a/App_Code/SqlServerTypes/Loader.cs b/App_Code/SqlServerTypes/Loader.cs deleted file mode 100644 index ce606cf2e..000000000 --- a/App_Code/SqlServerTypes/Loader.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace SqlServerTypes -{ - /// - /// Utility methods related to CLR Types for SQL Server - /// - public class Utilities - { - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern IntPtr LoadLibrary(string libname); - - /// - /// Loads the required native assemblies for the current architecture (x86 or x64) - /// - /// - /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications - /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications. - /// - public static void LoadNativeAssemblies(string rootApplicationPath) - { - var nativeBinaryPath = IntPtr.Size > 4 - ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\") - : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\"); - - LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll"); - LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll"); - } - - private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName) - { - var path = Path.Combine(nativeBinaryPath, assemblyName); - var ptr = LoadLibrary(path); - if (ptr == IntPtr.Zero) - { - throw new Exception(string.Format( - "Error loading {0} (ErrorCode: {1})", - assemblyName, - Marshal.GetLastWin32Error())); - } - } - } -} \ No newline at end of file diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index dbca48046..0bfb003be 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -102,12 +102,17 @@ Public Class E141 : Implements IHttpHandler 'DESCARGA DEL PDF If Not String.IsNullOrEmpty(Params) Then - Dim UrlParametros As Hashtable = Parametros(Decripta(Params)) + Try + Dim UrlParametros As Hashtable = Parametros(Decripta(Params)) + + Dim File As String = UrlParametros("FILE").ToString() + If Not String.IsNullOrEmpty(File) Then + ImprimirbytesPDF(context, DescargarFactura(File), File) + End If + Catch ex As Exception + GuardaLogAD("Ocurrió un error al descargar el pdf. " + ex.ToString() + ".parametros: " + Params, "LogE141") + End Try - Dim File As String = UrlParametros("FILE").ToString() - If Not String.IsNullOrEmpty(File) Then - ImprimirbytesPDF(context, DescargarFactura(File), File) - End If Else Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString()) diff --git a/Bancos/Creditos.aspx.vb b/Bancos/Creditos.aspx.vb index 01d6c9622..79963120b 100644 --- a/Bancos/Creditos.aspx.vb +++ b/Bancos/Creditos.aspx.vb @@ -719,7 +719,10 @@ Partial Class Bancos_Creditos ErrorCredito = True End If - If ObjCredito.AddCreditos(TipoCreditoTemp, TxtCSReferencia.Text, TxtCSObservaciones.Text, DdlCuentaCredito.SelectedValue.ToEntero, HdnCveCompra.Value.ToEntero, -1, DdlCSTipoMoneda.SelectedValue.ToEntero, TxtCSFechaInicio.Text.Trim.ToDate, TxtCSFechaVencimiento.Text.Trim.ToDate, TxtCSTasa.Text.Trim.ToDouble, TxtCSSobreTasa.Text.Trim.ToDouble, -1, TxtCSPlazo.Text.ToEntero, CveIE, If(TipoCreditoTemp = 2, TxtCSTotalCredito.Text.ToEntero, TotalCompra), -1, -1, -1, CveProveedor, RBLClasificacionContable.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=DdlTarjetaCredito.SelectedValue.ToEntero, AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False)) > 0 Then + If ObjCredito.AddCreditos(TipoCreditoTemp, TxtCSReferencia.Text, TxtCSObservaciones.Text, DdlCuentaCredito.SelectedValue.ToEntero, HdnCveCompra.Value.ToEntero, -1, DdlCSTipoMoneda.SelectedValue.ToEntero, TxtCSFechaInicio.Text.Trim.ToDate, + TxtCSFechaVencimiento.Text.Trim.ToDate, TxtCSTasa.Text.Trim.ToDouble, TxtCSSobreTasa.Text.Trim.ToDouble, -1, TxtCSPlazo.Text.ToEntero, CveIE, If(TipoCreditoTemp = 2, TxtCSTotalCredito.Text.ToEntero, TotalCompra), + -1, -1, -1, CveProveedor, RBLClasificacionContable.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=DdlTarjetaCredito.SelectedValue.ToEntero, + AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False)) > 0 Then 'Dim Fecha = If(TipoCreditoTemp = 2, TxtCSFechaDeposito.Text.ToDate, TxtCSFechaVencimiento.Text.ToDate) 'For i = 1 To If(TipoCreditoTemp = 2, TxtCSPeriodos.Text.Trim.ToEntero, 1) 'DateAdd("d", TxtPlazo.Text.ToEntero, Fecha) @@ -761,7 +764,10 @@ Partial Class Bancos_Creditos If CveCredito > 0 Then Dim TipoCreditoTemp = DdlTipoCredito.SelectedValue.ToEntero - If ObjCredito.UpdateCreditos(CveCredito, TipoCreditoTemp, TxtCSReferencia.Text, TxtCSObservaciones.Text, DdlCuentaCredito.SelectedValue.ToEntero, HdnCveCompra.Value.ToEntero, -1, DdlCSTipoMoneda.SelectedValue.ToEntero, TxtCSFechaInicio.Text.Trim.ToDate, TxtCSFechaVencimiento.Text.Trim.ToDate, TxtCSTasa.Text.Trim.ToDouble, TxtCSSobreTasa.Text.Trim.ToDouble, -1, TxtCSPlazo.Text.ToEntero, CveIE, If(TipoCreditoTemp = 2, TxtCSTotalCredito.Text.ToEntero, TotalCompra), -1, -1, -1, -1, RBLClasificacionContable.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=DdlTarjetaCredito.SelectedValue.ToEntero, AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False)) Then + If ObjCredito.UpdateCreditos(CveCredito, TipoCreditoTemp, TxtCSReferencia.Text, TxtCSObservaciones.Text, DdlCuentaCredito.SelectedValue.ToEntero, HdnCveCompra.Value.ToEntero, -1, DdlCSTipoMoneda.SelectedValue.ToEntero, TxtCSFechaInicio.Text.Trim.ToDate, + TxtCSFechaVencimiento.Text.Trim.ToDate, TxtCSTasa.Text.Trim.ToDouble, TxtCSSobreTasa.Text.Trim.ToDouble, -1, TxtCSPlazo.Text.ToEntero, CveIE, If(TipoCreditoTemp = 2, TxtCSTotalCredito.Text.ToEntero, TotalCompra), + -1, -1, -1, -1, RBLClasificacionContable.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=DdlTarjetaCredito.SelectedValue.ToEntero, + AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False)) Then If Not ObjCredito.UpdateCreditosDetalle(ObjCredito.CveCredito, TxtCSFechaVencimiento.Text.ToDate, If(TipoCreditoTemp = 2, TxtCSTotalCredito.Text.ToString.ToEntero, TotalCompra), 0.0, 0.0, 0.0, 0.0, 0.0, If(TipoCreditoTemp = 1, 101, 1)) Then ErrorCredito = True End If diff --git a/CGame/CatHuerta.aspx b/CGame/CatHuerta.aspx index 3ee892959..0ad2b82df 100644 --- a/CGame/CatHuerta.aspx +++ b/CGame/CatHuerta.aspx @@ -69,7 +69,7 @@
+ DataKeyNames="CveHuerta,Huerta,CveOrigen,NombreRegistro,NumeroRegistro,CveProveedor,RazonSocial,FechaIng,Estatus,CveUsuario,Usuario,CveEmpresa,Empresa,TipoCobro,Importe,CostoXTonelada" OnRowDataBound="GvHuerta_RowDataBound"> @@ -149,10 +149,10 @@
-
+
- +
diff --git a/CGame/CatHuerta.aspx.cs b/CGame/CatHuerta.aspx.cs index b7ac258f2..4041dd853 100644 --- a/CGame/CatHuerta.aspx.cs +++ b/CGame/CatHuerta.aspx.cs @@ -2,8 +2,14 @@ { GVHuerta.DataSource = ObjHuer.DtResultados; GVHuerta.DataBind(); - } ObjHuer.Dispose(); upDatosHuer.Update(); } protected void CargaProveedor() { - ClsCompProveedores ObjProv = new ClsCompProveedores(); if (ObjProv.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa)) + } ObjHuer.Dispose(); upDatosHuer.Update(); } protected void CargaProveedor() { + using (ClsCGame ogame =new ClsCGame()) + { + ogame.GetOrigen(UsuarioActual.CveEmpresa, -1); + ddlOrigen.DataSource = ogame.DtResultados; + ddlOrigen.DataBind(); + } + ClsCompProveedores ObjProv = new ClsCompProveedores(); if (ObjProv.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa)) { DdlProveedor.DataSource = ObjProv.DtResultados; DdlProveedor.Items.Insert(0, new ListItem("Seleccione", "-1")); @@ -16,7 +22,8 @@ if (DdlProveedor.Items.Count > 2) { DdlProveedor.SelectedIndex = 2; - } DdlTipoCobro.SelectedIndex = 0; UPModalHuer.Update(); } protected void LnkEditarHuer_Click(object sender, EventArgs e) { LimpiaHuerta(); GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); CveHuerta = gvRow.DataKey("CveHuerta").ToEntero(); TxtHuerhuerta.Text = gvRow.DataKey("Huerta"); TxtImporte.Text = gvRow.DataKey("Importe"); TxtCostoXTonelada.Text = gvRow.DataKey("CostoXTonelada"); DdlProveedor.SelectedValueExist(gvRow.DataKey("CveProveedor").ToEntero()); DdlTipoCobro.SelectedValueExist(gvRow.DataKey("TipoCobro").ToEntero()); ChkHuerestatus.Checked= Convert.ToBoolean(gvRow.DataKey("Estatus")); RegistraScript("$('#DModalHuerta').modal();"); BtnHuerADD.Visible=false; BtnHuerEdit.Visible=true; DivEstatus.Visible = true; UPModalHuer.Update(); } protected void LnkAgregarHuer_Click(object sender, EventArgs e) { RegistraScript("$('#DModalHuerta').modal();"); LimpiaHuerta(); BtnHuerADD.Visible=true; BtnHuerEdit.Visible=false; DivEstatus.Visible = false; UPModalHuer.Update(); } protected void BtnHuerADD_Click(object sender, EventArgs e) { if (DdlProveedor.SelectedValue=="-1") + } DdlTipoCobro.SelectedIndex = 0; UPModalHuer.Update(); } protected void LnkEditarHuer_Click(object sender, EventArgs e) { LimpiaHuerta(); GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); CveHuerta = gvRow.DataKey("CveHuerta").ToEntero(); TxtHuerhuerta.Text = gvRow.DataKey("Huerta"); TxtImporte.Text = gvRow.DataKey("Importe"); TxtCostoXTonelada.Text = gvRow.DataKey("CostoXTonelada"); TxtNombreRegistro.Text = gvRow.DataKey("NombreRegistro"); + TxtNumeroRegistro.Text = gvRow.DataKey("NumeroRegistro"); DdlProveedor.SelectedValueExist(gvRow.DataKey("CveProveedor").ToEntero()); DdlTipoCobro.SelectedValueExist(gvRow.DataKey("TipoCobro").ToEntero()); ChkHuerestatus.Checked= Convert.ToBoolean(gvRow.DataKey("Estatus")); RegistraScript("$('#DModalHuerta').modal();"); BtnHuerADD.Visible=false; BtnHuerEdit.Visible=true; DivEstatus.Visible = true; UPModalHuer.Update(); } protected void LnkAgregarHuer_Click(object sender, EventArgs e) { RegistraScript("$('#DModalHuerta').modal();"); LimpiaHuerta(); BtnHuerADD.Visible=true; BtnHuerEdit.Visible=false; DivEstatus.Visible = false; UPModalHuer.Update(); } protected void BtnHuerADD_Click(object sender, EventArgs e) { if (DdlProveedor.SelectedValue=="-1") { Alert("Tiene que seleccionar un proveedor."); return; diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 074431106..c20eb252e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6331,7 +6331,7 @@ Partial Class Compras_Compras funcionalidad = 317 ConceptoContable = 243 ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then - funcionalidad = 349 + funcionalidad = 348 ConceptoContable = 327 End If importeMovimiento = CompraActual.RetISR @@ -8557,40 +8557,45 @@ Partial Class Compras_Compras Dim CveMovimientoActual As Integer = diRow("CveMovimiento").ToString.ToEntero - Dim DTMovimientoActual As DataTable = DTInventarios.FiltraParametros($"CveMovimiento = {CveMovimientoActual} ") - - Dim detalleDescripcion As String = "" - Dim Description As String = "" - - Dim FolioMovimiento As String = "" - Dim ConceptoMovimiento As String = "" - - For Each dRowMovActual As DataRow In DTMovimientoActual.Rows - - If dRowMovActual("UM").ToString = "" Then - FolioMovimiento = dRowMovActual("Folio").ToString - ConceptoMovimiento = dRowMovActual("Concepto").ToString - - Description = String.Format("Eliminación Compra {6},Movimiento con Concepto: {0}, Almacen: {1}, Fecha: {2}, Folio: {3}, Usuario: {4}, Observaciones adicionales: {5}, Productos Información:
", - ConceptoMovimiento, - dRowMovActual("Almacen").ToString, - dRowMovActual("FechaMovto").ToString.ToDate.ToString("dd/MM/yyyy"), - FolioMovimiento, - dRowMovActual("Usuario").ToString, - dRowMovActual("Observaciones").ToString, - $"{TxtSerie.Text}-{TxtFolio.Text}") - Else - detalleDescripcion = String.Format("- Cant: {0}, PS: {1}, PU: {2}, UM: {3}
", dRowMovActual("Cantidad").ToString.ToEntero, dRowMovActual("CodigoPS"), dRowMovActual("PU"), dRowMovActual("UM")) - End If - - Next - - If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, - String.Format("{0}, Informacion = {1}", Description, detalleDescripcion), - "Inventarios", FolioMovimiento + " / " + ConceptoMovimiento) Then + If Not ObjInventarios.MovimientoRemove(CveMovimientoActual, UsuarioActual.CveEmpresa, CveUsuario:=UsuarioActual.CveUsuario) Then ErrorCompra = True Exit For End If + + 'Dim DTMovimientoActual As DataTable = DTInventarios.FiltraParametros($"CveMovimiento = {CveMovimientoActual} ") + + 'Dim detalleDescripcion As String = "" + 'Dim Description As String = "" + + 'Dim FolioMovimiento As String = "" + 'Dim ConceptoMovimiento As String = "" + + 'For Each dRowMovActual As DataRow In DTMovimientoActual.Rows + + ' If dRowMovActual("UM").ToString = "" Then + ' FolioMovimiento = dRowMovActual("Folio").ToString + ' ConceptoMovimiento = dRowMovActual("Concepto").ToString + + ' Description = String.Format("Eliminación Compra {6},Movimiento con Concepto: {0}, Almacen: {1}, Fecha: {2}, Folio: {3}, Usuario: {4}, Observaciones adicionales: {5}, Productos Información:
", + ' ConceptoMovimiento, + ' dRowMovActual("Almacen").ToString, + ' dRowMovActual("FechaMovto").ToString.ToDate.ToString("dd/MM/yyyy"), + ' FolioMovimiento, + ' dRowMovActual("Usuario").ToString, + ' dRowMovActual("Observaciones").ToString, + ' $"{TxtSerie.Text}-{TxtFolio.Text}") + ' Else + ' detalleDescripcion = String.Format("- Cant: {0}, PS: {1}, PU: {2}, UM: {3}
", dRowMovActual("Cantidad").ToString.ToEntero, dRowMovActual("CodigoPS"), dRowMovActual("PU"), dRowMovActual("UM")) + ' End If + + 'Next + + 'If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, + ' String.Format("{0}, Informacion = {1}", Description, detalleDescripcion), + ' "Inventarios", FolioMovimiento + " / " + ConceptoMovimiento) Then + ' ErrorCompra = True + ' Exit For + 'End If Next End If @@ -8655,246 +8660,255 @@ Partial Class Compras_Compras ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL) End If + Try - Dim Contador As Integer = 0 - Dim Importe As Double = 0 - Dim ErrorMovtosCxP As Integer = 0 - Dim Fecha As Date + Dim Contador As Integer = 0 + Dim Importe As Double = 0 + Dim ErrorMovtosCxP As Integer = 0 + Dim Fecha As Date - If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then - For Each gvr As GridViewRow In GVAnticipos.Rows - If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then - Contador += 1 - 'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor - Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble - If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False - End If - Next - Else - Contador = 1 - End If - - 'If TxtFecha.Text.ToDate > Fecha Then Fecha = TxtFecha.Text.ToDate - Fecha = TxtFechaEjecucion.Text.ToDate - - 'Contador = 0 - If Contador > 0 Then If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then - If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then - Alert("El Importe seleccionado excede al importe de la compra", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + For Each gvr As GridViewRow In GVAnticipos.Rows + If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then + Contador += 1 + 'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor + Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble + If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False + End If + Next + Else + Contador = 1 End If - ArrAnticipos.Clear() + 'If TxtFecha.Text.ToDate > Fecha Then Fecha = TxtFecha.Text.ToDate + Fecha = TxtFechaEjecucion.Text.ToDate - If CveCompra > 0 Then - - Dim ObjContaAC As ClsContPAQi = Nothing - - 'INICIALIZA OBJETOS - If Not (ObjComprasParametro IsNot Nothing And ObjContaParametro IsNot Nothing) Then - ObjCompra = New ClsCompras - ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL) + 'Contador = 0 + If Contador > 0 Then + If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then + If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then + Alert("El Importe seleccionado excede al importe de la compra", TipoMensaje.MsgAdvertencia) + Exit Sub + End If End If - Dim CveCompraNC, IdCtaContable, IdCtaContableComp As Integer - Dim ConceptoPoliza As String = $"Amortización {NombreProveedor} - {TxtSerie.Text}-{TxtFolio.Text}" + ArrAnticipos.Clear() - Try - Dim CveIE As Integer = -1 + If CveCompra > 0 Then - Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal - Dim CompraActual As New Compra - CompraActual.CveCompra = CveCompra - CompraActual.CveTipoConceptoProveedor = CveTipoConcepto - CompraActual.CveProveedor = CveProveedor - CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero - CompraActual.Fecha = TxtFecha.Text.ToDate - CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim - CompraActual.ProveedorNombre = HplProveedor.Text - CompraActual.TC = TipoCambio - CompraActual.Total = TxtTotal.Text.ToDecimal - CompraActual.IVA = TxtIVA.Text.ToDecimal - CompraActual.IVADeducible = TxtIVA.Text.ToDecimal - CompraActual.IEPS = TxtIEPS.Text.ToDecimal - CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal - CompraActual.RetISR = TxtRetISR.Text.ToDecimal - CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero - CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero - CompraActual.PorcentajeIVA = PorcentajeIVA - CompraActual.UsuarioActual = UsuarioActual - CompraActual.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero - CompraActual.IdCtaContableProv = CtaProveedor - CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria - CompraActual.EsImportacion = chkImportacion.Checked + Dim ObjContaAC As ClsContPAQi = Nothing - Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + 'INICIALIZA OBJETOS + If Not (ObjComprasParametro IsNot Nothing And ObjContaParametro IsNot Nothing) Then + ObjCompra = New ClsCompras + ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL) + End If + + Dim CveCompraNC, IdCtaContable, IdCtaContableComp As Integer + Dim ConceptoPoliza As String = $"Amortización {NombreProveedor} - {TxtSerie.Text}-{TxtFolio.Text}" + + Try + Dim CveIE As Integer = -1 + + Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal + Dim CompraActual As New Compra + CompraActual.CveCompra = CveCompra + CompraActual.CveTipoConceptoProveedor = CveTipoConcepto + CompraActual.CveProveedor = CveProveedor + CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero + CompraActual.Fecha = TxtFecha.Text.ToDate + CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim + CompraActual.ProveedorNombre = HplProveedor.Text + CompraActual.TC = TipoCambio + CompraActual.Total = TxtTotal.Text.ToDecimal + CompraActual.IVA = TxtIVA.Text.ToDecimal + CompraActual.IVADeducible = TxtIVA.Text.ToDecimal + CompraActual.IEPS = TxtIEPS.Text.ToDecimal + CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal + CompraActual.RetISR = TxtRetISR.Text.ToDecimal + CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero + CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero + CompraActual.PorcentajeIVA = PorcentajeIVA + CompraActual.UsuarioActual = UsuarioActual + CompraActual.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero + CompraActual.IdCtaContableProv = CtaProveedor + CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria + CompraActual.EsImportacion = chkImportacion.Checked + + Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + For Each gvr As GridViewRow In GVAnticipos.Rows + If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then + + CveCompraNC = gvr.DataKey("CveCompra").ToEntero + If CvePrePoliza > 0 Then + + Dim CveConceptoCompra As Integer = 60 + Dim CveConceptoCompraComplementaria As Integer = 266 + Dim TipoMovimientoCompra As Boolean = True + Dim CveMonedaAnticipo As Integer = gvr.DataKey("CveMoneda").ToEntero + Dim TipoCambioAnt As Decimal = gvr.DataKey("TCCompra").ToDecimal + Dim ImporteAnt As Decimal = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal + Dim ImporComisionAnticipo As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal + + Dim Pago As New CompraPago + Pago.TipoPago = gvr.DataKey("TipoDocto") + Pago.ImportePago = ImporteAnt + Pago.OtroGastoIngreso = ImporComisionAnticipo + Pago.CveMonedaPago = CveMonedaAnticipo + Pago.TCPago = TipoCambioAnt + Pago.CveProveedor = gvr.DataKey("CveProveedor").ToEntero + + Select Case gvr.DataKey("TipoDocto") + Case "NC", "DEV" + CveConceptoCompra = If(CveMonedaAnticipo = 1, 60, 60) + CveConceptoCompraComplementaria = 235 + IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedor, CtaProveedorExtranjera) + IdCtaContableComp = CtaProveedorComplementaria + CveIE = -1 + Pago.AplicaAcreditable = False + Case "Egsc" + CveConceptoCompra = If(CveMonedaAnticipo = 1, 21, 21) + CveConceptoCompraComplementaria = 266 + IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedorAnticipos, CtaProveedorAnticiposExtranjera) + IdCtaContableComp = CtaProveedorAnticiposComplementaria + + 'vinculo la compra actual, y no la compra como si fuera nota de credito + CveCompraNC = -1 + CveIE = gvr.DataKey("CveIE").ToEntero + CompraActual.IdCtaContableAnticipoProv = IdCtaContable + Case "DD" + CveConceptoCompra = If(CveMonedaAnticipo = 1, 37, 37) + IdCtaContable = CtaProveedorDeudores + 'vinculo la compra actual, y no la compra como si fuera nota de credito + CveCompraNC = -1 + CveIE = gvr.DataKey("CveIE").ToEntero + End Select + + 'PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal + + Pago.CveIE = CveIE + Pago.CveCompraAmortizacion = CveCompraNC + + If AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaNueva, ObjConta) Then + ErrorMovtosCxP = 1 + End If + End If + End If + + Next + + If ErrorMovtosCxP = 0 And CvePrePolizaNueva > 0 Then + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC Is Nothing Then + ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjContaAC.IniciaTransacSQL() + End If + + If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa, MinFecha, "", ObjContaAC) Then + ErrorMovtosCxP = 3 + End If + + End If + + End If + + Select Case ErrorMovtosCxP + Case 0 + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC IsNot Nothing Then + ObjContaAC.Commit() + End If + End If + + Alert("El movimiento se aplicó correctamente.", TipoMensaje.MsgInformacion) + ObjCompra.Commit() + + Dim dtnc As DataTable = Nothing + If ObjCompra.GetComprasNotasCredito(CveCompra, -1) Then + dtnc = ObjCompra.DtResultados + End If + + GvAnticiposSel.DataSource = dtnc + GvAnticiposSel.DataBind() + + LblAmortizacion.Text = (LblAmortizacion.Text.ToDouble + Importe).FormatoNumero + CompraSaldo = CompraSaldo - Importe + HdnCompraSaldo.Value = CompraSaldo.ToString + + If CompraSaldo > 0 Then CargaAnticipos(CveProveedor) + If CveCompra > 0 Then VisualizaEstatusCompraSaldo(DdlTipoComprobante.SelectedValue, CompraSaldo.ToDecimal, TxtTotal.Text.ToDecimal) + + UpAnticipos.Update() + UpPS.Update() + dtnc.Dispose() + + Case 1 + Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) + ObjCompra.RollBack() + Case 2 + Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) + ObjCompra.RollBack() + Case 3 + Alert("Ocurrió un error al contabilizar la la amortizacion del anticipo.", TipoMensaje.MsgAdvertencia) + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC IsNot Nothing Then + Try + ObjContaAC.RollBack() + Catch ex As Exception + + End Try + End If + End If + + ObjCompra.RollBack() + End Select + + Catch ex As Exception + ObjCompra.RollBack() + End Try + + + If ObjContaAC IsNot Nothing Then + ObjContaAC.Dispose() + End If + + ObjCompra.Dispose() + + Else + 'sino se ha guardado la compra, se registra temporal que anticpos van a cargarle For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then - - CveCompraNC = gvr.DataKey("CveCompra").ToEntero - If CvePrePoliza > 0 Then - - Dim CveConceptoCompra As Integer = 60 - Dim CveConceptoCompraComplementaria As Integer = 266 - Dim TipoMovimientoCompra As Boolean = True - Dim CveMonedaAnticipo As Integer = gvr.DataKey("CveMoneda").ToEntero - Dim TipoCambioAnt As Decimal = gvr.DataKey("TCCompra").ToDecimal - Dim ImporteAnt As Decimal = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal - Dim ImporComisionAnticipo As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal - - Dim Pago As New CompraPago - Pago.TipoPago = gvr.DataKey("TipoDocto") - Pago.ImportePago = ImporteAnt - Pago.OtroGastoIngreso = ImporComisionAnticipo - Pago.CveMonedaPago = CveMonedaAnticipo - Pago.TCPago = TipoCambioAnt - Pago.CveProveedor = gvr.DataKey("CveProveedor").ToEntero - - Select Case gvr.DataKey("TipoDocto") - Case "NC", "DEV" - CveConceptoCompra = If(CveMonedaAnticipo = 1, 60, 60) - CveConceptoCompraComplementaria = 235 - IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedor, CtaProveedorExtranjera) - IdCtaContableComp = CtaProveedorComplementaria - CveIE = -1 - Pago.AplicaAcreditable = False - Case "Egsc" - CveConceptoCompra = If(CveMonedaAnticipo = 1, 21, 21) - CveConceptoCompraComplementaria = 266 - IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedorAnticipos, CtaProveedorAnticiposExtranjera) - IdCtaContableComp = CtaProveedorAnticiposComplementaria - - 'vinculo la compra actual, y no la compra como si fuera nota de credito - CveCompraNC = -1 - CveIE = gvr.DataKey("CveIE").ToEntero - CompraActual.IdCtaContableAnticipoProv = IdCtaContable - Case "DD" - CveConceptoCompra = If(CveMonedaAnticipo = 1, 37, 37) - IdCtaContable = CtaProveedorDeudores - 'vinculo la compra actual, y no la compra como si fuera nota de credito - CveCompraNC = -1 - CveIE = gvr.DataKey("CveIE").ToEntero - End Select - - 'PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal - - Pago.CveIE = CveIE - Pago.CveCompraAmortizacion = CveCompraNC - AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaNueva, ObjConta) - End If + ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")}) End If - Next - If ErrorMovtosCxP = 0 And CvePrePolizaNueva > 0 Then - - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then - If ObjContaAC Is Nothing Then - ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjContaAC.IniciaTransacSQL() - End If - - If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa, MinFecha, "", ObjContaAC) Then - ErrorMovtosCxP = 3 - End If - - End If - + Dim ImporteAnticipo As Decimal = 0 + If ArrAnticipos.Count > 0 Then + For Each Ant As Compras_Compras.Anticipos In ArrAnticipos + ImporteAnticipo += Ant.Importe + Next End If - Select Case ErrorMovtosCxP - Case 0 - - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then - If ObjContaAC IsNot Nothing Then - ObjContaAC.Commit() - End If - End If - - Alert("El movimiento se aplicó correctamente.", TipoMensaje.MsgInformacion) - ObjCompra.Commit() - - Dim dtnc As DataTable = Nothing - If ObjCompra.GetComprasNotasCredito(CveCompra, -1) Then - dtnc = ObjCompra.DtResultados - End If - - GvAnticiposSel.DataSource = dtnc - GvAnticiposSel.DataBind() - - LblAmortizacion.Text = (LblAmortizacion.Text.ToDouble + Importe).FormatoNumero - CompraSaldo = CompraSaldo - Importe - HdnCompraSaldo.Value = CompraSaldo.ToString - - If CompraSaldo > 0 Then CargaAnticipos(CveProveedor) - If CveCompra > 0 Then VisualizaEstatusCompraSaldo(DdlTipoComprobante.SelectedValue, CompraSaldo.ToDecimal, TxtTotal.Text.ToDecimal) - - UpAnticipos.Update() - UpPS.Update() - dtnc.Dispose() - - Case 1 - Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) - ObjCompra.RollBack() - Case 2 - Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) - ObjCompra.RollBack() - Case 3 - Alert("Ocurrió un error al contabilizar la la amortizacion del anticipo.", TipoMensaje.MsgAdvertencia) - - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then - If ObjContaAC IsNot Nothing Then - Try - ObjContaAC.RollBack() - Catch ex As Exception - - End Try - End If - End If - - ObjCompra.RollBack() - End Select - - Catch ex As Exception - ObjCompra.RollBack() - End Try - - - If ObjContaAC IsNot Nothing Then - ObjContaAC.Dispose() + LblAmortizacion.Text = ImporteAnticipo.FormatoNumero + LblAplicadoCompraAnt.Text = ImporteAnticipo.FormatoNumero + LblSaldoFactura.Text = (TxtTotal.Text.ToDecimal - ImporteAnticipo).ToString.FormatoNumero + UpPS.Update() End If - - ObjCompra.Dispose() - + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos")) Else - 'sino se ha guardado la compra, se registra temporal que anticpos van a cargarle - - For Each gvr As GridViewRow In GVAnticipos.Rows - If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then - ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")}) - End If - Next - - Dim ImporteAnticipo As Decimal = 0 - If ArrAnticipos.Count > 0 Then - For Each Ant As Compras_Compras.Anticipos In ArrAnticipos - ImporteAnticipo += Ant.Importe - Next - End If - - LblAmortizacion.Text = ImporteAnticipo.FormatoNumero - LblAplicadoCompraAnt.Text = ImporteAnticipo.FormatoNumero - LblSaldoFactura.Text = (TxtTotal.Text.ToDecimal - ImporteAnticipo).ToString.FormatoNumero - UpPS.Update() + Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia) End If - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos")) - Else - Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia) - End If - UPPAnticiposSel.Update() + UPPAnticiposSel.Update() + + Catch ex As Exception + ObjCompra.RollBack() + ObjCompra.Dispose() + End Try End Sub diff --git a/Compras/ReembolsosComprobaciones.aspx b/Compras/ReembolsosComprobaciones.aspx index 6b1e0781a..188dfb37c 100644 --- a/Compras/ReembolsosComprobaciones.aspx +++ b/Compras/ReembolsosComprobaciones.aspx @@ -162,99 +162,124 @@
-
-
-
- -
- - - - - -
-
-
- -
- - - - -
-
- -
-
-
-
-
-
- -
-
- - - - + +
+ +
+ +
+
+
+ +
+ + + + + +
- - - - - - - - +
+ +
+ + + + +
+
+ +
+
+
+
+
+
+ +
+
+ + + + +
+ + + + + + + + -
-
-
- -
- - - -
-
- -
- $ - - -
-
-
- -
- -
-
-
- -
- - -
+
+
+
+ +
+ + + +
+
+ +
+ $ + + +
+
+
+ +
+ +
+
+
+ +
+ + +
-
- $ - - - - -
-
-
- -
- +
+ $ + + + + +
+
+
+ +
+ +
+
+
+
+ + + +
+ +
+
+
+ +
+ +
+ + + + diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index af22a88cd..b28b694c0 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -521,6 +521,17 @@ Partial Class Compras_ReembolsosComprobaciones Next + Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + + Dim filemove As String = "" + Dim Comprobante As String = "" + Dim ComprobanteIE = "" + + For Each fileItem As Archivo In filesgral + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.filename + Next + If HdnCheque.Value.ToEntero > 0 AndAlso Not ChkReembolsarSinBancos.Checked Then CveIERegistrado = DDlCheques.SelectedValue.ToEntero @@ -569,14 +580,31 @@ Partial Class Compras_ReembolsosComprobaciones If ChkChequeExcedente.Checked Then CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones3", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) + CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then MsgError = "Error al registrar detalle de concepto bancario" End If + + If CveIEExcedente > 0 Then + If filemove <> "" Then + filemove.FilesMove(CveIEExcedente.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + Anexo.Text = "" + End If + End If + + + End If ElseIf Not ChkReembolsarSinBancos.Checked Then CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones4", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - CveIERegistrado = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) + CveIERegistrado = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaIERegistrado, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) + + If CveIERegistrado > 0 Then + If filemove <> "" Then + filemove.FilesMove(CveIERegistrado.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + Anexo.Text = "" + End If + End If 'AGREGO PREPOLIZA IE BANCOS If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then diff --git a/Contabilidad/Reportes/RepBalanzaComprobacion.rdlc b/Contabilidad/Reportes/RepBalanzaComprobacion.rdlc index 897510c84..34009bc2a 100644 --- a/Contabilidad/Reportes/RepBalanzaComprobacion.rdlc +++ b/Contabilidad/Reportes/RepBalanzaComprobacion.rdlc @@ -1,1533 +1,5 @@ - - - - - - - true - true - - - - - =Parameters!pEmp.Value - - - - - - - Textbox1 - 0.98806cm - 20.2388cm - - - 2pt - 2pt - 2pt - 2pt - - - - External - = Parameters!pImg.Value - Fit - 1.98547cm - 3.43894cm - 1 - - - - - - true - true - - - - - Balanza de Comprobación del - - - - =Parameters!pFechaIni.Value - - - - al - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 0.98806cm - 0.99741cm - 20.2388cm - 2 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - 3.43894cm - - - 6.04544cm - - - 2.87929cm - - - 2.5cm - - - 2.5cm - - - 2.87513cm - - - - - 0.6cm - - - - - true - true - - - - - - - - - - - - Textbox2 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox4 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Saldos Iniciales - - - - - - - Textbox7 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox9 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox10 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Saldos Actuales - - - - - - - Textbox11 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - Cuenta - - - - - - - Textbox13 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Nombre - - - - - - - Textbox15 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Deudor Acreedor - - - - - - - Textbox17 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Cargos - - - - - - - Textbox21 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Abonos - - - - - - - Textbox23 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Deudor Acreedor - - - - - - - Textbox25 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.45cm - - - - - true - true - - - - - =Fields!Codigo.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - Horizontal - - - - - - - - true - true - - - - - =Fields!SaldoInicial.Value - - - - - - - SaldoInicial - - - 2pt - =Iif(Fields!CveTipo.Value=1,"17pt","2pt") - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Cargos.Value - - - - - - - Cargos1 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Abonos.Value - - - - - - - Abonos - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!SaldoActual.Value - - - - - - - SaldoActual - - - 2pt - =Iif(Fields!CveTipo.Value=1,"17pt","2pt") - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Sumas Iguales - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!SaldoID.Value) - - - - - - - SaldoID - - - 2pt - 17pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!TotalAbonos.Value) - - - - - - - TotalAbonos - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!TotalCargos.Value) - - - - - - - TotalCargos - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!SaldoAD.Value) - - - - - - - SaldoAD - - - 2pt - 17pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!SaldoIA.Value) - - - - - - - SaldoIA - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox33 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox34 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Last(Fields!SaldoAA.Value) - - - - - - - SaldoAA - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - - - - After - true - - - After - true - - - - - - Before - - - Before - - - - true - DataSet1 - 2.04159cm - 2.85cm - 20.2388cm - 3 - - - - - - true - 5.50443cm - 20.2388cm - - - - - - 2.1671in - - - - =Parameters!pFechaIni.Value - - - - al - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 0.6cm - 20.2388cm - - = (Globals.PageNumber=1) - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - 0.6cm - true - true - - - true - true - - - - - ="Página " & Globals.PageNumber & " de " & Globals.TotalPages - - - - - - - Textbox3 - 0cm - 14.86367cm - 0.6cm - 5.37513cm - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ="Fecha Impresión:" & vbCrLf & DateTime.Now.ToString("dd/MM/yyyy HH:mmm") - - - - - - - Textbox8 - 0cm - 0.6cm - 3.43894cm - 1 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ="Usuario Imprimio: " & Parameters!UsuarioImprimio.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 29.7cm - 21cm - 0.25cm - 0.25cm - 0.5cm - 1cm - 0.13cm - + + + + + + Textbox1 + 0.98806cm + 20.2388cm + + + 2pt + 2pt + 2pt + 2pt + + + + External + = Parameters!pImg.Value + Fit + 1.98547cm + 3.43894cm + 1 + + + + + + true + true + + + + + Balanza de Comprobación del + + + + =Parameters!pFechaIni.Value + + + + al + + + + =Parameters!pFechaFin.Value + + + + + + + Textbox5 + 0.98806cm + 0.99741cm + 20.2388cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 3.43894cm + + + 6.04544cm + + + 2.87929cm + + + 2.5cm + + + 2.5cm + + + 2.87513cm + + + + + 0.6cm + + + + + true + true + + + + + + + + + + + + Textbox2 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox4 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldos Iniciales + + + + + + + Textbox7 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox9 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox10 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldos Actuales + + + + + + + Textbox11 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + Cuenta + + + + + + + Textbox13 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Nombre + + + + + + + Textbox15 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Deudor Acreedor + + + + + + + Textbox17 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Cargos + + + + + + + Textbox21 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Abonos + + + + + + + Textbox23 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Deudor Acreedor + + + + + + + Textbox25 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.45cm + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + =Fields!Nombre.Value + + + + + + 2pt + 2pt + 2pt + 2pt + Horizontal + + + + + + + + true + true + + + + + =Fields!SaldoInicial.Value + + + + + + + SaldoInicial + + + 2pt + =Iif(Fields!CveTipo.Value=1,"17pt","2pt") + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Cargos.Value + + + + + + + Cargos1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Abonos.Value + + + + + + + Abonos + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SaldoActual.Value + + + + + + + SaldoActual + + + 2pt + =Iif(Fields!CveTipo.Value=1,"17pt","2pt") + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Sumas Iguales + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!SaldoID.Value) + + + + + + + SaldoID + + + 2pt + 17pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!TotalAbonos.Value) + + + + + + + TotalAbonos + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!TotalCargos.Value) + + + + + + + TotalCargos + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!SaldoAD.Value) + + + + + + + SaldoAD + + + 2pt + 17pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!SaldoIA.Value) + + + + + + + SaldoIA + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox33 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox34 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Last(Fields!SaldoAA.Value) + + + + + + + SaldoAA + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + After + true + + + After + true + + + + + + Before + + + Before + + + + true + DataSet1 + 2.04159cm + 2.85cm + 20.2388cm + 3 + + + + + + true + 5.50443cm + 20.2388cm + + + + + + 2.1671in + + + + =Parameters!pFechaIni.Value + + + + al + + + + =Parameters!pFechaFin.Value + + + + + + + Textbox5 + 0.6cm + 20.2388cm + + = (Globals.PageNumber=1) + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + 0.6cm + true + true + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox3 + 14.86367cm + 0.6cm + 5.37513cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Fecha Impresión:" & vbCrLf & DateTime.Now.ToString("dd/MM/yyyy HH:mmm") + + + + + + + Textbox8 + 0.6cm + 3.43894cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Usuario Imprimio: " & Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 29.7cm + 21cm + 0.25cm + 0.25cm + 0.5cm + 1cm + 0.13cm +