From 35c2908b7a967520421a92f013eed51244d504f9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 11 Jan 2023 18:45:48 -0700 Subject: [PATCH 1/6] BDH. Calculo de importes desde codigo, separacion de conceptos de acreditamiento por cargo y bonificacion --- App_Code/ClsAcumuladores.vb | 13 +- App_Code/Modelos.vb | 72 +++++++-- Inventarios/RecepcionUsados.aspx.vb | 18 ++- Ventas/Ventas.aspx.vb | 229 ++++++++++++++++++---------- 4 files changed, 227 insertions(+), 105 deletions(-) diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 0ad493781..1fbcf36dd 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -925,10 +925,10 @@ Public Class ClsAcumuladores OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function #End Region - - Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, + + Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, Puntos As Decimal, ImporteCargo As Decimal, ImporteBonificacion As Decimal, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1, Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean Dim Retorno As Boolean = False @@ -940,6 +940,9 @@ Public Class ClsAcumuladores .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad .Add("@CveTamaño", SqlDbType.Int).Value = CveTamaño + .Add("@Puntos", SqlDbType.Money).Value = Puntos + .Add("@ImporteCargo", SqlDbType.Money).Value = ImporteCargo + .Add("@ImporteBonificacion", SqlDbType.Money).Value = ImporteBonificacion .Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto .Add("@CveVenta", SqlDbType.Int).Value = CveVenta .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario @@ -961,7 +964,8 @@ Public Class ClsAcumuladores Return Retorno End Function - Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1, Optional CveConcepto As Integer = -1) As Boolean + Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, + Optional CveVentaRNCCargo As Integer = -1, Optional CveVentaRNCBonificacion As Integer = -1, Optional CveConcepto As Integer = -1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -973,6 +977,7 @@ Public Class ClsAcumuladores .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo + .Add("@CveVentaRNCBonificacion", SqlDbType.Int).Value = CveVentaRNCBonificacion .Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto End With diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index ec9cc547c..17861b78e 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2102,12 +2102,17 @@ Namespace Modelos CveConcepto = 6 End Select 'SI ES FACTURA,NC,DEV O ES RNC DE CARGO, CANCELAR MOVIMIENTOS - If factura.TipoDocto.Contiene("Ing", "Dev", "Egs") OrElse factura.TipoDocto.Contiene("RNC") AndAlso factura.Num1 = 1 Then + If factura.TipoDocto.Contiene("Ing", "Dev", "Egs") OrElse (factura.TipoDocto.Contiene("RNC") AndAlso factura.Num1 = 1) Then + If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then For Each RowSalida As DataRow In DtMovimientos.Rows Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1 + Dim Puntos As Decimal = RowSalida("Puntos").ToString().ToDecimal() + + Dim ImporteCargo As Decimal = RowSalida("ImporteCargo").ToString().ToDecimal() + Dim ImporteBonificacion As Decimal = RowSalida("ImporteBonificacion").ToString().ToDecimal() Dim FacturadoBonificacion = False Dim CveVentaBonificacion As Integer = -1 @@ -2117,15 +2122,15 @@ Namespace Modelos FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString()) End If - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha, CveVentaBonificacion:=CveVentaBonificacion, FacturadoBonificacion:=FacturadoBonificacion) Then + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, Puntos, ImporteCargo, ImporteBonificacion, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha, CveVentaBonificacion:=CveVentaBonificacion, FacturadoBonificacion:=FacturadoBonificacion) Then Retorno = False Exit For End If + Next DtMovimientos.Dispose() End If End If - Else End If @@ -2138,15 +2143,25 @@ Namespace Modelos If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then If factura.TipoDocto = "Ing" AndAlso factura.Cliente.EsDistribuidor Then - Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero For Each drow As DataRow In factura.DtDetalle.Rows - If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then + If drow("CveTamaño").ToString.ToEntero > 0 Then + Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={drow("CveTamaño").ToString.ToEntero}") + If DrTamanio IsNot Nothing Then + Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() + Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() + Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, 2, factura.CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then + Resultado = False + Exit For + End If + Else Resultado = False Exit For End If + End If Next @@ -2197,13 +2212,22 @@ Namespace Modelos If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then - ' Mensaje = "Error al guardar Movimientos de distribuidor" + Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={Dr("CveTamaño").ToString.ToEntero}") + If DrTamanio IsNot Nothing Then + Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then + ' Mensaje = "Error al guardar Movimientos de distribuidor" + Resultado = False + Exit For + End If + Else Resultado = False Exit For End If - End If End If @@ -4867,6 +4891,11 @@ Namespace Modelos AplicaRefacturacionConPagos = True End If + 'SI NO TIENE PAGOS, DEBE SEGUIR EL CAMINO DE REFACTURACION NORMAL + If AplicaRefacturacionConPagos AndAlso ObjFactura.Pagado = 0 Then + AplicaRefacturacionConPagos = False + End If + 'VALIDA QUE LA FACTURA NO TENGA PAGOS If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." @@ -5380,7 +5409,10 @@ Namespace Modelos DtSalidas = DtInventario.FiltraParametros($"CvePS IS NULL AND {Filtro}") If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then - DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 37 AND CveTipoAlmacen = 24") + DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 37") + If ObjFactura.TipoDocto = "Dev" Then + DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 36") + End If End If If ObjFactura.TipoDocto = "Ing" Then @@ -5593,7 +5625,7 @@ Namespace Modelos If DtVirtuales IsNot Nothing Then For Each RowVirtual As DataRow In DtVirtuales.Rows 'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL - If Not ErrorCancelar AndAlso Not CancelarMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then + If Not ErrorCancelar AndAlso Not CancelarMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario, TipoDocto:=ObjFactura.TipoDocto) Then ErrorCancelar = True MensajeError = "Ocurrió un error al realizar la devolución del virtual. Por favor vuelva a intentar." End If @@ -6130,7 +6162,7 @@ Namespace Modelos Return Not ErrorCancelar End Function - Private Function CancelarMovimientosVirtuales(CveVenta As Integer, CveMovimientoDevolucion As Integer, CveMovimientoVirtualSalida As Integer, ByRef ObjInventario As ClsInventarios) As Boolean + Private Function CancelarMovimientosVirtuales(CveVenta As Integer, CveMovimientoDevolucion As Integer, CveMovimientoVirtualSalida As Integer, ByRef ObjInventario As ClsInventarios, Optional TipoDocto As String = "") As Boolean Dim ErrorCancelar As Boolean = False Try If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then @@ -6163,6 +6195,10 @@ Namespace Modelos End If Dim CveConceptoMovimientoVirtual As Integer = 36 + If TipoDocto = "Dev" Then + CveConceptoMovimientoVirtual = 37 + End If + Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimientoDevolucion If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then @@ -7382,6 +7418,14 @@ Namespace Modelos #End Region #Region "G L O B A L - D T" + Property GlobalDTAcumTamaños() As DataTable + Get + GlobalDTAcumTamaños = DirectCast(HttpContext.Current.Application("GlobalDTAcumTamaños"), DataTable) + End Get + Set(value As DataTable) + HttpContext.Current.Application("GlobalDTAcumTamaños") = value + End Set + End Property Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double Get If GlobalTipoCambio <= 0 Then diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index a53cb52fe..5081269e9 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1318,13 +1318,19 @@ Partial Class Inventarios_RecepcionUsados If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, Now, CveMovimiento:=CveMovimiento) Then - Mensaje = "Error al guardar Movimientos de distribuidor" - ErrorMovInv = True - Exit For - End If + Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={Dr("CveTamaño").ToString.ToEntero}") + If DrTamanio IsNot Nothing Then + Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal() + If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, Now, CveMovimiento:=CveMovimiento) Then + Mensaje = "Error al guardar Movimientos de distribuidor" + ErrorMovInv = True + Exit For + End If + End If End If Next diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 7d8ca3e9e..8a0583f6d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4702,6 +4702,15 @@ Partial Class Ventas If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal + If DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Dev") AndAlso VentaSaldoAlmacen <> 0 Then + ChkDevAlm.Checked = True + LiDevolucionAlmacen.Visible = True + If DbRowVenta("TipoDocto").ToString() = "Dev" Then + LblDevAlm.Text = "Salida de almacen" + End If + End If + + If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False 'If CveEstatus = 20 Then ' LbCancelarDocumentoManual.Visible = True @@ -9471,6 +9480,7 @@ Partial Class Ventas Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL()) Dim ObjGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL()) + Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) Dim ObjContPaq As ClsContPAQi = Nothing 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) @@ -9541,7 +9551,7 @@ Partial Class Ventas Dim CveTimbreCartaPorte As Integer = -1 - GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, + GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre) If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then @@ -9668,7 +9678,7 @@ Partial Class Ventas If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento) - If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, + If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion) End If @@ -9681,7 +9691,7 @@ Partial Class Ventas End If CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento) - If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing, + If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing, Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion) End If @@ -9839,12 +9849,6 @@ Partial Class Ventas End If If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then - - - - - - ObjVentas.Commit() 'ENVIAR POLIZA VIRTUAL @@ -9854,7 +9858,6 @@ Partial Class Ventas End If End If - 'ContPAQ El movimiento 1 es el de Venta Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" @@ -9891,7 +9894,6 @@ Partial Class Ventas OnError("Ocurrió un error al contabilizar la factura", ex) End Try - Try 'RMF, cuando es pedido, se manda autorización. If ObjFactura.TipoDocto.Contiene("PA") Then @@ -10133,12 +10135,8 @@ Partial Class Ventas If ArchivoCotRdlc.Exists Or ArchivoCotMrt.Exists Then MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) - - If ChkEnviarFacturaCRM.Checked AndAlso CorreoContactoCRM.Trim.Length > 0 Then - Try - Dim pdfCRM As Byte() = Nothing 'If CveVenta > 0 Then ' ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False) @@ -10151,16 +10149,10 @@ Partial Class Ventas GeneraPDFCotizacion(True, CorreoContactoCRM:=CorreoContactoCRM, pdfCRM:=pdfCRM, SerieFolioCRM:=SerieFolioCRM, TipoDoctoCRM:=TipoDoctoCRM) End If - Catch ex As Exception OnError("Ocurrió un error al enviar el PDF", ex) End Try - End If - - - - Else MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") End If @@ -10178,9 +10170,6 @@ Partial Class Ventas End If End If - - - 'ERROR DE NO TIMBRADO If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then MensajeAlert.AppendFormat("La factura no se pudo timbrar. Por favor intentelo de nuevo a traves del boton Emitir.") @@ -10202,12 +10191,10 @@ Partial Class Ventas End Select - If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir") End If - 'DESCARGAR PDF DE CICOVISA 'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then ' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then @@ -10235,8 +10222,6 @@ Partial Class Ventas End If GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO - Else - 'Enviar pore correo cot CRM End If ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then If UsuarioActual.CveEmpresa.Contiene(81, 109) Then @@ -10311,7 +10296,6 @@ Partial Class Ventas Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False) End If - MensajeAlert.Clear() Try @@ -10324,7 +10308,6 @@ Partial Class Ventas OnError("Ocurrió un error al limpiar los datos", ex) End Try - Else ObjVentas.RollBack() If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() @@ -10343,6 +10326,7 @@ Partial Class Ventas ObjCGame.Dispose() ObjContr.Dispose() ObjDocCliente.Dispose() + ObjAcum.Dispose() 'ObjFolios.Dispose() ErrorList.Clear() ErrorList = Nothing @@ -10986,24 +10970,27 @@ Partial Class Ventas End Sub - Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, + Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjAcum As ClsAcumuladores, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean Dim ProcesoCorrecto As Boolean = True 'GENERAMOS EL NUEVO FOLIO - Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) + 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) - If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then - Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero())) - If DT.Rows.Count > 0 Then - factura.Serie = DT.Rows(0)("Serie").ToString() - factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() - Else - ProcesoCorrecto = False - End If - DT.Dispose() - End If + 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then + ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero())) + ' If DT.Rows.Count > 0 Then + ' factura.Serie = DT.Rows(0)("Serie").ToString() + ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() + ' Else + ' ProcesoCorrecto = False + ' End If + ' DT.Dispose() + 'End If + + factura.Serie = "-1" + factura.Folio = -1 If NCDescuento Then @@ -11019,7 +11006,7 @@ Partial Class Ventas factura.CveVentaPadre = Me.CveVenta 'Registramos la venta - GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento) + GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento) Else 'GENERO LOS DATOS DE LA NC @@ -11158,7 +11145,7 @@ Partial Class Ventas ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) 'Registramos la venta - GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True) + GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True) Else ErrorList.Add("No se encontró un producto para generar la nota de crédito") @@ -12916,7 +12903,7 @@ Partial Class Ventas #Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO " - Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, + Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjAcum As ClsAcumuladores, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional CveAnticipoPadre As Integer = -1) @@ -13128,11 +13115,11 @@ Partial Class Ventas 'SI ES REFACTURACION, NO DEBE AFECTAR LOS USADOS If Not NuevaFactura.Contiene(1) Then If ObjFactura.TipoDocto = "Ing" Then - If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then + If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then ErrorList.Add("Error al guardar usados") End If ElseIf ObjFactura.TipoDocto = "Dev" Then - If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura) Then + If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then ErrorList.Add("Error al guardar usados") End If End If @@ -13238,7 +13225,6 @@ Partial Class Ventas Dim ListaRNC As List(Of Modelos.Factura) = Nothing If NCDescuento Then - EsCargo = (Not ListaNCDescuento.Any(Function(RNC) RNC.Num2 = 1)) ListaRNC = ListaNCDescuento Else EsCargo = RblRNCTipo.SelectedValue = "1" @@ -13246,26 +13232,93 @@ Partial Class Ventas End If 'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO - If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo AndAlso Not factura.EsGarantia Then - Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) - + If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then Dim CvePSCargo As Integer = -1 - For Each RNC In ListaRNC - CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero() - If CvePSCargo > 0 Then - Exit For + Dim CveVentaRNC As Integer = -1 + + For Each RNC As Modelos.Factura In ListaRNC + + If NCDescuento Then + EsCargo = (Not RNC.Num1 = 2) End If + + CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero() + CveVentaRNC = RNC.DtDetalle.FiltroPrimeroValor("CveVenta", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero() + + If EsCargo Then + If Not ObjAcum.DistribuidorMovtosGet(Me.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then + ErrorList.Add("Ocurrió un error al obtener los movimientos del distribuidor.") + Exit For + End If + + Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero($"CvePSCargo={CvePSCargo}") + + If RowMovto IsNot Nothing Then + 'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO + Dim ImporteCargoOriginal = (RowMovto("ImporteCargo").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) + 'Dim ImporteBonificacionOriginal = (RowMovto("ImporteBonificacion").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) + Dim PuntosOriginales = (RowMovto("Puntos").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) + + Dim CveTamanio As Integer = RowMovto("CveTamaño").ToString().ToEntero() + Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() + + Dim Puntos As Decimal = Cantidad * PuntosOriginales + Dim Cargo As Decimal = Cantidad * ImporteCargoOriginal + Dim Bonificacion As Decimal = 0 + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then + ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.") + Exit For + End If + End If + + Else + + Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}") + + If DrTamanio IsNot Nothing Then + 'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO + Dim ImporteBonificacion = Row("Total").ToString().ToDecimal().RoundSQL(2) + Dim CveTamanio As Integer = DrTamanio("CveTamaño").ToString().ToEntero() + Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() + + Dim Puntos As Decimal = 0 + Dim Cargo As Decimal = 0 + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, ImporteBonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then + ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.") + Exit For + End If + + End If + + End If + + + Next - Dim CveTamanio As Integer = GlobalDTAcumTamaños().FiltroPrimeroValor("CveTamaño", $"CvePSCargo={CvePSCargo}").ToEntero() + 'Dim RowTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}") - If CveTamanio > 0 Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Row("Cantidad").ToString().ToDecimal(), CveTamanio, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then - ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.") - Exit For - End If - End If + 'If RowTamanio IsNot Nothing Then + ' Dim CveTamanio As Integer = RowTamanio("CveTamaño").ToString().ToEntero() + ' Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() + ' Dim Puntos As Decimal = Cantidad * RowTamanio("Puntos").ToString().ToDecimal() + ' Dim Cargo As Decimal = Cantidad * RowTamanio("Cargo").ToString().ToDecimal() + ' Dim Bonificacion As Decimal = Cantidad * RowTamanio("Bonificacion").ToString().ToDecimal() + ' If EsCargo Then + ' Bonificacion = 0 + ' Else + ' Puntos = 0 + ' Cargo = 0 + ' End If + + ' If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then + ' ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.") + ' Exit For + ' End If + 'End If End If End If @@ -24786,9 +24839,9 @@ Partial Class Ventas ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion - If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then - ChkDevAlm.Checked = True - End If + 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Rem", "Dev") Then + ' ChkDevAlm.Checked = True + 'End If If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then ChkDevAlm.Checked = True @@ -29314,13 +29367,15 @@ Partial Class Ventas End If UltimoRenglonRNC += 1 + Dim CveVentaDetalleRNC As Integer = RNCBonificacion.DtDetalle.FiltroPrimeroValor("CveVentaDetalle").ToEntero() + 'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(), DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=CveVentaDetalleRNC, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If Next @@ -32935,29 +32990,36 @@ Partial Class Ventas End If End Sub - Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean + Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura, ObjAcum As ClsAcumuladores) As Boolean Dim Resultado As Boolean = True - If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then - Dim ObjAcum As New ClsAcumuladores(SqlTransaccion) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then + For Each drow As DataRow In factura.DtDetalle.Rows + If drow("CveTamaño").ToString.ToEntero > 0 Then + Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={drow("CveTamaño").ToString.ToEntero}") + If DrTamanio IsNot Nothing Then + Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() + Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() + Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal() - Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero - - For Each drow As DataRow In factura.DtDetalle.Rows - If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, + If drow("CveTamaño").ToString.ToEntero > 0 Then + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then - Resultado = False - Exit For + Resultado = False + Exit For + End If + End If + Else + Resultado = False + Exit For + End If End If - End If - Next - Else - Resultado = True + Next + End If End If Return Resultado - End Function @@ -36023,6 +36085,9 @@ Partial Class Ventas Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs) + TxtFechaPago.Enabled = True + imgCalendario.Visible = True + If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then RBLPago.SelectedValue = "1" RBLPago.Enabled = False @@ -36037,6 +36102,8 @@ Partial Class Ventas 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL If RowLinea("TipoLinea").ToString() = "2" Then TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") + TxtFechaPago.Enabled = False + imgCalendario.Visible = False End If Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() From 985588887594dd478a710ad03e2809929214c63a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 11 Jan 2023 18:46:15 -0700 Subject: [PATCH 2/6] Validar mensaje de cuentas de contpaqi --- Compras/Compras.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index eadfd1fe5..f32d786ed 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -3500,7 +3500,7 @@ Partial Class Compras_Compras ViewState("IdCtaContRetIVA") = ObjProveedor.IdCtaContRetIVA ViewState("IdCtaContRetISR") = ObjProveedor.IdCtaContRetISR - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ObjProveedor.IdCtaContProveedores < 1 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ObjProveedor.IdCtaContProveedores < 1 Then Alert("El Proveedor seleccionado no tiene cuenta contable asignada.", TipoMensaje.MsgAdvertencia) End If From 97109865a61731d69afde36703e4f7386f58f899 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 11 Jan 2023 18:46:39 -0700 Subject: [PATCH 3/6] Validacion de cuentas globales --- General/SaldosIniciales.aspx.vb | 1091 +++++++++++++++++++------------ 1 file changed, 675 insertions(+), 416 deletions(-) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 76cec5493..fa3d8bd00 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -27,6 +27,265 @@ Partial Class General_SaldosIniciales End If End Sub + Private Function ValidaCuentasSaldoInicial(ByRef ObjConta As ClsContabilidad, ByRef NombreCuenta As String) As Boolean + Dim retorno As Boolean = True + + Dim listaCuentas As New List(Of String) + listaCuentas.Add("_GLOBAL") + listaCuentas.Add("_ESTADISTICAS") + listaCuentas.Add("_ACTIVO") + listaCuentas.Add("_CAPITAL") + listaCuentas.Add("_CUADRE") + listaCuentas.Add("_ORDEN") + listaCuentas.Add("_PASIVO") + listaCuentas.Add("_UTILIDAD") + listaCuentas.Add("_RACREEDOR") + listaCuentas.Add("_RDEUDOR") + + Dim CveCuentaGlobal As Integer = -1 + Dim CveCuentaEstadistica As Integer = -1 + Dim CveCuentaActivo As Integer = -1 + Dim CveCuentaCapital As Integer = -1 + Dim CveCuentaCuadre As Integer = -1 + Dim CveCuentaOrden As Integer = -1 + Dim CveCuentaPasivo As Integer = -1 + Dim CveCuentaUtilidad As Integer = -1 + Dim CveCuentaAcreedor As Integer = -1 + Dim CveCuentaDeudor As Integer = -1 + + For Each Cuenta In listaCuentas + Select Case Cuenta + Case "_GLOBAL" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaGlobal = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaGlobal <= 0 Then + Dim IdNew = ObjConta.AddCuenta(-2, Cuenta, "Cuenta Global", "A", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaGlobal = IdNew + Else + Exit For + End If + End If + Case "_ESTADISTICAS" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaEstadistica = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaEstadistica <= 0 Then + Dim IdNew = ObjConta.AddCuenta(-2, Cuenta, "Cuentas Estadísticas", "I", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaEstadistica = IdNew + Else + Exit For + End If + + End If + + Case "_ACTIVO" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaActivo = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaActivo <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Activo", "A", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaActivo = IdNew + Else + Exit For + End If + + End If + + Case "_CAPITAL" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaCapital = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaCapital <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Activo", "F", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaCapital = IdNew + Else + Exit For + End If + + End If + + Case "_CUADRE" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaCuadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaCuadre <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuenta de Cuadre", "A", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaCuadre = IdNew + Else + Exit For + End If + + End If + Case "_ORDEN" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaOrden = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaOrden <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Orden", "K", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaOrden = IdNew + Else + Exit For + End If + + End If + Case "_PASIVO" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaPasivo = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaPasivo <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Pasivo", "D", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaPasivo = IdNew + Else + Exit For + End If + + End If + + Case "_UTILIDAD" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaUtilidad = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaUtilidad <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaCapital, Cuenta, "Utilidad o Pérdida del Ejercicio", "F", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaUtilidad = IdNew + Else + Exit For + End If + + End If + + Case "_RACREEDOR" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaAcreedor = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaAcreedor <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Resultados Acreedoras", "H", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaAcreedor = IdNew + Else + Exit For + End If + + End If + + Case "_RDEUDOR" + NombreCuenta = Cuenta + + If ObjConta.GetCuentas(-1, Cuenta, -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaDeudor = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + End If + End If + + If CveCuentaDeudor <= 0 Then + Dim IdNew = ObjConta.AddCuenta(CveCuentaGlobal, Cuenta, "Cuentas de Resultados Deudoras", "G", 2, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) + If IdNew > 0 Then + CveCuentaDeudor = IdNew + Else + Exit For + End If + + End If + End Select + Next + + If CveCuentaGlobal <= 0 Then + retorno = False + End If + + If CveCuentaEstadistica <= 0 Then + retorno = False + End If + + If CveCuentaActivo <= 0 Then + retorno = False + End If + + If CveCuentaCapital <= 0 Then + retorno = False + End If + + If CveCuentaCuadre <= 0 Then + retorno = False + End If + + If CveCuentaOrden <= 0 Then + retorno = False + End If + + If CveCuentaPasivo <= 0 Then + retorno = False + End If + + If CveCuentaUtilidad <= 0 Then + retorno = False + End If + + If CveCuentaAcreedor <= 0 Then + retorno = False + End If + + If CveCuentaDeudor <= 0 Then + retorno = False + End If + + Return retorno + End Function + Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) Dim dt As New DataTable @@ -647,7 +906,7 @@ Partial Class General_SaldosIniciales Dim DTCuentasContables As New DataTable - If UsuarioActual.Empresa.TipoContabilizacion = 1 Or UsuarioActual.CveEmpresa.Contiene(172) Then + If UsuarioActual.Empresa.TipoContabilizacion = 1 Then Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then @@ -702,64 +961,64 @@ Partial Class General_SaldosIniciales Dim NuevaClasificacion As Boolean = False For Each Row As DataRow In dt.Rows - Dim Codigo As String = Row("Codigo").ToString() - Dim Descripcion As String = Row("Descripcion").ToString() - Dim TipoPS As String = Row("Tipo").ToString().Trim.ToUpper - Dim CodigoBarras As String = Row("Código Barras").ToString() - Dim UnidadMedida As String = Row("Unidad Medida").ToString().Trim - Dim Clasificacion As String = Row("Clasificacion").ToString().Trim - Dim Marca As String = Row("Marca").ToString().Trim - Dim AplicaSerie As Boolean = If(Row("AplicaSerie").ToString().Trim.ToUpper.Contiene("1", "SI"), True, False) - Dim Precio As Double = Row("Precio").ToString().ToDouble - Dim IEPS As Decimal = Row("IEPS").ToString().ToDecimal - Dim Tamaño As String = Row("Tamaño").ToString().Trim - Dim SATClavePS As String = Row("Código SAT").ToString().Trim + Dim Codigo As String = Row("Codigo").ToString + Dim Descripcion As String = Row("Descripcion").ToString + Dim TipoPS As String = Row("Tipo").ToString.Trim.ToUpper + Dim CodigoBarras As String = Row("Código Barras").ToString + Dim UnidadMedida As String = Row("Unidad Medida").ToString.Trim + Dim Clasificacion As String = Row("Clasificacion").ToString.Trim + Dim Marca As String = Row("Marca").ToString.Trim + Dim AplicaSerie As Boolean = If(Row("AplicaSerie").ToString.Trim.ToUpper.Contiene("1", "SI"), True, False) + Dim Precio As Double = Row("Precio").ToString.ToDouble + Dim IEPS As Decimal = Row("IEPS").ToString.ToDecimal + Dim Tamaño As String = Row("Tamaño").ToString.Trim + Dim SATClavePS As String = Row("Código SAT").ToString.Trim - Dim Clasificacion2 As String = If(dt.Columns.Contains("Servicio"), Row("Servicio").ToString().Trim, "") - Dim Litraje As Double = If(dt.Columns.Contains("Conversion Unidad"), Row("Conversion Unidad").ToString().ToDouble, 0) - Dim RinTamaño As String = If(Row.Table.Columns.Contains("Tamaño de Rin"), Row("Tamaño de Rin").ToString().Trim, "") - Dim Medida As String = If(Row.Table.Columns.Contains("Medida"), Row("Medida").ToString().Trim, "") - Dim SATClaveUnidadMedida As String = If(Row.Table.Columns.Contains("Clave Unidad"), Row("Clave Unidad").ToString().Trim, "") - Dim Linea As String = If(Row.Table.Columns.Contains("Linea"), Row("Linea").ToString().Trim, "") - Dim Modelo As String = If(Row.Table.Columns.Contains("Modelo"), Row("Modelo").ToString().Trim, "") - Dim RetIVA As Decimal = If(Row.Table.Columns.Contains("RetIVA"), Row("RetIVA").ToString().Trim.ToDecimal, 0D) + Dim Clasificacion2 As String = If(dt.Columns.Contains("Servicio"), Row("Servicio").ToString.Trim, "") + Dim Litraje As Double = If(dt.Columns.Contains("Conversion Unidad"), Row("Conversion Unidad").ToString.ToDouble, 0) + Dim RinTamaño As String = If(Row.Table.Columns.Contains("Tamaño de Rin"), Row("Tamaño de Rin").ToString.Trim, "") + Dim Medida As String = If(Row.Table.Columns.Contains("Medida"), Row("Medida").ToString.Trim, "") + Dim SATClaveUnidadMedida As String = If(Row.Table.Columns.Contains("Clave Unidad"), Row("Clave Unidad").ToString.Trim, "") + Dim Linea As String = If(Row.Table.Columns.Contains("Linea"), Row("Linea").ToString.Trim, "") + Dim Modelo As String = If(Row.Table.Columns.Contains("Modelo"), Row("Modelo").ToString.Trim, "") + Dim RetIVA As Decimal = If(Row.Table.Columns.Contains("RetIVA"), Row("RetIVA").ToString.Trim.ToDecimal, 0D) - Dim CvePS As Integer = DTPS.FiltroPrimeroValor("CvePS", $"Codigo = '{Codigo}'").ToString().ToEntero() + Dim CvePS As Integer = DTPS.FiltroPrimeroValor("CvePS", $"Codigo = '{Codigo}'").ToString.ToEntero Dim CveTipoPS As Integer = If(TipoPS.ToUpper = "PRODUCTO", 2, 1) - Dim CveClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString().ToEntero() - Dim CveUnidadMedida As Integer = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}' OR Abreviatura = '{UnidadMedida}'").ToString().ToEntero() - Dim CveSATPS As Integer = ClsPaginas.GlobalDTPSATPS("-1", CodigoSAT:=SATClavePS).FiltroPrimeroValor("CveSATPS", "").ToEntero() - Dim CveTamaño As Integer = GlobalDTAcumTamaños.FiltroPrimeroValor("CveTamaño", $"Tamaño = '{Tamaño}' AND CveEmpresa = {UsuarioActual.CveEmpresa}").ToString().ToEntero() - Dim CveClasificacion2 As Integer = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString().ToEntero() - Dim CveClasificacionDetalle As Integer = GlobalDTClasificacionesDetalle(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CveClasificacionDetalle", $"ClasificacionDetalle = '{Linea}'").ToString().ToEntero() + Dim CveClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero + Dim CveUnidadMedida As Integer = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}' OR Abreviatura = '{UnidadMedida}'").ToString.ToEntero + Dim CveSATPS As Integer = ClsPaginas.GlobalDTPSATPS("-1", CodigoSAT:=SATClavePS).FiltroPrimeroValor("CveSATPS", "").ToEntero + Dim CveTamaño As Integer = GlobalDTAcumTamaños.FiltroPrimeroValor("CveTamaño", $"Tamaño = '{Tamaño}' AND CveEmpresa = {UsuarioActual.CveEmpresa}").ToString.ToEntero + Dim CveClasificacion2 As Integer = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString.ToEntero + Dim CveClasificacionDetalle As Integer = GlobalDTClasificacionesDetalle(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CveClasificacionDetalle", $"ClasificacionDetalle = '{Linea}'").ToString.ToEntero If Not CveClasificacion > 0 AndAlso Clasificacion <> "" Then If ObjClas.AddClasificaciones(Clasificacion, "", -1, "-1", -1, "-1", -1, "-1", - GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToString().ToEntero(), UsuarioActual.CveUsuario, + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then GlobalDTClasificaciones(UsuarioActual.CveEmpresa) = Nothing - CveClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString().ToEntero() + CveClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero NuevaClasificacion = True End If End If If Not CveUnidadMedida > 0 AndAlso UnidadMedida <> "" Then - If ObjUM.AddUnidadMedida(UnidadMedida, UnidadMedida, "", "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).ToEntero() > 0 Then + If ObjUM.AddUnidadMedida(UnidadMedida, UnidadMedida, "", "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).ToEntero > 0 Then If ObjUM.GetUnidadesMedida(UsuarioActual.CveEmpresa) Then GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) = Nothing - CveUnidadMedida = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString().ToEntero() + CveUnidadMedida = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString.ToEntero End If End If Dim CveMarca As Integer = -1 If Marca <> "" AndAlso DtMarcas IsNot Nothing Then - CveMarca = DtMarcas.FiltroPrimeroValor("CveMarca", $"Marca = '{Marca}'").ToString().ToEntero() + CveMarca = DtMarcas.FiltroPrimeroValor("CveMarca", $"Marca = '{Marca}'").ToString.ToEntero If Not CveMarca > 0 Then If ObjPS.AddMarcas(Marca, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then DtMarcas = ObjPS.DtResultados.Copy - CveMarca = DtMarcas.FiltroPrimeroValor("CveMarca", $"Marca = '{Marca}'").ToString().ToEntero() + CveMarca = DtMarcas.FiltroPrimeroValor("CveMarca", $"Marca = '{Marca}'").ToString.ToEntero End If End If End If @@ -767,12 +1026,12 @@ Partial Class General_SaldosIniciales Dim CveMedida As Integer = -1 If Medida <> "" AndAlso DtMedidas IsNot Nothing Then - CveMedida = DtMedidas.FiltroPrimeroValor("CveMedida", $"Medida = '{Medida}'").ToString().ToEntero() + CveMedida = DtMedidas.FiltroPrimeroValor("CveMedida", $"Medida = '{Medida}'").ToString.ToEntero If Not CveMedida > 0 Then If ObjGral.AddMedidas(CveClasificacion, "", Medida, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjGral.GetMedidas(UsuarioActual.CveEmpresa) Then DtMedidas = ObjGral.DtResultados.Copy - CveMedida = DtMedidas.FiltroPrimeroValor("CveMedida", $"Medida = '{Medida}'").ToString().ToEntero() + CveMedida = DtMedidas.FiltroPrimeroValor("CveMedida", $"Medida = '{Medida}'").ToString.ToEntero End If End If End If @@ -780,12 +1039,12 @@ Partial Class General_SaldosIniciales Dim CveRinTamaño As Integer = -1 If RinTamaño <> "" AndAlso DtRinTamaño IsNot Nothing Then - CveRinTamaño = DtRinTamaño.FiltroPrimeroValor("CveRinTamaño", $"RinTamaño = '{RinTamaño}'").ToString().ToEntero() + CveRinTamaño = DtRinTamaño.FiltroPrimeroValor("CveRinTamaño", $"RinTamaño = '{RinTamaño}'").ToString.ToEntero If Not CveRinTamaño > 0 Then If ObjGral.AddRimTamanios(CveClasificacion, "", RinTamaño, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then DtRinTamaño = ObjGral.DtResultados.Copy - CveRinTamaño = DtRinTamaño.FiltroPrimeroValor("CveRinTamaño", $"RinTamaño = '{RinTamaño}'").ToString().ToEntero() + CveRinTamaño = DtRinTamaño.FiltroPrimeroValor("CveRinTamaño", $"RinTamaño = '{RinTamaño}'").ToString.ToEntero End If End If End If @@ -793,12 +1052,12 @@ Partial Class General_SaldosIniciales Dim CveModelo As Integer = -1 If Modelo <> "" AndAlso DtModelos IsNot Nothing Then - CveModelo = DtModelos.FiltroPrimeroValor("CveModelo", $"Modelo = '{Modelo}'").ToString().ToEntero() + CveModelo = DtModelos.FiltroPrimeroValor("CveModelo", $"Modelo = '{Modelo}'").ToString.ToEntero If Not CveModelo > 0 Then If ObjGral.AddModelos(CveMarca, "", Modelo, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjGral.GetModelos(UsuarioActual.CveEmpresa) Then DtModelos = ObjGral.DtResultados.Copy - CveModelo = DtModelos.FiltroPrimeroValor("CveModelo", $"Modelo = '{Modelo}'").ToString().ToEntero() + CveModelo = DtModelos.FiltroPrimeroValor("CveModelo", $"Modelo = '{Modelo}'").ToString.ToEntero End If End If End If @@ -810,21 +1069,21 @@ Partial Class General_SaldosIniciales If ObjGral.GetCategorias(UsuarioActual.CveEmpresa, 4) Then - CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero() + CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero End If If Not CveCategoria > 0 Then If ObjGral.AddCategorias(Clasificacion2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 4) Then If ObjGral.GetCategorias(UsuarioActual.CveEmpresa, 4) Then - CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero() + CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero End If End If End If If ObjClas.GetClasificaciones(UsuarioActual.CveEmpresa) Then - CveClasificacion2 = ObjClas.DtResultados.FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{ Clasificacion2.Trim }'").ToEntero() + CveClasificacion2 = ObjClas.DtResultados.FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{ Clasificacion2.Trim }'").ToEntero End If @@ -833,7 +1092,7 @@ Partial Class General_SaldosIniciales If ObjClas.AddClasificaciones(Clasificacion2, "", -1, "-1", -1, "-1", -1, "-1", CveCategoria, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjClas.GetClasificaciones(Tipo:=4) Then Application("GlobalDTClasificaciones2") = ObjClas.DtResultados - CveClasificacion2 = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString().ToEntero() + CveClasificacion2 = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString.ToEntero End If End If @@ -929,14 +1188,14 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim RazonSocial As String = Row("RazonSocial").ToString() + Dim RazonSocial As String = Row("RazonSocial").ToString - Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = Row("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then Row("CveCuentaContable") = CveCuentaContable @@ -948,8 +1207,8 @@ Partial Class General_SaldosIniciales Next For Each Row As DataRow In dt.Rows - Dim RazonSocial As String = Row("RazonSocial").ToString() - If Not (Row("TipoProveedor").ToString().Trim.ToUpper).Contiene("PROVEEDOR", "ACREEDOR") Then + Dim RazonSocial As String = Row("RazonSocial").ToString + If Not (Row("TipoProveedor").ToString.Trim.ToUpper).Contiene("PROVEEDOR", "ACREEDOR") Then sbErrores.AppendLine($"Proveedor {RazonSocial} TipoProveedor {Row("TipoProveedor")} invalido.
") ErrorProv = True End If @@ -974,57 +1233,57 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim Codigo As String = Row("Codigo").ToString() - Dim RazonSocial As String = Row("RazonSocial").ToString() + Dim Codigo As String = Row("Codigo").ToString + Dim RazonSocial As String = Row("RazonSocial").ToString If RazonSocial.Trim.Length = 0 Then Continue For End If - Dim RFC As String = Row("RFC").ToString().Trim + Dim RFC As String = Row("RFC").ToString.Trim - Dim Dirrecion As String = $"{ Row("Población").ToString()}, { Row("Estado").ToString()} , Colonia { Row("Colonia").ToString()}, {Row("Calle").ToString()} #{Row("Número exterior").ToString()}" + Dim Dirrecion As String = $"{ Row("Población").ToString}, { Row("Estado").ToString} , Colonia { Row("Colonia").ToString}, {Row("Calle").ToString} #{Row("Número exterior").ToString}" - 'Dim NumExt As String = Row("Número exterior").ToString() + 'Dim NumExt As String = Row("Número exterior").ToString - ' Dim Colonia As String = Row("Colonia").ToString() - Dim CodigoPostal As Integer = Row("Código Postal").ToString().ToEntero() + ' Dim Colonia As String = Row("Colonia").ToString + Dim CodigoPostal As Integer = Row("Código Postal").ToString.ToEntero - ' Dim Poblacion As String = Row("Población").ToString() + ' Dim Poblacion As String = Row("Población").ToString - 'Dim Estado As String = Row("Estado").ToString() - Dim Telefono As String = Row("Teléfono").ToString() - Dim ContactoMail As String = Row("Contacto").ToString() - Dim CelularContacto As String = Row("Celular Contacto").ToString() - Dim LimiteCredito As Double = Row("Limite Credito").ToString().ToDouble - Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString().ToEntero() + 'Dim Estado As String = Row("Estado").ToString + Dim Telefono As String = Row("Teléfono").ToString + Dim ContactoMail As String = Row("Contacto").ToString + Dim CelularContacto As String = Row("Celular Contacto").ToString + Dim LimiteCredito As Double = Row("Limite Credito").ToString.ToDouble + Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero - Dim Banco As String = Row("Banco").ToString() - Dim NumeroCuenta As String = Row("N° CUENTA").ToString().Replace("-", "").Replace(" ", "") - Dim ClabeInter As String = Row("Clabe Inter").ToString().Replace("-", "").Replace(" ", "") + Dim Banco As String = Row("Banco").ToString + Dim NumeroCuenta As String = Row("N° CUENTA").ToString.Replace("-", "").Replace(" ", "") + Dim ClabeInter As String = Row("Clabe Inter").ToString.Replace("-", "").Replace(" ", "") - Dim CveProveedor As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString().ToEntero() - Dim CveProveedor2 As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"RazonSocial = '{RazonSocial}'").ToString().ToEntero() + Dim CveProveedor As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero + Dim CveProveedor2 As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"RazonSocial = '{RazonSocial}'").ToString.ToEntero Dim CveProveedor3 As Integer = 0 - Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero() - Dim TipoProveedor As Integer = If(Row("TipoProveedor").ToString().ToUpper = "PROVEEDOR", 1, 2) + Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString.ToEntero + Dim TipoProveedor As Integer = If(Row("TipoProveedor").ToString.ToUpper = "PROVEEDOR", 1, 2) Dim CveConceptoCuentaAsiganaciones As Integer = If(TipoProveedor = 1, 5, 305) If Codigo.Trim.Length > 0 Then - CveProveedor3 = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"Codigo = '{Codigo}'").ToString().ToEntero() + CveProveedor3 = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"Codigo = '{Codigo}'").ToString.ToEntero End If - Dim CodigoRegimenFiscal As String = Row("Regimen Fiscal").ToString() - Dim ProveedorClasificacion As String = Row("Clasificación Proveedor").ToString() - Dim Moneda As String = Row("Moneda Preferente").ToString() - Dim DIOTTipoTercero As String = Row("Tipo Tercero").ToString().Trim.ToUpper - Dim DIOTipoOperacion As String = Row("Tipo Operación").ToString() + Dim CodigoRegimenFiscal As String = Row("Regimen Fiscal").ToString + Dim ProveedorClasificacion As String = Row("Clasificación Proveedor").ToString + Dim Moneda As String = Row("Moneda Preferente").ToString + Dim DIOTTipoTercero As String = Row("Tipo Tercero").ToString.Trim.ToUpper + Dim DIOTipoOperacion As String = Row("Tipo Operación").ToString Dim CveMoneda As Integer = -1 Dim CveProveedorClasificacion As Integer = -1 @@ -1104,7 +1363,7 @@ Partial Class General_SaldosIniciales If ProveedorClasificacion.Trim.Length > 0 Then - CveProveedorClasificacion = GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedorClasificacion", $"ProveedorClasificacion = '{ProveedorClasificacion}'").ToString().ToEntero() + CveProveedorClasificacion = GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedorClasificacion", $"ProveedorClasificacion = '{ProveedorClasificacion}'").ToString.ToEntero If Not CveProveedorClasificacion > 0 Then sbErrores.AppendLine($"Proveedor {RazonSocial} Proveedor Clasificacion {ProveedorClasificacion} invalida.
") ErrorProv = True @@ -1112,7 +1371,7 @@ Partial Class General_SaldosIniciales End If If CodigoRegimenFiscal.Trim.Length > 0 Then - CveRegimenFiscal = GlobalDTRegimenesFiscales.FiltroPrimeroValor("CveRegimenFiscal", $"CodigoRegimenFiscal= '{CodigoRegimenFiscal}' ").ToEntero() + CveRegimenFiscal = GlobalDTRegimenesFiscales.FiltroPrimeroValor("CveRegimenFiscal", $"CodigoRegimenFiscal= '{CodigoRegimenFiscal}' ").ToEntero If Not CveRegimenFiscal > 0 Then sbErrores.AppendLine($"Proveedor {RazonSocial} Codigo RegimenFiscal {CodigoRegimenFiscal} invalido.
") ErrorProv = True @@ -1231,11 +1490,11 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim RazonSocial As String = Row("RazonSocial").ToString() - Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim RazonSocial As String = Row("RazonSocial").ToString + Dim CuentaContable As String = Row("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then Row("CveCuentaContable") = CveCuentaContable @@ -1264,40 +1523,40 @@ Partial Class General_SaldosIniciales NumRow = NumRow + 1 - Dim Codigo As String = Row("Codigo").ToString() - Dim RazonSocial As String = Row("RazonSocial").ToString() - Dim RFC As String = Row("RFC").ToString().Trim - Dim Calle As String = Row("Calle").ToString() - Dim NumExt As Decimal = Row("Número exterior").ToString().ToDecimal - Dim Colonia As String = Row("Colonia").ToString() - Dim CodigoPostal As String = Row("Código Postal").ToString() - Dim Poblacion As String = Row("Población").ToString() - Dim Estado As String = Row("Estado").ToString().Trim - Dim Pais As String = Row("Pais").ToString() - Dim Telefono As String = Row("Teléfono").ToString().Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "") - Dim Contacto As String = Row("Contacto").ToString() + Dim Codigo As String = Row("Codigo").ToString + Dim RazonSocial As String = Row("RazonSocial").ToString + Dim RFC As String = Row("RFC").ToString.Trim + Dim Calle As String = Row("Calle").ToString + Dim NumExt As Decimal = Row("Número exterior").ToString.ToDecimal + Dim Colonia As String = Row("Colonia").ToString + Dim CodigoPostal As String = Row("Código Postal").ToString + Dim Poblacion As String = Row("Población").ToString + Dim Estado As String = Row("Estado").ToString.Trim + Dim Pais As String = Row("Pais").ToString + Dim Telefono As String = Row("Teléfono").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "") + Dim Contacto As String = Row("Contacto").ToString - Dim Vendedor As String = Row("Vendedor").ToString() - Dim Clasificacion As String = Row("ClasificacionCliente").ToString() - Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString().ToEntero() + Dim Vendedor As String = Row("Vendedor").ToString + Dim Clasificacion As String = Row("ClasificacionCliente").ToString + Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero - Dim CveVendedor As Integer = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString().ToEntero() - Dim CveClasificación As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString().ToEntero() - Dim EsDistribuidor As Boolean = If(dt.Columns.Contains("Es distribuidor"), If(Row("Es distribuidor").ToString().ToUpper = "SI", True, False), False) - Dim CargoUsado As Boolean = If(dt.Columns.Contains("Cargo Usados"), If(Row("Cargo Usados").ToString().ToUpper = "SI", True, False), False) - Dim BonificacionUsado As Boolean = If(dt.Columns.Contains("EmitirBon Usado"), If(Row("EmitirBon Usado").ToString().ToUpper = "SI", True, False), False) + Dim CveVendedor As Integer = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString.ToEntero + Dim CveClasificación As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero + Dim EsDistribuidor As Boolean = If(dt.Columns.Contains("Es distribuidor"), If(Row("Es distribuidor").ToString.ToUpper = "SI", True, False), False) + Dim CargoUsado As Boolean = If(dt.Columns.Contains("Cargo Usados"), If(Row("Cargo Usados").ToString.ToUpper = "SI", True, False), False) + Dim BonificacionUsado As Boolean = If(dt.Columns.Contains("EmitirBon Usado"), If(Row("EmitirBon Usado").ToString.ToUpper = "SI", True, False), False) - Dim LimiteCredito As Decimal = Row("Limite Credito").ToString().ToDecimal - Dim CobranzaCorreo As String = Row("CorreoPagos").ToString() - Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString().ToEntero() + Dim LimiteCredito As Decimal = Row("Limite Credito").ToString.ToDecimal + Dim CobranzaCorreo As String = Row("CorreoPagos").ToString + Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero - Dim DìaVisita As String = If(dt.Columns.Contains("Dia Pago"), Row("Dia Pago").ToString(), "") - Dim DiasPagoEspecifico As String = If(dt.Columns.Contains("Dìa Visita"), Row("Dìa Visita").ToString(), "") - Dim CobranzaContacto As String = If(dt.Columns.Contains("Encargado Pagoa"), Row("Encargado Pago").ToString(), "") - Dim CobranzaTelefono As String = Row("Celular Contacto").ToString().Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "") - Dim CveUsoCFDI As Integer = If(Row("UsoCFDI").ToString() = "", -1, GlobalDTSATUsosCFDI().FiltroPrimeroValor("CveUsoCFDI", String.Format("UsoCFDI = '{0}'", Row("UsoCFDI").ToString())).ToEntero()) - Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero() + Dim DìaVisita As String = If(dt.Columns.Contains("Dia Pago"), Row("Dia Pago").ToString, "") + Dim DiasPagoEspecifico As String = If(dt.Columns.Contains("Dìa Visita"), Row("Dìa Visita").ToString, "") + Dim CobranzaContacto As String = If(dt.Columns.Contains("Encargado Pagoa"), Row("Encargado Pago").ToString, "") + Dim CobranzaTelefono As String = Row("Celular Contacto").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "") + Dim CveUsoCFDI As Integer = If(Row("UsoCFDI").ToString = "", -1, GlobalDTSATUsosCFDI().FiltroPrimeroValor("CveUsoCFDI", String.Format("UsoCFDI = '{0}'", Row("UsoCFDI").ToString)).ToEntero) + Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString.ToEntero ' CobranzaContacto = Regex.Replace(CobranzaContacto, "[^0-9]", "") 'Telefono @@ -1311,7 +1570,7 @@ Partial Class General_SaldosIniciales CobranzaTelefono = "" End If - Dim FormaPago As String = If(dt.Columns.Contains("Forma Pago"), Row("Forma Pago").ToString(), "") + Dim FormaPago As String = If(dt.Columns.Contains("Forma Pago"), Row("Forma Pago").ToString, "") Dim CveFormaPago33 As Integer = 99 Select Case FormaPago @@ -1389,7 +1648,7 @@ Partial Class General_SaldosIniciales - 'Dim RazonSocial As String = Row("RazonSocial").ToString() + 'Dim RazonSocial As String = Row("RazonSocial").ToString 'Contacto @@ -1404,9 +1663,9 @@ Partial Class General_SaldosIniciales ' Exit For 'End If Else - Dim CveSATEstado As Integer = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveSATEstado", String.Format(" NombreEstado ='{0}'", Estado.ToUpper)).ToEntero() + Dim CveSATEstado As Integer = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveSATEstado", String.Format(" NombreEstado ='{0}'", Estado.ToUpper)).ToEntero - If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString(), "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1, + If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString, "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1, "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", Codigo, LimiteCredito, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado, BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33, CveUsoCFDI:=CveUsoCFDI, CveSATEstado:=CveSATEstado, CveAdminTrayecto:=0) Then @@ -1472,38 +1731,38 @@ Partial Class General_SaldosIniciales DtProveedores = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) Dim RFC As String = "" Dim drr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero("") - Dim CvePS As Integer = drr("CvePS").ToString().ToEntero() - Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString().ToEntero() - Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero() + Dim CvePS As Integer = drr("CvePS").ToString.ToEntero + Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString.ToEntero + Dim CveClasificacion As Integer = drr("CveClasificacion").ToString.ToEntero Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows - Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'") - RFC = Row("RFC").ToString().Trim - RFC = Row("RFC").ToString().Trim - Dim Serie As String = Row("Serie").ToString() - Dim Folio As String = Row("Folio").ToString() - Dim Fecha As Date = Row("Fecha").ToString().ToDate - Dim SubTotal As Decimal = Row("SubTotal").ToString().ToDecimal - Dim IVA As Decimal = Row("IVA").ToString().ToDecimal - Dim Total As Decimal = Row("Total").ToString().ToDecimal - Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal - Dim TipoDocto As String = Row("Tipo Documento").ToString() - Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString().ToEntero() - GuardaLog(Sucursal + " - " + Row("Sucursal").ToString()) - Dim RetIVA As Decimal = Row("Ret IVA").ToString().ToDecimal - Dim RetISR As Decimal = Row("Ret ISR").ToString().ToDecimal - Dim IEPS As Decimal = Row("IEPS").ToString().ToDecimal - Dim Moneda As String = Row("Moneda").ToString() - Dim TipoCambio As String = Row("Tipo Cambio").ToString() - Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate + Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString}'") + RFC = Row("RFC").ToString.Trim + RFC = Row("RFC").ToString.Trim + Dim Serie As String = Row("Serie").ToString + Dim Folio As String = Row("Folio").ToString + Dim Fecha As Date = Row("Fecha").ToString.ToDate + Dim SubTotal As Decimal = Row("SubTotal").ToString.ToDecimal + Dim IVA As Decimal = Row("IVA").ToString.ToDecimal + Dim Total As Decimal = Row("Total").ToString.ToDecimal + Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal + Dim TipoDocto As String = Row("Tipo Documento").ToString + Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero + GuardaLog(Sucursal + " - " + Row("Sucursal").ToString) + Dim RetIVA As Decimal = Row("Ret IVA").ToString.ToDecimal + Dim RetISR As Decimal = Row("Ret ISR").ToString.ToDecimal + Dim IEPS As Decimal = Row("IEPS").ToString.ToDecimal + Dim Moneda As String = Row("Moneda").ToString + Dim TipoCambio As String = Row("Tipo Cambio").ToString + Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString.ToDate Dim CveMoneda As Integer = 1 - Dim CveProveedorSucursal As Integer = Row("CveProveedorSucursal").ToString().ToEntero() - Dim PorcentajeIVA As String = Row("PorcentajeIVA").ToString() - Dim ImpuestosLocales As Decimal = If(dt.Columns.Contains("ImpuestosLocales"), Row("ImpuestosLocales").ToString(), "0").ToDecimal - Dim RetIVAPorcentaje As Decimal = Row("RetIVAPorcentaje").ToString().ToDecimal - Dim RetISRPorcentaje As Decimal = Row("RetISRPorcentaje").ToString().ToDecimal + Dim CveProveedorSucursal As Integer = Row("CveProveedorSucursal").ToString.ToEntero + Dim PorcentajeIVA As String = Row("PorcentajeIVA").ToString + Dim ImpuestosLocales As Decimal = If(dt.Columns.Contains("ImpuestosLocales"), Row("ImpuestosLocales").ToString, "0").ToDecimal + Dim RetIVAPorcentaje As Decimal = Row("RetIVAPorcentaje").ToString.ToDecimal + Dim RetISRPorcentaje As Decimal = Row("RetISRPorcentaje").ToString.ToDecimal If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorCompras = True @@ -1511,14 +1770,14 @@ Partial Class General_SaldosIniciales If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For If Not CveProveedorSucursal > 0 Then CveProveedorSucursal = -1 - TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString() + TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString 'Temporalmente SE BORRARA - Dim Transaccion As String = "" 'Row("Transaccion2").ToString() - Dim Folio2 As String = "" 'Row("Folio2").ToString() - Dim CodProvee As String = "" 'Row("CodProvee2").ToString() + Dim Transaccion As String = "" 'Row("Transaccion2").ToString + Dim Folio2 As String = "" 'Row("Folio2").ToString + Dim CodProvee As String = "" 'Row("CodProvee2").ToString 'Moneda If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN", "MONEDA NACIONAL") Then @@ -1542,7 +1801,7 @@ Partial Class General_SaldosIniciales End If 'Compra - If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDouble, FechaVencimiento, + If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero, SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDouble, FechaVencimiento, False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total) Then ErrorCompras = True @@ -1551,7 +1810,7 @@ Partial Class General_SaldosIniciales CveCompra = ObjCompras.CveCompra 'Compra Detalle - If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, Sucursal.ToEntero(), -1, 0, 1, SubTotal, 0.16D, SubTotal, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA.ToDecimal, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje) Then + If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, Sucursal.ToEntero, -1, 0, 1, SubTotal, 0.16D, SubTotal, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA.ToDecimal, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje) Then ErrorCompras = True Exit For End If @@ -1559,20 +1818,20 @@ Partial Class General_SaldosIniciales If TipoDocto = "NC" Then ConceptoContablePago = 60 'PrePólizaDetalle - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, IIf(TipoDocto = "Fac", 5, 18).ToString().ToEntero(), String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=Total, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio, 6, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=SubTotal, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, IIf(TipoDocto = "Fac", 5, 18).ToString.ToEntero, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=Total, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio, 6, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=SubTotal, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For If IVA > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Folio, 14, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=IVA, CveSubProyecto:=Sucursal.ToEntero(), CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA.ToDecimal) Then ErrorCompras = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Folio, 14, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=IVA, CveSubProyecto:=Sucursal.ToEntero, CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA.ToDecimal) Then ErrorCompras = True : Exit For End If - If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, Folio, 25, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=IEPS, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For + If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, Folio, 25, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=IEPS, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For - If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, Folio, 15, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=RetIVA, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For - If RetISR > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetISR, Folio, 16, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=RetISR, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For - If ImpuestosLocales > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImpuestosLocales, Folio, 27, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=ImpuestosLocales, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For + If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, Folio, 15, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=RetIVA, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For + If RetISR > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetISR, Folio, 16, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=RetISR, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For + If ImpuestosLocales > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImpuestosLocales, Folio, 27, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=ImpuestosLocales, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For 'Saldo If Saldo < Total Then @@ -1618,9 +1877,9 @@ Partial Class General_SaldosIniciales Dim Encontrados As Integer = 0 Dim StrRFCNoencontrados As New StringBuilder Dim drr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero("AplicaParaVenta = 1") - Dim CvePS As Integer = drr("CvePS").ToString().ToEntero() - Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString().ToEntero() - Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero() + Dim CvePS As Integer = drr("CvePS").ToString.ToEntero + Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString.ToEntero + Dim CveClasificacion As Integer = drr("CveClasificacion").ToString.ToEntero If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True @@ -1630,49 +1889,49 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows - Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'") - Dim TipoDocto As String = Row("Tipo Documento").ToString().Trim - Dim RFC As String = Row("RFC").ToString().Trim - Dim Serie As String = Row("Serie").ToString() - Dim Folio As Integer = Row("Folio").ToString().ToEntero() - Dim Fecha As Date = Row("Fecha").ToString().ToDate - Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate - Dim ImpuestoLocal As Decimal = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString().ToDecimal, 0D) - Dim Amortizacion As Double = If(dt.Columns.Contains("Amort.Ant"), Row("Amort.Ant").ToString().ToDouble, 0.0) - Dim SubTotal As Decimal = Row("SubTotal").ToString().ToDecimal - Dim IVA As Decimal = Row("IVA").ToString().ToDecimal - Dim Total As Decimal = Row("Total").ToString().ToDecimal - Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal - Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString().ToEntero() - Dim RetIVA As Decimal = Row("Ret IVA").ToString().ToDecimal - Dim RetISR As Double = Row("Ret ISR").ToString().ToDouble - Dim Moneda As String = Row("Moneda").ToString() - Dim TipoCambio As String = Row("Tipo Cambio").ToString() + Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString}'") + Dim TipoDocto As String = Row("Tipo Documento").ToString.Trim + Dim RFC As String = Row("RFC").ToString.Trim + Dim Serie As String = Row("Serie").ToString + Dim Folio As Integer = Row("Folio").ToString.ToEntero + Dim Fecha As Date = Row("Fecha").ToString.ToDate + Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString.ToDate + Dim ImpuestoLocal As Decimal = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString.ToDecimal, 0D) + Dim Amortizacion As Double = If(dt.Columns.Contains("Amort.Ant"), Row("Amort.Ant").ToString.ToDouble, 0.0) + Dim SubTotal As Decimal = Row("SubTotal").ToString.ToDecimal + Dim IVA As Decimal = Row("IVA").ToString.ToDecimal + Dim Total As Decimal = Row("Total").ToString.ToDecimal + Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal + Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero + Dim RetIVA As Decimal = Row("Ret IVA").ToString.ToDecimal + Dim RetISR As Double = Row("Ret ISR").ToString.ToDouble + Dim Moneda As String = Row("Moneda").ToString + Dim TipoCambio As String = Row("Tipo Cambio").ToString Dim CveMoneda As Integer = 1 - Dim Vendedor As String = If(dt.Columns.Contains("Vendedor"), Row("Vendedor").ToString(), "") + Dim Vendedor As String = If(dt.Columns.Contains("Vendedor"), Row("Vendedor").ToString, "") Dim CveVendedor As Integer = 0 - Dim IEPS As Decimal = 0 'Row("IEPS").ToString().ToDecimal - Dim CveClienteSucursal As Integer = 0 'Row("CveClienteSucursal").ToString().ToEntero() - Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString(), "") - Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString().ToDecimal, 4), 0) - Dim PorcentajeRetIVA As Decimal = If(dt.Columns.Contains("PorcentajeRetIVA"), Round(Row("PorcentajeRetIVA").ToString().ToDecimal, 4), 0) + Dim IEPS As Decimal = 0 'Row("IEPS").ToString.ToDecimal + Dim CveClienteSucursal As Integer = 0 'Row("CveClienteSucursal").ToString.ToEntero + Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString, "") + Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString.ToDecimal, 4), 0) + Dim PorcentajeRetIVA As Decimal = If(dt.Columns.Contains("PorcentajeRetIVA"), Round(Row("PorcentajeRetIVA").ToString.ToDecimal, 4), 0) - Dim PedidoContrato As String = If(dt.Columns.Contains("Pedido"), Row("Pedido").ToString(), "") + Dim PedidoContrato As String = If(dt.Columns.Contains("Pedido"), Row("Pedido").ToString, "") - GuardaLog(Sucursal + "-" + Row("Folio").ToString()) + GuardaLog(Sucursal + "-" + Row("Folio").ToString) 'Temporalmente SE BORRARA - Dim Transaccion As String = "" ' Row("Transaccion2").ToString() - Dim Folio2 As String = "" ' Row("Folio2").ToString() - Dim CodCliente As String = "" 'Row("CodCliente2").ToString() + Dim Transaccion As String = "" ' Row("Transaccion2").ToString + Dim Folio2 As String = "" ' Row("Folio2").ToString + Dim CodCliente As String = "" 'Row("CodCliente2").ToString 'If Not CveCliente > 0 Then Alert(String.Format("No se encontró el cliente con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorVentas = True : RFC.GuardaLog : Exit For - TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESO", "INGRESOS", "ING"), "Ing", IIf(TipoDocto.ToUpper.Contiene("EGRESO", "EGRESOS", "EGS"), "Egs", "Rem")).ToString() + TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESO", "INGRESOS", "ING"), "Ing", IIf(TipoDocto.ToUpper.Contiene("EGRESO", "EGRESOS", "EGS"), "Egs", "Rem")).ToString 'PrePóliza Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Venta/SaldoInicial", 1, Total, Total, 1, Fecha, String.Format("{0}-{1}", Serie, Folio), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If Vendedor <> "" Then - CveVendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString().ToEntero() + CveVendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString.ToEntero If Not CveVendedor > 0 Then CveVendedor = 0 Else CveVendedor = 0 @@ -1702,17 +1961,17 @@ Partial Class General_SaldosIniciales If TipoDocto.Contiene("Ing", "Egs", "Rem") Then GuardaLog(Serie & "-" & Folio) - If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero(), CveClienteSucursal, SubTotal, 0, Amortizacion, IVA, RetIVA, RetISR, Total, CveMoneda, TipoCambio.ToDouble, + If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero, CveClienteSucursal, SubTotal, 0, Amortizacion, IVA, RetIVA, RetISR, Total, CveMoneda, TipoCambio.ToDouble, 0, 0, 0, FechaVencimiento, Fecha, "", "", Fecha, CveVendedor, Folio2, "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, 0, CvePrePoliza, - UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero(), CveSubProyectoEjecucion:=Sucursal.ToEntero(), - CveSubProyectoCobranza:=Sucursal.ToEntero(), IEPS:=IEPS, + UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero, CveSubProyectoEjecucion:=Sucursal.ToEntero, + CveSubProyectoCobranza:=Sucursal.ToEntero, IEPS:=IEPS, ObservacionesAlmacen:=Transaccion, Entrega:=CodCliente, ImpuestoLocal:=ImpuestoLocal, PedidoContrato:=PedidoContrato) Then ErrorVentas = True Exit For End If CveVenta = ObjVentas.CveVenta - If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA) Then + If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero, 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA) Then ErrorVentas = True Exit For End If @@ -1735,39 +1994,39 @@ Partial Class General_SaldosIniciales If UsuarioActual.CveEmpresa.Contiene(119, 158) Then UsaComplementaria = True 'PrePólizaDetalle - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString(), 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=Sucursal.ToEntero(), PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString(), ConceptoContable, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=Sucursal.ToEntero, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString, ConceptoContable, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For If IVA > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, Folio.ToString(), 13, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IVA, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IVA, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For End If - 'If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio.ToString(), 38, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS) Then ErrorVentas = True : Exit For + 'If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio.ToString, 38, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS) Then ErrorVentas = True : Exit For If RetIVA > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, Folio.ToString(), 8, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=RetIVA, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, Folio.ToString, 8, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=RetIVA, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For End If If ImpuestoLocal > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, Folio.ToString(), 27, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImpuestoLocal, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, Folio.ToString, 27, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImpuestoLocal, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For End If If UsaComplementaria Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Folio.ToString(), 203, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, ImporteMX:=Total * TipoCambio.ToDecimal - Total, TipoCambio:=TipoCambio.ToDecimal, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Folio.ToString, 203, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, ImporteMX:=Total * TipoCambio.ToDecimal - Total, TipoCambio:=TipoCambio.ToDecimal, Contabilizable:=False) Then ErrorVentas = True : Exit For End If 'Saldo If Saldo < Total Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio.ToString(), ConceptoContablePago, Folio.ToString(), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total - Saldo, CveVentaAmortizacion:=CveVenta, Contabilizable:=False) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio.ToString(), 95, Folio.ToString(), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total - Saldo, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio.ToString, ConceptoContablePago, Folio.ToString, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total - Saldo, CveVentaAmortizacion:=CveVenta, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio.ToString, 95, Folio.ToString, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total - Saldo, Contabilizable:=False) Then ErrorVentas = True : Exit For End If Else 'ANTICIPOS - Dim CveIE As Integer = ObjIE.AddBancos_IE(1, 1, Fecha, Folio.ToString(), "", Total, 1, + Dim CveIE As Integer = ObjIE.AddBancos_IE(1, 1, Fecha, Folio.ToString, "", Total, 1, 1, "Anticipo Cliente", "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString(), 30, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString(), 66, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString, 30, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 66, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For End If Encontrados = Encontrados + 1 @@ -1815,13 +2074,13 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim Codigo As String = Row("Código").ToString() - Dim Descripcion As String = Row("Descripción").ToString() + Dim Codigo As String = Row("Código").ToString + Dim Descripcion As String = Row("Descripción").ToString - Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = Row("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then Row("CveCuentaContable") = CveCuentaContable @@ -1848,30 +2107,30 @@ Partial Class General_SaldosIniciales Dim NumRow As Integer = 0 For Each Row As DataRow In dt.FiltraParametros("Descripción <> ''").Rows - Dim Codigo As String = Row("Código").ToString() - Dim Descripcion As String = Row("Descripción").ToString() - Dim TipoAF As String = Row("Tipo").ToString().Trim - Dim SubTipo As String = Row("SubTipo").ToString().Trim - Dim Valor As Decimal = Row("Valor de compra").ToString().ToDecimal - Dim FechaAF As Date = Row("Fecha de compra").ToString().ToDate - Dim NumeroSerie As String = Row("No. Serie").ToString() - Dim Año As Integer = Row("Año").ToString().ToEntero() - Dim CuentaContable As String = Row("Cuenta Contable").ToString() - Dim Estado As String = Row("Estado").ToString() - Dim Proyecto As String = Row("Proyecto").ToString() - Dim SubProyecto As String = Row("SubProyecto").ToString() - Dim Cliente As String = Row("Cliente").ToString() - Dim Observaciones As String = Row("Observaciones").ToString() - Dim CtaDepreciacion As Integer = Row("Cuenta Depreciación").ToString().ToEntero() - Dim PorcentajeDepreciacion As Decimal = Row("% Depreciación").ToString().ToDecimal + Dim Codigo As String = Row("Código").ToString + Dim Descripcion As String = Row("Descripción").ToString + Dim TipoAF As String = Row("Tipo").ToString.Trim + Dim SubTipo As String = Row("SubTipo").ToString.Trim + Dim Valor As Decimal = Row("Valor de compra").ToString.ToDecimal + Dim FechaAF As Date = Row("Fecha de compra").ToString.ToDate + Dim NumeroSerie As String = Row("No. Serie").ToString + Dim Año As Integer = Row("Año").ToString.ToEntero + Dim CuentaContable As String = Row("Cuenta Contable").ToString + Dim Estado As String = Row("Estado").ToString + Dim Proyecto As String = Row("Proyecto").ToString + Dim SubProyecto As String = Row("SubProyecto").ToString + Dim Cliente As String = Row("Cliente").ToString + Dim Observaciones As String = Row("Observaciones").ToString + Dim CtaDepreciacion As Integer = Row("Cuenta Depreciación").ToString.ToEntero + Dim PorcentajeDepreciacion As Decimal = Row("% Depreciación").ToString.ToDecimal 'CLAVES - Dim CveAF As Integer = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveActivoFijo", $"Codigo = '{Codigo}'").ToString().ToEntero() - Dim CveSubTipoAF As Integer = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubTipoActivoFijo", $"TipoActivoFijo = '{TipoAF}'").ToString().ToEntero() - Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{SubProyecto}'").ToString().ToEntero() - Dim CveEstadoActivoFijo As Integer = GlobalDTEstadoActivoFijo().FiltroPrimeroValor("CveEstadoActivoFijo", $"EstadoActivoFijo = '{Estado}'").ToString().ToEntero() - Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"Nombre = '{Cliente}'").ToString().ToEntero() - Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero() + Dim CveAF As Integer = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveActivoFijo", $"Codigo = '{Codigo}'").ToString.ToEntero + Dim CveSubTipoAF As Integer = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubTipoActivoFijo", $"TipoActivoFijo = '{TipoAF}'").ToString.ToEntero + Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{SubProyecto}'").ToString.ToEntero + Dim CveEstadoActivoFijo As Integer = GlobalDTEstadoActivoFijo().FiltroPrimeroValor("CveEstadoActivoFijo", $"EstadoActivoFijo = '{Estado}'").ToString.ToEntero + Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"Nombre = '{Cliente}'").ToString.ToEntero + Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString.ToEntero 'VALIDACIONES @@ -1953,18 +2212,18 @@ Partial Class General_SaldosIniciales Dim CuentaPadre As String = "" For Each Row As DataRow In dt.Rows - NombreCuenta = Row("NombreCuenta").ToString() - CuentaPadre = Row("CuentaPadre").ToString() - Dim Cuenta As String = Row("Cuenta").ToString() - Dim TipoCuenta As String = Row("TipoCuenta").ToString() - Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString() + NombreCuenta = Row("NombreCuenta").ToString + CuentaPadre = Row("CuentaPadre").ToString + Dim Cuenta As String = Row("Cuenta").ToString + Dim TipoCuenta As String = Row("TipoCuenta").ToString + Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString Dim CveCuentaPadre As Integer = -1 If NombreCuenta <> "" Then If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero() + CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero Else TieneError = True Exit For @@ -1974,7 +2233,7 @@ Partial Class General_SaldosIniciales Exit For End If - Dim IdNew = ObjConta.AddCuenta(Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 0, 1, 0, "", 0, CveCuentaPadre, AgrupadorSAT.ToEntero()) + Dim IdNew = ObjConta.AddCuenta(Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 0, 1, 0, "", 0, CveCuentaPadre, AgrupadorSAT.ToEntero) If IdNew > 0 Then ContadorUpdate = ContadorUpdate + 1 Else @@ -2012,30 +2271,45 @@ Partial Class General_SaldosIniciales Dim NombreCuenta As String = "" Dim CuentaPadre As String = "" + Dim SbMsgError As New StringBuilder + + If Not ValidaCuentasSaldoInicial(ObjConta, NombreCuenta) Then + SbMsgError.AppendFormat("No se pudo validar las cuentas principales.") + TieneError = True + End If + Dim AgrupadoresSAT As DataTable = New DataTable - If ObjConta.GetAgrupadoresSAT() Then + If Not TieneError AndAlso ObjConta.GetAgrupadoresSAT() Then AgrupadoresSAT = ObjConta.DtResultados End If - If AgrupadoresSAT.Rows.Count > 0 Then - + If AgrupadoresSAT.Rows.Count > 0 AndAlso Not TieneError Then For Each Row As DataRow In dt.Rows - Dim Cuenta As String = Row("Cuenta").ToString().Trim.Replace("-", "") + Dim Cuenta As String = Row("Cuenta").ToString.Trim.Replace("-", "") If Cuenta <> "" Then - NombreCuenta = Row("NombreCuenta").ToString().Trim - CuentaPadre = Row("CuentaPadre").ToString().Trim.Replace("-", "") + NombreCuenta = Row("NombreCuenta").ToString.Trim + CuentaPadre = Row("CuentaPadre").ToString.Trim.Replace("-", "") - Dim TipoCuenta As String = Row("TipoCuenta").ToString().Trim - Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString().Trim + Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim + Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim Dim CveCuentaPadre As Integer = -1 - Dim CveAgrupadorSAT As Integer = If(AgrupadorSAT = "0", -1, AgrupadoresSAT.FiltroPrimeroValor("CveAgrupadorSAT", String.Format("CodigoNombre LIKE '%{0}%'", AgrupadorSAT)).ToEntero()) + Dim CveAgrupadorSAT As Integer = If(AgrupadorSAT = "0", -1, AgrupadoresSAT.FiltroPrimeroValor("CveAgrupadorSAT", String.Format("CodigoNombre LIKE '%{0}%'", AgrupadorSAT)).ToEntero) + + If Not String.IsNullOrEmpty(Row("AgrupadorSAT").ToString()) AndAlso AgrupadorSAT.ToDecimal() > 0 Then + If CveAgrupadorSAT <= 0 Then + SbMsgError.AppendFormat("El agrupador SAT '{0}' no existe.", AgrupadorSAT) + TieneError = True + Exit For + End If + End If If Not CuentaPadre = "" Then If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero() + CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero Else + SbMsgError.AppendFormat("La cuenta padre '{0}' no existe.", CuentaPadre) TieneError = True Exit For End If @@ -2062,11 +2336,12 @@ Partial Class General_SaldosIniciales Alert("No se tienen asociados Agrupadores para esta empresa") TieneError = True End If + If Not TieneError Then ObjConta.Commit() Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.") Else - Alert($"No pudimos agregar la cuenta en ContaSIG: {NombreCuenta} - Cuenta Padre: {CuentaPadre}", TipoMensaje.MsgError) + Alert($"No pudimos agregar la cuenta en ContaSIG:
{NombreCuenta} - Cuenta Padre: {CuentaPadre}. {SbMsgError.ToString()}", TipoMensaje.MsgError) ObjConta.RollBack() End If @@ -2095,10 +2370,10 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - NombreCuenta = Row("NombreCuenta").ToString() - Cuenta = Row("Cuenta").ToString() - Dim TipoCuenta As String = Row("TipoCuenta").ToString() - Dim Importe As Double = Row("Importe").ToString().ToDouble + NombreCuenta = Row("NombreCuenta").ToString + Cuenta = Row("Cuenta").ToString + Dim TipoCuenta As String = Row("TipoCuenta").ToString + Dim Importe As Double = Row("Importe").ToString.ToDouble Dim IdCuenta As Integer = -1 Dim CargoAbono As Boolean = True Dim YaExiste As Boolean = False @@ -2106,7 +2381,7 @@ Partial Class General_SaldosIniciales If ObjConta.GetCuentas(-1, Cuenta.Replace("-", ""), 1) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero() + IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero TipoCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Tipo") Else Reporte.AppendLine($"{Cuenta} - {NombreCuenta} - {Importe}
") @@ -2142,7 +2417,7 @@ Partial Class General_SaldosIniciales Alert($"Se agregó la póliza {IdPoliza}") Else - Alert($"No encontraron las siguientes cuentas: {Reporte.ToString()} ", TipoMensaje.MsgError) + Alert($"No encontraron las siguientes cuentas: {Reporte.ToString} ", TipoMensaje.MsgError) ObjConta.RollBack() End If @@ -2169,14 +2444,14 @@ Partial Class General_SaldosIniciales CvePrePoliza = ObjConta.AddPrePolizas("SI", 1, 0, 0, 1, TxtFecha.Text.ToDate, "Saldos Iniciales", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) For Each Row As DataRow In dt.FiltraParametros("Cuenta <> '' ").Rows - NombreCuenta = Row("NombreCuenta").ToString() - Cuenta = Row("Cuenta").ToString() + NombreCuenta = Row("NombreCuenta").ToString + Cuenta = Row("Cuenta").ToString - Dim Importe As Decimal = If(Row("Cargo").ToString().ToDecimal <> 0, Row("Cargo").ToString().ToDecimal, Row("Abono").ToString().ToDecimal) - Dim Concepto As String = Row("Concepto").ToString() + Dim Importe As Decimal = If(Row("Cargo").ToString.ToDecimal <> 0, Row("Cargo").ToString.ToDecimal, Row("Abono").ToString.ToDecimal) + Dim Concepto As String = Row("Concepto").ToString Dim IdCuenta As Integer = -1 Dim CveSubProyecto As Integer = -1 - Dim TipoMovto As Boolean = If(Row("Cargo").ToString().ToDecimal <> 0, False, True) + Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True) Dim YaExiste As Boolean = False Dim DataTemp As DataTable Dim Afectable As Boolean = False @@ -2185,7 +2460,7 @@ Partial Class General_SaldosIniciales Cuenta = Cuenta.Replace(" ", "") If ObjConta.GetCuentas(-1, Cuenta.Replace("-", "").Trim, -1, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero() + IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero Afectable = ObjConta.DtResultados().FiltroPrimeroValor("Afectable") = "True" Else Reporte.AppendLine($"{Cuenta} - {NombreCuenta} - {Importe}
") @@ -2197,10 +2472,10 @@ Partial Class General_SaldosIniciales Exit For End If - Dim SubP As String = Row("SubProyecto").ToString().Trim + Dim SubP As String = Row("SubProyecto").ToString.Trim If SubP <> "" AndAlso SubP <> "-" Then DataTemp = SubProTemp.FiltraParametros(String.Format("SubProyecto = '{0}'", SubP)) - CveSubProyecto = DataTemp.FiltroPrimeroValor("CveSubProyecto", "").ToEntero() + CveSubProyecto = DataTemp.FiltroPrimeroValor("CveSubProyecto", "").ToEntero If CveSubProyecto <= 0 Then Reporte.AppendLine($"'{SubP}' - no se encontró en los subproyectos
") TieneError = True @@ -2236,7 +2511,7 @@ Partial Class General_SaldosIniciales Alert($"Se agregó la póliza {ObjConta.ContaFolio}") Else - Alert($"No encontraron las siguientes cuentas: {Reporte.ToString()} ", TipoMensaje.MsgError) + Alert($"No encontraron las siguientes cuentas: {Reporte.ToString} ", TipoMensaje.MsgError) ObjConta.RollBack() End If @@ -2259,11 +2534,11 @@ Partial Class General_SaldosIniciales Dim Fecha As DateTime = (TxtFecha.Text).ToDate Try For Each almacenSinRepetir As DataRow In dt.FiltraParametros("Almacen <> ''", DistinctColumns:={"Almacen"}).Rows - Dim almacenActual As String = almacenSinRepetir("Almacen").ToString().Trim - Dim CveAlmacen As Integer = AlmacenRef.FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero() + Dim almacenActual As String = almacenSinRepetir("Almacen").ToString.Trim + Dim CveAlmacen As Integer = AlmacenRef.FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero If CveAlmacen > 0 Then - Dim movimientoCabecera As Integer = ObjMovimientos.AddMovimiento(CveAlmacen, DdlConceptoAlmacen.SelectedValue.ToEntero(), 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) + Dim movimientoCabecera As Integer = ObjMovimientos.AddMovimiento(CveAlmacen, DdlConceptoAlmacen.SelectedValue.ToEntero, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) listadoMovimientos += $"movimiento con folio {ObjMovimientos.Folio}
" If movimientoCabecera > 0 Then @@ -2271,12 +2546,12 @@ Partial Class General_SaldosIniciales contadorMovimientos += 1 Dim RowPS As DataRow = ProductosServiciosRef.FiltroPrimero($"Codigo = '{nuevaEntrada("CodigoPS")}' AND CveEmpresa = {UsuarioActual.CveEmpresa}") If RowPS IsNot Nothing Then - Dim CvePS As Integer = RowPS("CvePS").ToString().ToEntero() - Dim CveUM As Integer = RowPS("CveUnidadMedida").ToString().ToEntero() + Dim CvePS As Integer = RowPS("CvePS").ToString().ToEntero + Dim CveUM As Integer = RowPS("CveUnidadMedida").ToString().ToEntero If CveUM > 0 Then - Dim Cantidad As Decimal = nuevaEntrada("Existencia").ToString().ToDecimal - Dim Valor As Decimal = nuevaEntrada("Valor").ToString().ToDecimal - Dim Serie As String = If(dt.Columns.Contains("Serie"), nuevaEntrada("Serie").ToString().Trim, "") + Dim Cantidad As Decimal = nuevaEntrada("Existencia").ToString.ToDecimal + Dim Valor As Decimal = nuevaEntrada("Valor").ToString.ToDecimal + Dim Serie As String = If(dt.Columns.Contains("Serie"), nuevaEntrada("Serie").ToString.Trim, "") If Not ObjMovimientos.AddMovimientoDetalle(movimientoCabecera, Cantidad, CveUM, CvePS, (Valor / Cantidad), -1, -1, Serie:=Serie) Then mensajeError = "No se logró generar el detalle del movimiento" @@ -2365,26 +2640,26 @@ Partial Class General_SaldosIniciales DTClasificaiones.CaseSensitive = False - For Each dRow As DataRow In dt.FiltraParametros(" LEN(Clasificacion) > 0 ").Rows + For Each dRow As DataRow In dt.Rows - Dim Clasificacion As String = Regex.Replace(dRow("Clasificacion").ToString().Trim.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, ""), "[^\u0009\u000A\u000D\u0020-\u007E]", "") - Dim Categoria As String = dRow("Categoria").ToString().Trim.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") - Dim UsoClasificacion As String = dRow("UsoClasificacion").ToString().Trim.ToUpper.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") - Dim CuentaContableIngreso As String = dRow("CuentaContableIngreso").ToString().Trim.Replace("-", "").Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") - Dim CuentaContableGasto As String = dRow("CuentaContableGasto").ToString().Trim.Replace("-", "").Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") + Dim Clasificacion As String = dRow("Clasificacion").ToString.Trim + Dim Categoria As String = dRow("Categoria").ToString.Trim + Dim UsoClasificacion As String = dRow("UsoClasificacion").ToString.Trim.ToUpper + Dim CuentaContableIngreso As String = dRow("CuentaContableIngreso").ToString.Trim.Replace("-", "") + Dim CuentaContableGasto As String = dRow("CuentaContableGasto").ToString.Trim.Replace("-", "") Dim CveClasificacion As Integer = -1 Dim CveUsoClasificacion As Integer = -1 Dim CveCategoria As Integer = -1 - CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", $" Categoria = '{Categoria}' ").ToEntero() + CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", $" Categoria = '{Categoria}' ").ToEntero If Not CveCategoria > 0 Then - CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToEntero() + CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToEntero If Not CveCategoria > 0 Then Alert($"Clasificación {Clasificacion} la categoria {Categoria} no es valida.", TipoMensaje.MsgAdvertencia) ErrorProceso = True @@ -2408,8 +2683,8 @@ Partial Class General_SaldosIniciales Exit For End If - Dim CveCuentaContableIngreso As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableIngreso}'").ToEntero() - Dim CveCuentaContableGasto As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableGasto}'").ToEntero() + Dim CveCuentaContableIngreso As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableIngreso}'").ToEntero + Dim CveCuentaContableGasto As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableGasto}'").ToEntero If CuentaContableIngreso.Trim.Length > 0 AndAlso CveCuentaContableIngreso <= 0 Then Alert($"Clasificación {Clasificacion} no se encontro la cuenta de ingreso {CuentaContableIngreso}.", TipoMensaje.MsgAdvertencia) @@ -2422,7 +2697,7 @@ Partial Class General_SaldosIniciales End If - Dim CveClasificaionTemp = DTClasificaiones.FiltroPrimeroValor("CveClasificacion", $"Clasificacion='{Clasificacion}'").ToEntero() + Dim CveClasificaionTemp = DTClasificaiones.FiltroPrimeroValor("CveClasificacion", $"Clasificacion='{Clasificacion}'").ToEntero If CveClasificaionTemp > 0 Then CveClasificacion = CveClasificaionTemp @@ -2441,19 +2716,13 @@ Partial Class General_SaldosIniciales Else ErrorProceso = True End If - Else - - If Not ObjClasificaciones.UpdateClasificacion(Clasificacion, "-1", -1, "-1", -1, "-1", -1, "-1", True, True, CveCategoria, UsuarioActual.CveUsuario, CveClasificacion, UsoClasificacion:=CveUsoClasificacion) Then - ErrorProceso = True - End If - End If If Not ErrorProceso Then If CveCuentaContableIngreso > 0 Then - If Not AsignacionCuenta(ObjConta, 4, CveCuentaContableIngreso, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion, OpActualizarClasificacion:=True) Then + If Not AsignacionCuenta(ObjConta, 4, CveCuentaContableIngreso, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion) Then ErrorProceso = True Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia) Exit For @@ -2461,7 +2730,7 @@ Partial Class General_SaldosIniciales End If If CveCuentaContableGasto > 0 Then - If Not AsignacionCuenta(ObjConta, 6, CveCuentaContableGasto, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion, OpActualizarClasificacion:=True) Then + If Not AsignacionCuenta(ObjConta, 6, CveCuentaContableGasto, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion) Then ErrorProceso = True Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia) Exit For @@ -2502,17 +2771,17 @@ Partial Class General_SaldosIniciales Dim Contador As Integer = 0 For Each dRow As DataRow In DTBancos.Rows - Dim Fecha As Date = dRow("Fecha").ToString().ToDate - Dim Importe As Decimal = dRow("Importe").ToString().ToDecimal - Dim Descripcion As String = dRow("Descripcion").ToString() - Dim Banco As String = dRow("Banco").ToString() - Dim NumCuenta As String = dRow("CuentaBancaria").ToString().Trim + Dim Fecha As Date = dRow("Fecha").ToString.ToDate + Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal + Dim Descripcion As String = dRow("Descripcion").ToString + Dim Banco As String = dRow("Banco").ToString + Dim NumCuenta As String = dRow("CuentaBancaria").ToString.Trim Dim ImporteMX As Decimal = 0 Dim ImporteME As Decimal = 0 - Dim Moneda As String = dRow("Moneda").ToString() + Dim Moneda As String = dRow("Moneda").ToString Dim CveMoneda As Integer - Dim TipoCambio As Decimal = dRow("TipoCambio").ToString().ToDecimal + Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then CveMoneda = 1 @@ -2543,11 +2812,11 @@ Partial Class General_SaldosIniciales Dim CveTipoTransaccion As Integer = 3 ' tipo transaccion, cheque recibido - Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=-1).FiltroPrimeroValor("CveCuenta", $" NumCuenta = '{NumCuenta}'").ToEntero() + Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=-1).FiltroPrimeroValor("CveCuenta", $" NumCuenta = '{NumCuenta}'").ToEntero If Not CveCuentaBancaria > 0 Then ' se registrará primero - Dim CveBanco As Integer = GlobalDTBancos().FiltroPrimeroValor("CveBanco", String.Format("CveEmpresa = {0} AND Banco = '{1}'", UsuarioActual.CveEmpresa, Banco)).ToEntero() + Dim CveBanco As Integer = GlobalDTBancos().FiltroPrimeroValor("CveBanco", String.Format("CveEmpresa = {0} AND Banco = '{1}'", UsuarioActual.CveEmpresa, Banco)).ToEntero If CveBanco > 0 Then Dim CveTipoCuenta As Integer = 2 'tipo de cheques @@ -2570,11 +2839,11 @@ Partial Class General_SaldosIniciales FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, CveTipoTransaccion)) Dim CveCuentaContable As Integer = 0 - Dim CuentaContable As String = dRow("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then dRow("CveCuentaContable") = CveCuentaContable @@ -2603,11 +2872,11 @@ Partial Class General_SaldosIniciales ErrorProceso = True : Exit For End If - Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, CveTipoTransaccion, Fecha, FolioStr.ToString(), "", Importe, CveMoneda, + Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, CveTipoTransaccion, Fecha, FolioStr.ToString, "", Importe, CveMoneda, TipoCambio, Descripcion, "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString(), 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString(), 95, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString, 95, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For End If @@ -2628,7 +2897,7 @@ Partial Class General_SaldosIniciales Private Sub ProcesaAnticipoProveedor(DtAnticipoProveedor As DataTable, DTCuentasContables As DataTable) Dim ErrorProceso As Boolean = False - Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero() + Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero If Not CveCuentaBancaria > 0 Then Alert("No se detecto una cuenta Bancaria", TipoMensaje.MsgAdvertencia) @@ -2647,15 +2916,15 @@ Partial Class General_SaldosIniciales For Each dRow As DataRow In DtAnticipoProveedor.Rows - Dim Fecha As Date = dRow("Fecha").ToString().ToDate - Dim Importe As Decimal = dRow("Importe").ToString().ToDecimal + Dim Fecha As Date = dRow("Fecha").ToString.ToDate + Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal Dim ImporteMX As Decimal = 0 Dim ImporteME As Decimal = 0 - Dim Descripcion As String = dRow("Descripcion").ToString() - Dim RFC As String = dRow("RFC").ToString() - Dim Moneda As String = dRow("Moneda").ToString() + Dim Descripcion As String = dRow("Descripcion").ToString + Dim RFC As String = dRow("RFC").ToString + Dim Moneda As String = dRow("Moneda").ToString Dim CveMoneda As Integer - Dim TipoCambio As Decimal = dRow("TipoCambio").ToString().ToDecimal + Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal @@ -2691,7 +2960,7 @@ Partial Class General_SaldosIniciales Dim FolioStr As String = "" FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 1) + Contador) - Dim CveProveedor As Integer = GlobalDTCompProveedores(CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $" RFC = '{RFC}' ").ToEntero() + Dim CveProveedor As Integer = GlobalDTCompProveedores(CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $" RFC = '{RFC}' ").ToEntero If Not CveProveedor > 0 Then @@ -2701,10 +2970,10 @@ Partial Class General_SaldosIniciales End If Dim CveCuentaContable As Integer = 0 - Dim CuentaContable As String = dRow("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then @@ -2736,11 +3005,11 @@ Partial Class General_SaldosIniciales End If - Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 1, Fecha, FolioStr.ToString(), "", Importe, CveMoneda, + Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 1, Fecha, FolioStr.ToString, "", Importe, CveMoneda, TipoCambio, Descripcion, "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString(), 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString(), 10, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString, 10, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For Contador = Contador + 1 Next @@ -2760,7 +3029,7 @@ Partial Class General_SaldosIniciales Private Sub ProcesaAnticipoCliente(DTAnticipoCliente As DataTable, DTCuentasContables As DataTable) Dim ErrorProceso As Boolean = False - Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero() + Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero If Not CveCuentaBancaria > 0 Then Alert("No se detecto una cuenta Bancaria", TipoMensaje.MsgAdvertencia) @@ -2779,15 +3048,15 @@ Partial Class General_SaldosIniciales For Each dRow As DataRow In DTAnticipoCliente.Rows - Dim Fecha As Date = dRow("Fecha").ToString().ToDate - Dim Importe As Decimal = dRow("Importe").ToString().ToDecimal + Dim Fecha As Date = dRow("Fecha").ToString.ToDate + Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal Dim ImporteMX As Decimal = 0 Dim ImporteME As Decimal = 0 - Dim Descripcion As String = dRow("Descripcion").ToString() - Dim RFC As String = dRow("RFC").ToString() - Dim Moneda As String = dRow("Moneda").ToString() + Dim Descripcion As String = dRow("Descripcion").ToString + Dim RFC As String = dRow("RFC").ToString + Dim Moneda As String = dRow("Moneda").ToString Dim CveMoneda As Integer - Dim TipoCambio As Decimal = dRow("TipoCambio").ToString().ToDecimal + Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then CveMoneda = 1 @@ -2820,7 +3089,7 @@ Partial Class General_SaldosIniciales Dim FolioStr As String = "" FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 3) + Contador) - Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCliente", $" RFC = '{RFC}' ").ToEntero() + Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCliente", $" RFC = '{RFC}' ").ToEntero If Not CveCliente > 0 Then @@ -2830,12 +3099,12 @@ Partial Class General_SaldosIniciales End If - 'Dim RazonSocial As String = Row("RazonSocial").ToString() + 'Dim RazonSocial As String = Row("RazonSocial").ToString Dim CveCuentaContable As Integer = 0 - Dim CuentaContable As String = dRow("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then @@ -2867,11 +3136,11 @@ Partial Class General_SaldosIniciales End If - Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 3, Fecha, FolioStr.ToString(), "", Importe, CveMoneda, + Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 3, Fecha, FolioStr.ToString, "", Importe, CveMoneda, TipoCambio, Descripcion, "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString(), 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString(), 66, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString, 66, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For Contador = Contador + 1 Next @@ -2896,7 +3165,7 @@ Partial Class General_SaldosIniciales Private Function AsignacionCuenta(ObjContabilidad As ClsContabilidad, CveConceptoContable As Integer, CveCuentaContable As Integer, CveBancoCuenta As Integer, CveProveedor As Integer, CveCliente As Integer, - CvePersonal As Integer, CveEmpresa As Integer, CveClasificacion As Integer, Optional OpActualizarClasificacion As Boolean = False) As Boolean + CvePersonal As Integer, CveEmpresa As Integer, CveClasificacion As Integer) As Boolean Dim Respuesta As Boolean = False @@ -2904,7 +3173,7 @@ Partial Class General_SaldosIniciales If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, CveEmpresa, CveCuentaContable, -1, CveProveedor, CveCliente, CvePersonal, CveClasificacion, -1, 0, CveBancoCuenta:=CveBancoCuenta, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1, - CveTipoGasto:=-1, RegeneraCuenta:=False, OpActualizarClasificacion:=OpActualizarClasificacion) Then + CveTipoGasto:=-1, RegeneraCuenta:=False) Then Respuesta = True End If @@ -3187,15 +3456,15 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString() - Dim ApellidoMaterno As String = Row("Apellido Materno").ToString() - Dim Nombre As String = Row("Nombre").ToString() + Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString + Dim ApellidoMaterno As String = Row("Apellido Materno").ToString + Dim Nombre As String = Row("Nombre").ToString - Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = Row("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then - Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() + Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero If CveCuentaContable > 0 Then Row("CveCuentaContable") = CveCuentaContable @@ -3222,10 +3491,7 @@ Partial Class General_SaldosIniciales Dim dTDepartamentos As New DataTable Dim dTTurno As New DataTable Dim ObjRH As New ClsRH - Dim dtTipoTrabajador As New DataTable - If (ObjRH.TiposTrabajadorGet(-1, UsuarioActual.CveEmpresa)) Then - dtTipoTrabajador = ObjRH.DtResultados - End If + Dim dtpuestos = GlobalDTRHPuestos(UsuarioActual.CveEmpresa) dtpuestos.CaseSensitive = False If ObjRH.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, -1) Then @@ -3248,46 +3514,45 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows Dim myarraystr As String() Dim RegistroPatronal As String = Row("Registro Patronal").ToString().ToUpper() - Dim Codigo As String = Row("Código").ToString() - Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString() - Dim ApellidoMaterno As String = Row("Apellido Materno").ToString() - Dim Nombre As String = Row("Nombre").ToString() - Dim CorreoElectronico As String = Row("Correo Electronico").ToString() - Dim FechaIngreso As String = Row("Fecha Ingreso").ToString() - Dim FechaBaja As String = Row("Fecha Baja").ToString() - Dim NumeroSS As String = Row("Numero SS").ToString() - Dim AltaIMSS As String = Row("Alta IMSS").ToString() - Dim SalarioDiario As String = Row("Salario Diario").ToString() - Dim Direccion As String = Row("Dirección").ToString() - Dim FechaNacimiento As String = Row("Fecha Nacimiento").ToString() - Dim LugarNacimiento As String = Row("Lugar Nacimiento").ToString() - Dim Sexo As String = Row("Sexo").ToString() - Dim CodigoPostal As String = Row("Código Postal").ToString() - Dim Ciudad As String = Row("Ciudad").ToString() - Dim EstadoCivil As String = Row("Estado Civil").ToString().ToUpper - Dim Telefono As String = Row("Teléfono").ToString() - Dim Celular As String = Row("Celular").ToString() - Dim RFC As String = Row("RFC").ToString() - Dim CURP As String = Row("CURP").ToString() - Dim ClabeInterbancaria As String = Row("CLABE").ToString() - Dim EstatusPersonal As String = Row("Estatus Personal").ToString().ToUpper - Dim SubProyecto As String = Row("SubProyecto").ToString().ToUpper + Dim Codigo As String = Row("Código").ToString + Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString + Dim ApellidoMaterno As String = Row("Apellido Materno").ToString + Dim Nombre As String = Row("Nombre").ToString + Dim CorreoElectronico As String = Row("Correo Electronico").ToString + Dim FechaIngreso As String = Row("Fecha Ingreso").ToString + Dim FechaBaja As String = Row("Fecha Baja").ToString + Dim NumeroSS As String = Row("Numero SS").ToString + Dim AltaIMSS As String = Row("Alta IMSS").ToString + Dim SalarioDiario As String = Row("Salario Diario").ToString + Dim Direccion As String = Row("Dirección").ToString + Dim FechaNacimiento As String = Row("Fecha Nacimiento").ToString + Dim LugarNacimiento As String = Row("Lugar Nacimiento").ToString + Dim Sexo As String = Row("Sexo").ToString + Dim CodigoPostal As String = Row("Código Postal").ToString + Dim Ciudad As String = Row("Ciudad").ToString + Dim EstadoCivil As String = Row("Estado Civil").ToString.ToUpper + Dim Telefono As String = Row("Teléfono").ToString + Dim Celular As String = Row("Celular").ToString + Dim RFC As String = Row("RFC").ToString + Dim CURP As String = Row("CURP").ToString + Dim ClabeInterbancaria As String = Row("CLABE").ToString + Dim EstatusPersonal As String = Row("Estatus Personal").ToString.ToUpper + Dim SubProyecto As String = Row("SubProyecto").ToString.ToUpper 'Nuevas - Dim Estado As String = Row("Estado").ToString() - Dim NombrePadre As String = Row("Nombre Padre").ToString() - Dim NombreMadre As String = Row("Nombre Madre").ToString() - Dim Puesto As String = Row("Puesto").ToString() - Dim Turno As String = Row("Turno").ToString() - Dim TipoContrato As String = Row("Tipo Contrato").ToString() - Dim Departamento As String = Row("Departamento").ToString() - Dim TipoPeriodo As String = Row("Tipo Periodo").ToString() - Dim Escolaridad As String = Row("Escolaridad").ToString() - Dim SDI As String = Row("SDI").ToString() - Dim MetodoPago As String = Row("Metodo Pago").ToString() - Dim Nominista As String = Row("Nominista").ToString() - Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero() - Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal - Dim TipoTrabajador As String = Row("Tipo Trabajador").ToString() + Dim Estado As String = Row("Estado").ToString + Dim NombrePadre As String = Row("Nombre Padre").ToString + Dim NombreMadre As String = Row("Nombre Madre").ToString + Dim Puesto As String = Row("Puesto").ToString + Dim Turno As String = Row("Turno").ToString + Dim TipoContrato As String = Row("Tipo Contrato").ToString + Dim Departamento As String = Row("Departamento").ToString + Dim TipoPeriodo As String = Row("Tipo Periodo").ToString + Dim Escolaridad As String = Row("Escolaridad").ToString + Dim SDI As String = Row("SDI").ToString + Dim MetodoPago As String = Row("Metodo Pago").ToString + Dim Nominista As String = Row("Nominista").ToString + Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString.ToEntero + Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal Dim NombreCompleto As String = $"{Nombre} {ApellidoPaterno} {ApellidoMaterno}" @@ -3299,7 +3564,7 @@ Partial Class General_SaldosIniciales Dim CveGenero As Integer = 0 Dim CveEstadoCivil As Integer = 0 Dim CveEstatusPersonal As Integer = 0 - ' Dim CveSucursal As Integer = GlobalDTSucursales(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSucursal").ToString().ToEntero() + ' Dim CveSucursal As Integer = GlobalDTSucursales(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSucursal").ToString.ToEntero Dim CveRegistroPatronal As Integer Dim CvePuesto As Integer Dim CveTurno As Integer @@ -3311,22 +3576,17 @@ Partial Class General_SaldosIniciales Dim CveMetodoPago As Integer Dim CveUsuarioNomina As Integer Dim CveSubProyecto As Integer - Dim CveTipoTrabajador As Integer myarraystr = Puesto.Split(":"c) If (myarraystr.Length > 1) Then CvePuesto = myarraystr(0).ToEntero() - CvePuesto = dtpuestos.FiltroPrimeroValor("CvePuesto", $"(CvePuesto) = ({CvePuesto})").ToString().ToEntero() + CvePuesto = dtpuestos.FiltroPrimeroValor("CvePuesto", $"(CvePuesto) = ({CvePuesto})").ToString.ToEntero Else - CvePuesto = dtpuestos.FiltroPrimeroValor("CvePuesto", $"(Puesto) = ('{Puesto}')").ToString().ToEntero() + CvePuesto = dtpuestos.FiltroPrimeroValor("CvePuesto", $"(Puesto) = ('{Puesto}')").ToString.ToEntero End If - CveTipoTrabajador = dtTipoTrabajador.FiltroPrimeroValor("CveTipoTrabajador", $"(TipoTrabajador) = ('{TipoTrabajador}')").ToString().ToEntero() - If CveTipoTrabajador = 0 Then - CveTipoTrabajador = -1 - End If - CveRegistroPatronal = dtregistrospatronales.FiltroPrimeroValor("CveRegistroPatronal", $"(RegistroPatronal) = ('{RegistroPatronal}')").ToString().ToEntero() + CveRegistroPatronal = dtregistrospatronales.FiltroPrimeroValor("CveRegistroPatronal", $"(RegistroPatronal) = ('{RegistroPatronal}')").ToString.ToEntero If CvePuesto = 0 Then CvePuesto = -1 End If @@ -3334,9 +3594,9 @@ Partial Class General_SaldosIniciales myarraystr = Turno.Split(":"c) If (myarraystr.Length > 1) Then CveTurno = myarraystr(0).ToEntero() - CveTurno = dTTurno.FiltroPrimeroValor("CveTurno", $"CveTurno = {CveTurno}").ToString().ToEntero() + CveTurno = dTTurno.FiltroPrimeroValor("CveTurno", $"CveTurno = {CveTurno}").ToString.ToEntero Else - CveTurno = dTTurno.FiltroPrimeroValor("CveTurno", $"Turno = '{Turno}'").ToString().ToEntero() + CveTurno = dTTurno.FiltroPrimeroValor("CveTurno", $"Turno = '{Turno}'").ToString.ToEntero End If If CveTurno = 0 Then CveTurno = -1 @@ -3361,10 +3621,10 @@ Partial Class General_SaldosIniciales myarraystr = Departamento.Split(":"c) If (myarraystr.Length > 1) Then CveDepartamento = myarraystr(0).ToEntero() - CveDepartamento = dTDepartamentos.FiltroPrimeroValor("CveDepartamento", $"CveDepartamento = {CveDepartamento}").ToString().ToEntero() + CveDepartamento = dTDepartamentos.FiltroPrimeroValor("CveDepartamento", $"CveDepartamento = {CveDepartamento}").ToString.ToEntero Else - CveDepartamento = dTDepartamentos.FiltroPrimeroValor("CveDepartamento", $"Departamento = '{Departamento}'").ToString().ToEntero() + CveDepartamento = dTDepartamentos.FiltroPrimeroValor("CveDepartamento", $"Departamento = '{Departamento}'").ToString.ToEntero End If If CveDepartamento <= 0 Then CveDepartamento = -1 @@ -3373,9 +3633,9 @@ Partial Class General_SaldosIniciales myarraystr = Estado.Split(":"c) If (myarraystr.Length > 1) Then CveEstado = myarraystr(0).ToEntero() - CveEstado = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"CveEstado = {CveEstado}").ToString().ToEntero() + CveEstado = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"CveEstado = {CveEstado}").ToString.ToEntero Else - CveEstado = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado}'").ToString().ToEntero() + CveEstado = GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado}'").ToString.ToEntero End If If CveEstado = 0 Then CveEstado = -1 @@ -3384,9 +3644,9 @@ Partial Class General_SaldosIniciales myarraystr = TipoContrato.Split(":"c) If (myarraystr.Length > 1) Then CveTipoContrato = myarraystr(0).ToEntero() - CveTipoContrato = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"CveTipoContrato = {CveTipoContrato}").ToString().ToEntero() + CveTipoContrato = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"CveTipoContrato = {CveTipoContrato}").ToString.ToEntero Else - CveTipoContrato = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"TipoContrato = '{TipoContrato}'").ToString().ToEntero() + CveTipoContrato = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"TipoContrato = '{TipoContrato}'").ToString.ToEntero End If If CveTipoContrato = 0 Then CveTipoContrato = -1 @@ -3404,9 +3664,9 @@ Partial Class General_SaldosIniciales myarraystr = TipoPeriodo.Split(":"c) If (myarraystr.Length > 1) Then CveTipoPeriodo = myarraystr(0).ToEntero() - CveTipoPeriodo = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"CveTipoPeriodo = {CveTipoPeriodo}").ToString().ToEntero() + CveTipoPeriodo = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"CveTipoPeriodo = {CveTipoPeriodo}").ToString.ToEntero Else - CveTipoPeriodo = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"TipoPeriodo = '{TipoPeriodo}'").ToString().ToEntero() + CveTipoPeriodo = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"TipoPeriodo = '{TipoPeriodo}'").ToString.ToEntero End If If CveTipoPeriodo = 0 Then CveTipoPeriodo = -1 @@ -3415,9 +3675,9 @@ Partial Class General_SaldosIniciales myarraystr = Escolaridad.Split(":"c) If (myarraystr.Length > 1) Then CveEscolaridad = myarraystr(0).ToEntero() - CveEscolaridad = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"CveEscolaridad = {CveEscolaridad}").ToString().ToEntero() + CveEscolaridad = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"CveEscolaridad = {CveEscolaridad}").ToString.ToEntero Else - CveEscolaridad = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"Escolaridad = '{Escolaridad}'").ToString().ToEntero() + CveEscolaridad = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"Escolaridad = '{Escolaridad}'").ToString.ToEntero End If 'If CveEscolaridad = 0 Then ' CveEscolaridad = -1 @@ -3431,9 +3691,9 @@ Partial Class General_SaldosIniciales myarraystr = MetodoPago.Split(":"c) If (myarraystr.Length > 1) Then CveMetodoPago = myarraystr(0).ToEntero() - CveMetodoPago = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"CveMetodoPago = {CveMetodoPago}").ToString().ToEntero() + CveMetodoPago = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"CveMetodoPago = {CveMetodoPago}").ToString.ToEntero Else - CveMetodoPago = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"ClaveSAT = '{MetodoPago}'").ToString().ToEntero() + CveMetodoPago = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"ClaveSAT = '{MetodoPago}'").ToString.ToEntero End If If CveMetodoPago = 0 Then CveMetodoPago = -1 @@ -3442,9 +3702,9 @@ Partial Class General_SaldosIniciales myarraystr = Nominista.Split(":"c) If (myarraystr.Length > 1) Then CveUsuarioNomina = myarraystr(0).ToEntero() - CveUsuarioNomina = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"CveUsuario = {CveUsuarioNomina}").ToString().ToEntero() + CveUsuarioNomina = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"CveUsuario = {CveUsuarioNomina}").ToString.ToEntero Else - CveUsuarioNomina = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"Nombre = '{Nominista}'").ToString().ToEntero() + CveUsuarioNomina = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"Nombre = '{Nominista}'").ToString.ToEntero End If If CveUsuarioNomina = 0 Then CveUsuarioNomina = -1 @@ -3477,10 +3737,10 @@ Partial Class General_SaldosIniciales - Dim CvePersonal As Integer = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"NombreCompletoNombre = '{NombreCompleto}'").ToString().ToEntero() + Dim CvePersonal As Integer = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"NombreCompletoNombre = '{NombreCompleto}'").ToString.ToEntero() If Not (CvePersonal > 0) Then - CvePersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"CURP = '{CURP}'").ToString().ToEntero() + CvePersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"CURP = '{CURP}'").ToString.ToEntero() End If @@ -3538,9 +3798,9 @@ Partial Class General_SaldosIniciales SDI = SalarioDiario End If If Not ObjRH.AddPersonal(Codigo, ApellidoPaterno, ApellidoMaterno, Nombre, CorreoElectronico, FechaIn, CveTipoPeriodo, NumeroSS, CBool(AltaIMSS), SalarioDiario.ToDouble, SalarioDiario.ToDouble, SDI.ToDouble, SDI.ToDouble, - -1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString(), CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac, + -1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString, CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac, LugarNacimiento, Direccion, "", "", "", CodigoPostal, Ciudad, CveEstado, Telefono, "", Celular, RFC, CURP, "", NombrePadre, NombreMadre, -1, CveSATRiesgoPuesto, CveSATRegimenContratacion, -1, CveSubProyecto, "", -1, - ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina, CveRegistroPatronal:=CveRegistroPatronal, CveTipoTrabajador:=CveTipoTrabajador) Then + ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina, CveRegistroPatronal:=CveRegistroPatronal) Then If (ObjRH.noguardoXcurpb) Then Else ErrorRH = True @@ -3571,7 +3831,7 @@ Partial Class General_SaldosIniciales Exit For End If - Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero() + Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", "").ToEntero If Not CveCuentaBancaria > 0 Then Alert("No se detecto una cuenta Bancaria", TipoMensaje.MsgAdvertencia) @@ -3596,11 +3856,11 @@ Partial Class General_SaldosIniciales Exit For End If - Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 3, Fecha, FolioStr.ToString(), "", Saldo, 1, + Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 3, Fecha, FolioStr.ToString, "", Saldo, 1, 1, "Saldo Inicial", "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, FolioStr.ToString(), 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CvePersonal:=CvePersonal, Contabilizable:=False, ImporteMX:=Saldo) Then ErrorRH = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, FolioStr.ToString(), 28, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CvePersonal:=CvePersonal, Contabilizable:=False, ImporteMX:=Saldo) Then ErrorRH = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CvePersonal:=CvePersonal, Contabilizable:=False, ImporteMX:=Saldo) Then ErrorRH = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, FolioStr.ToString, 28, FolioStr, Fecha, -1, -1, CveIE:=CveIE, CvePersonal:=CvePersonal, Contabilizable:=False, ImporteMX:=Saldo) Then ErrorRH = True : Exit For End If @@ -3927,8 +4187,7 @@ Partial Class General_SaldosIniciales libro.Cell(crow, ccol).Value = "Registro Patronal" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "CuentaContable" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Saldo" : ccol = ccol + 1 - libro.Cell(crow, ccol).Value = "Tipo Trabajador" : ccol = ccol + 1 - ' + libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White From 5fca2bca5d004f84fad456f1c47e446c3c09d2d1 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 11 Jan 2023 18:47:32 -0700 Subject: [PATCH 4/6] JAM. Mejoras en lineas adicionales --- CxC/RepCxCDetalle.aspx | 8 + CxC/RepCxCDetalle.aspx.vb | 7 + Ventas/Clientes.aspx | 27 +-- Ventas/Clientes.aspx.vb | 334 ++++++++++++++++--------------- Ventas/RepLineasAdicionales.aspx | 5 +- 5 files changed, 211 insertions(+), 170 deletions(-) diff --git a/CxC/RepCxCDetalle.aspx b/CxC/RepCxCDetalle.aspx index 60b7fda83..c30545abe 100644 --- a/CxC/RepCxCDetalle.aspx +++ b/CxC/RepCxCDetalle.aspx @@ -537,6 +537,7 @@ + @@ -660,6 +661,13 @@ + + + + + + + diff --git a/CxC/RepCxCDetalle.aspx.vb b/CxC/RepCxCDetalle.aspx.vb index 86f4f7a82..25f8386d7 100644 --- a/CxC/RepCxCDetalle.aspx.vb +++ b/CxC/RepCxCDetalle.aspx.vb @@ -847,6 +847,13 @@ Partial Class RepCxCDetalle GvDatos.Columns(44).Visible = False End If + If ChkMostrarLineaAdicional.Checked Then + GvDatos.Columns(45).Visible = True + SePersonalizo = 1 + Else + GvDatos.Columns(45).Visible = False + End If + If SePersonalizo = 1 Then ImgExcelPersonalizado.Visible = True diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index e806ed1dc..b638c446e 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -6800,7 +6800,19 @@
-
+
+
+ + + + + + +
+ +
+
@@ -6819,18 +6831,7 @@
-
-
- - - - - - -
- -
+
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 9bc11695d..b40560271 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -513,12 +513,26 @@ Partial Class Clientes Set(value As Integer) ViewState("CveLineaAdicional") = value End Set - End Property - + End Property + Private Property FechaIngLineaAdicional As DateTime + Get + If ViewState("FechaIngLineaAdicional") Is Nothing Then + ViewState("FechaIngLineaAdicional") = MinFecha + End If + Return ViewState("FechaIngLineaAdicional").ToString().ToDateTime() + End Get + Set(value As DateTime) + ViewState("FechaIngLineaAdicional") = value + End Set + End Property + + + + #End Region - + #Region "Documentacion" Private Property DTDocumentacion As DataTable Get @@ -941,10 +955,10 @@ Partial Class Clientes LnkAgregarLineaAdicional.Visible = True GetLineasAdicionales() - End If - - - + End If + + + End If 'EN SERIO SE OCUPA EN CADA POSTBACK ??? IPP 7 SEPTIEMNRE 2017 @@ -2085,15 +2099,15 @@ Partial Class Clientes UpAgregarSucursal.Update() UpDatos.Update() End Sub - Public Sub CargaAFAsignados() - 'Dim ObjAF As New ClsAF() - 'If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "-1", CveCliente) Then - ' GvAFAsignado.DataSource = ObjAF.DtResultados - 'Else - ' GvAFAsignado.DataSource = Nothing - 'End If - 'ObjAF.Dispose() - 'GvAFAsignado.DataBind() + Public Sub CargaAFAsignados() + 'Dim ObjAF As New ClsAF() + 'If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "-1", CveCliente) Then + ' GvAFAsignado.DataSource = ObjAF.DtResultados + 'Else + ' GvAFAsignado.DataSource = Nothing + 'End If + 'ObjAF.Dispose() + 'GvAFAsignado.DataBind() End Sub Private Sub CargaMetodosPago33() DdlMetodoPago33.Items.Clear() @@ -4068,10 +4082,10 @@ Partial Class Clientes Private Sub GenerarPDFCrystal(Optional Formato As String = "PDF") Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.rpt", UsuarioActual.Empresa.Ruta)) - Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - 'OBTENEMOS LOS DATOS + Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") + 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + 'OBTENEMOS LOS DATOS Dim DtCxCFact As DataTable = Nothing Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) @@ -4277,16 +4291,16 @@ Partial Class Clientes Else If Archivo.Exists Then Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.mrt", UsuarioActual.Empresa.Ruta)) - If ArchivoSti.Exists Then - Dim listass As New List(Of ReportParameter) - For Each item As CrystalParametro In lista - listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) - Next - ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) - Else - ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - End If - + If ArchivoSti.Exists Then + Dim listass As New List(Of ReportParameter) + For Each item As CrystalParametro In lista + listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) + Next + ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) + Else + ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + End If + Else ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) End If @@ -4329,16 +4343,16 @@ Partial Class Clientes DtCxCFact2.Rows.Add(drr) If Archivo.Exists Then - Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.mrt", UsuarioActual.Empresa.Ruta)) - If ArchivoSti.Exists Then - Dim listass As New List(Of ReportParameter) - For Each item As CrystalParametro In lista - listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) - Next - ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) - Else - ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - End If + Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.mrt", UsuarioActual.Empresa.Ruta)) + If ArchivoSti.Exists Then + Dim listass As New List(Of ReportParameter) + For Each item As CrystalParametro In lista + listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) + Next + ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) + Else + ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + End If Else ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) End If @@ -4361,9 +4375,9 @@ Partial Class Clientes End Using End If - End Sub + End Sub #End Region - + #Region "E N V I O C O R R E O" Private Sub EnviaCorreo(Liga As String, LigaActivar As String) @@ -4431,11 +4445,11 @@ Partial Class Clientes a.GuardaLog() Dim Mail As New ClsSisMail() Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub + End Sub #End Region - + #Region " COTIZACIONES " - + Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) If BtnVerMasCot.Text = "Ver Más" Then CargaCotizaciones(-1) @@ -4505,11 +4519,11 @@ Partial Class Clientes HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" End If End If - End Sub + End Sub #End Region - + #Region "D I R E C C I O N E N V I O " - + Private Sub CargaCombosDirecionesClientesSAT() CargaDirClientePais() CargaDirClienteEstado() @@ -4732,12 +4746,12 @@ Partial Class Clientes End If CargaDireccionesEnvio() - End Sub - + End Sub + #End Region - + #Region " IMPORTAR SALDOS " - + Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click CargaClientesImportarSaldos() RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) @@ -4841,9 +4855,9 @@ Partial Class Clientes e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) End If - End Sub + End Sub #End Region - + #Region "Cuentas/Equipos" Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) HdnModalidad.Value = "I" @@ -5431,9 +5445,9 @@ Partial Class Clientes End If Return Retorno - End Function + End Function #End Region - + #Region "GPS" Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click If hdnArrayDispositivo.Value.Length > 0 Then @@ -5574,10 +5588,10 @@ Partial Class Clientes UpMoverDispositivo.Update() RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") - End Sub - + End Sub + #End Region - + #Region "Sucursales" Public Sub CreaDTSucursales() @@ -5811,14 +5825,14 @@ Partial Class Clientes End If End If End If - End Sub - + End Sub + #End Region - + #Region "G P S" - - - + + + Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) Try @@ -5889,16 +5903,16 @@ Partial Class Clientes End If ObjClientes.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "C O N T R A T O S" - - - - + + + + Private Sub CargaDatosContrato() If CveCliente <= 0 Then Exit Sub @@ -5943,10 +5957,10 @@ Partial Class Clientes e.Row.CssClass = "Totales white" End If End If - End Sub - + End Sub + #End Region - + #Region "M E T O D O S " Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged If DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue <> "-1" Then @@ -6356,13 +6370,13 @@ Partial Class Clientes End If - End Sub - + End Sub + #End Region - + #Region "IMPRIMIR GVHistorial" - - + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") @@ -6437,18 +6451,18 @@ Partial Class Clientes ObjClientes.Dispose() Return retorno - End Function - - + End Function + + #End Region - + #Region "C O B R A N Z A" Public Sub Visitas_Click(sender As Object, e As EventArgs) RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) - End Sub - + End Sub + #End Region - + #Region "Usuarios" Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero() @@ -6483,12 +6497,12 @@ Partial Class Clientes e.Row.Cells(5).Visible = False End If End If - End Sub + End Sub #End Region - - + + #Region "C U E N T A S - B A N C A R I A S" - + Private Sub CargaCuentasBancarias(Optional RecargaGlobal As Boolean = False) If CveCliente <= 0 Then Exit Sub @@ -6661,8 +6675,8 @@ Partial Class Clientes TxtNumeroCuenta2.Text = "" TxtConvenioCIE2.Text = "" TxtReferencia2.Text = "" - End Sub - + End Sub + #Region "GRIDVIEW - CUENTAS BANCARIAS" Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -6718,10 +6732,10 @@ Partial Class Clientes GlobalDTCuentasDepositosClientes(UsuarioActual.CveEmpresa, -1, True) = Nothing End If - End Sub - + End Sub + #End Region - + Private Sub CargaPSGridCuentasBancos() If CveCliente > 0 Then GvBancosCuentas.DataSource = DTCuentasBancos @@ -6779,9 +6793,9 @@ Partial Class Clientes divestatus.Visible = True UpAddBancos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) - End Sub + End Sub #End Region - + #Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click GenerarPDF("Excel") @@ -6803,11 +6817,11 @@ Partial Class Clientes ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) - End Sub + End Sub #End Region - + #Region "VENTAS" - + Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() Dim ObjVentas As New ClsVentas Dim Vta As Modelos.Factura = Nothing @@ -7038,10 +7052,10 @@ Partial Class Clientes ObjVentas.Dispose() Return PdfFactura(Vta) - End Function - + End Function + #End Region - + #Region "COMERCIO EXTERIOR" Public Sub CargaCombosComercioExterior() @@ -7165,12 +7179,12 @@ Partial Class Clientes End Sub Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) CargaColonia() - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T A C I O N " - + Private Sub CargaDocumentacionCliente() Dim objRH As New ClsEdocumentacion() @@ -7808,12 +7822,12 @@ Partial Class Clientes RegistraScript("Download('" & baseUrl & "')") - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T O S V E N T A S" - + Private Sub CargaDocumentosVenta(tCveCliente As Integer) Dim objInv As New ClsEdocumentacion @@ -7984,11 +7998,11 @@ Partial Class Clientes objRH.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "PERSONA FISICA" Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) RegistraScript("$('#DivModalPersonaFisica').modal();") @@ -8013,9 +8027,9 @@ Partial Class Clientes ObjCliente.Dispose() UpDatos.Update() - End Sub + End Sub #End Region - + #Region "USUARIOS PLATAFORMA CLIENTE - 6 " Protected Sub CargaUsuariosPortalCliente() Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios @@ -8024,19 +8038,19 @@ Partial Class Clientes GvUsuarios.DataBind() End If objUsuario.Dispose() - End Sub + End Sub #End Region - + #Region " DEVOLVER DINERO ANT/NC " Private Sub InicializaDevolverDinero() If UsuarioActual.TienePermisoProceso(247) Then GVAnticipos.Columns(6).Visible = True End If - End Sub + End Sub #End Region - + #Region "MODAL GRAFICA/PEDIDOS" - + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) If CargaDatatables() Then RegistraScript("$('#DivModalGrafica').modal('show')") @@ -8373,13 +8387,13 @@ Partial Class Clientes RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") UPModalProd.Update() - End Sub - - + End Sub + + #End Region - + #Region "TAB - COMPORTAMIENTO DE VENTAS" - + Private Sub CargaGrupo() DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) @@ -8563,12 +8577,12 @@ Partial Class Clientes ObjVentas.Dispose() GvComportamientoVenta.DataBind() UpDatosComportamientoVenta.Update() - End Sub - + End Sub + #End Region - + #Region "DISPOSITIVOS" - + Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() @@ -8606,10 +8620,10 @@ Partial Class Clientes CargaEventoBitacora() NombreDispositivo = "" RegistraScript("$('#DivMoverDispositivo').modal('hide');") - End Sub - + End Sub + #End Region - + #Region "CRM" Protected Sub CargaDatosCRM() Dim ObjCRM = New ClsCRM() @@ -8709,9 +8723,9 @@ Partial Class Clientes Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") End If End If - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE MARCAS" Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) @@ -8936,9 +8950,9 @@ Partial Class Clientes ObjPS.Dispose() - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE PRODUCTOS" Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) @@ -9174,12 +9188,12 @@ Partial Class Clientes Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero(), DdlProducto2) - End Sub + End Sub #End Region - + #Region " A C U M U L A D O R E S" - - + + Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) 'CveVentaNota = 0 @@ -9822,11 +9836,11 @@ Partial Class Clientes ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) - End Sub - - + End Sub + + #End Region - + #Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") @@ -9889,15 +9903,13 @@ Partial Class Clientes End Sub Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click - Dim Acum As New ClsAcumuladores Dim Puntos As Decimal = -GvUsadosResumen.Rows.Cast(Of GridViewRow).Where(Function(x) x.RowType = DataControlRowType.DataRow).FirstOrDefault(Function(gvr) gvr.RowIndex = 3).DataKey("Puntos").ToEntero() - If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado", Now) Then + If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, Puntos, 0, 0, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado", Now) Then Alert("Puntuación Inicializada") End If Acum.Dispose() - - End Sub + End Sub #End Region Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then @@ -10406,6 +10418,8 @@ Partial Class Clientes Protected Sub LnkAgregarLineaAdicional_Click(sender As Object, e As EventArgs) CveLineaAdicional = -1 + FechaIngLineaAdicional = Nothing + RegistraScript("$('#DVLineasAdicionales').modal('show')") LtlLineasAdicionalesTotuloModal.Text = "Agregar Linea Adicional" AgregarLineaAdicionalLimpiarControles() @@ -10437,11 +10451,13 @@ Partial Class Clientes ' Exit Sub 'End If - Dim ObjVentas As New ClsVentas + If CveLineaAdicional > 0 Then + + If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then + TxtFechaVencimientoLineaAdicionalModal.Text = FechaIngLineaAdicional.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") + End If - - If CveLineaAdicional > 0 Then If Not ObjVentas.UpdateLineasAdicionales(CveLineaAdicional, TxtLineaAdicionalModal.Text, CveCliente, DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero, DdlTipoLineaAdicionalModal.SelectedValue.ToEntero, TxtImporteLineaAdicionalModal.Text.ToDecimal, DdlMonedaLineAdicionalModal.SelectedValue.ToEntero, TxtFechaVencimientoLineaAdicionalModal.Text.ToDate, UsuarioActual.CveUsuario, DdlCategoriaLineaAdicionalModal.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DiasVencimiento:=TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero) Then @@ -10449,7 +10465,11 @@ Partial Class Clientes Else Alert("Linea Adicional Actualizada Correctamente") End If - Else + Else + If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then + TxtFechaVencimientoLineaAdicionalModal.Text = Now.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") + End If + If Not ObjVentas.AddLineasAdicionales(TxtLineaAdicionalModal.Text, CveCliente, DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero, DdlTipoLineaAdicionalModal.SelectedValue.ToEntero, TxtImporteLineaAdicionalModal.Text.ToDecimal, DdlMonedaLineAdicionalModal.SelectedValue.ToEntero, TxtFechaVencimientoLineaAdicionalModal.Text.ToDate, UsuarioActual.CveUsuario, DdlCategoriaLineaAdicionalModal.SelectedValue.ToEntero, DiasVencimiento:=TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero) Then @@ -10476,6 +10496,7 @@ Partial Class Clientes CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToEntero + FechaIngLineaAdicional = GvRow.DataKey("FechaIng").ToDateTime() TxtLineaAdicionalModal.Text = GvRow.DataKey("LineaAdicional") DdlProveedorLineaAdicionalModal.txtText.Value = GvRow.DataKey("Proveedor") DdlProveedorLineaAdicionalModal.txtValue.Value = GvRow.DataKey("CveProveedor") @@ -10520,6 +10541,7 @@ Partial Class Clientes Protected Sub DdlTipoLineaAdicionalModal_SelectedIndexChanged(sender As Object, e As EventArgs) DvLineaAdicionalDiasVenciemientoModal.Visible = If(DdlTipoLineaAdicionalModal.SelectedValue.ToEntero = 2, True, False) + DvFechaVencimiento.Visible = If(DdlTipoLineaAdicionalModal.SelectedValue.ToEntero = 2, False, True) UpLineaAdicionalmodal.Update() End Sub diff --git a/Ventas/RepLineasAdicionales.aspx b/Ventas/RepLineasAdicionales.aspx index 97e27ec8b..3953c6bda 100644 --- a/Ventas/RepLineasAdicionales.aspx +++ b/Ventas/RepLineasAdicionales.aspx @@ -136,8 +136,11 @@ + + + - +
From 949fda338c701ca318da63cef600c674d66975e5 Mon Sep 17 00:00:00 2001 From: MLopez Date: Fri, 13 Jan 2023 09:24:30 -0700 Subject: [PATCH 5/6] =?UTF-8?q?E141=20Kardex=20Almacen=20Proceso=20349=20B?= =?UTF-8?q?loqueo=20opci=C3=B3n=20"No"=20en=20tr=C3=A1nsito?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inventarios/KardexAlmacenHorizontal.aspx.vb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index dc2f229a8..b01a8ac17 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -30,6 +30,10 @@ Partial Class Inventarios_KardexAlmacen txtFechaI.Text = Now.ToShortDateString End If + If UsuarioActual.TienePermisoProceso(349) Then + DdlIncluyeTransitorios.Items.RemoveAt(0) 'oculta opción "No" en tránsito + End If + If IfNull(Request("CvePS"), "-1").ToString.ToEntero > 0 Then CargarKardex(Request("CvePS").ToString.ToEntero) ddlProducto2.SelectedValue = If(Request("CvePS") IsNot Nothing, Request("CvePS").ToString, "-1") End If @@ -147,8 +151,9 @@ Partial Class Inventarios_KardexAlmacen Dim CveProveedorCompra As Integer = If(DdlProveedor.SelectedValue.ToEntero > 0, DdlProveedor.SelectedValue.ToEntero, -1) Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM) Dim GPO As Integer = Ddlgrupo.SelectedValue.ToEntero + Dim IncluyeTransitorios As Integer = DdlIncluyeTransitorios.SelectedValue.ToEntero - If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, -1, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(), + If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, -1, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), IncluyeTransitorios, DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue, Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas, IncluyeProyectado:=DdlProyeccionFiltro.SelectedValue.ToEntero, CveAlmacenes:=CveAlmacenes, GPO:=GPO) Then If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then From 0c1f0f56fbb26cee44a9e012a47771d85187a393 Mon Sep 17 00:00:00 2001 From: MLopez Date: Fri, 13 Jan 2023 14:31:24 -0700 Subject: [PATCH 6/6] E172 Cargar PS Empacados/TipoOrganicos desde GlobalDT --- App_Code/ClsPaginas.vb | 36 +++++++++++++++++++++++++++++-- Ventas/ProductosServicios.aspx.vb | 13 ++--------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 887b33ddb..7c3dfc1d2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4313,6 +4313,40 @@ Public Class ClsPaginas End Set End Property +#Region "CITRUS GAME" + Property GlobalDTGralEmpacados(CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = $"GlobalDTGralEmpacados-{CveEmpresa}" + If Application(AppNombre) Is Nothing Then + Dim ObjGenerales As New ClsGenerales() + If ObjGenerales.GetEmpacados(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() + End If + + GlobalDTGralEmpacados = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTGralEmpacados-{CveEmpresa}" + Application(AppNombre) = value + End Set + End Property + Property GlobalDTGralTipoOrganicos(CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = $"GlobalDTGralTipoOrganicos-{CveEmpresa}" + If Application(AppNombre) Is Nothing Then + Dim ObjGenerales As New ClsGenerales() + If ObjGenerales.GetTipoOrganicos(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() + End If + + GlobalDTGralTipoOrganicos = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTGralTipoOrganicos-{CveEmpresa}" + Application(AppNombre) = value + End Set + End Property +#End Region #End Region @@ -4321,8 +4355,6 @@ Public Class ClsPaginas DirectorioSitio = 2 eFacturasCaptcha = 3 - - RutaEmpresasJM = 500 RutaEmpresasRM = 501 RutaEmpresasPC = 502 diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 3d24b25b9..dd685d23e 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -438,21 +438,12 @@ Partial Class ProductosyServicios End Sub Private Sub CargaPanelCitricos() - Dim ObjGral As New ClsGenerales() - If ObjGral.GetEmpacados(UsuarioActual.CveEmpresa) Then - DdlEmpacado.DataSource = ObjGral.DtResultados - End If - If ObjGral.GetTipoOrganicos(UsuarioActual.CveEmpresa) Then - DdlTipoOrganico.DataSource = ObjGral.DtResultados - End If - ObjGral.Dispose() - + DdlEmpacado.DataSource = GlobalDTGralEmpacados(UsuarioActual.CveEmpresa) + DdlTipoOrganico.DataSource = GlobalDTGralTipoOrganicos(UsuarioActual.CveEmpresa) DdlEmpacado.DataBind() DdlTipoOrganico.DataBind() - End Sub - Private Sub MuestraPanel(Optional AfterPageLoad As Boolean = False) If AfterPageLoad Then RegistraScript("window.onload = function MuestraPanel() { document.getElementById(""C_BtnMostrarPanel"").click(); }")