This commit is contained in:
Oscar Irigoyen
2022-10-12 13:35:58 -07:00

View File

@@ -576,33 +576,36 @@ Partial Class General_SaldosIniciales
Alert("El nombre de la primera columna debe ser 'CuentaBancaria'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la primera columna debe ser 'CuentaBancaria'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(1).ColumnName = "Banco" Then
If Not dt.Columns(1).ColumnName = "Importe" Then Alert("El nombre de la primera columna debe ser 'Banco'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(2).ColumnName = "Importe" Then
Alert("El nombre de la segunda columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la segunda columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(2).ColumnName = "Moneda" Then If Not dt.Columns(3).ColumnName = "Moneda" Then
Alert("El nombre de la segunda columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la segunda columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(3).ColumnName = "TipoCambio" Then If Not dt.Columns(4).ColumnName = "TipoCambio" Then
Alert("El nombre de la segunda columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la segunda columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(4).ColumnName = "Fecha" Then If Not dt.Columns(5).ColumnName = "Fecha" Then
Alert("El nombre de la cuarta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la cuarta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(5).ColumnName = "Descripcion" Then If Not dt.Columns(6).ColumnName = "Descripcion" Then
Alert("El nombre de la cuarta columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la cuarta columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not dt.Columns(6).ColumnName = "CuentaContable" Then If Not dt.Columns(7).ColumnName = "CuentaContable" Then
Alert("El nombre de la tercera columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la tercera columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
@@ -2494,11 +2497,11 @@ Partial Class General_SaldosIniciales
Dim Contador As Integer = 0 Dim Contador As Integer = 0
For Each dRow As DataRow In DTBancos.Rows For Each dRow As DataRow In DTBancos.Rows
Dim Fecha As Date = dRow("Fecha").ToString.ToDate Dim Fecha As Date = dRow("Fecha").ToString.ToDate
Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal
Dim Descripcion As String = dRow("Descripcion").ToString Dim Descripcion As String = dRow("Descripcion").ToString
Dim NumCuenta As String = dRow("CuentaBancaria").ToString Dim Banco As String = dRow("Banco").ToString
Dim NumCuenta As String = dRow("CuentaBancaria").ToString.Trim
Dim ImporteMX As Decimal = 0 Dim ImporteMX As Decimal = 0
Dim ImporteME As Decimal = 0 Dim ImporteME As Decimal = 0
@@ -2506,8 +2509,6 @@ Partial Class General_SaldosIniciales
Dim CveMoneda As Integer 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 If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then
CveMoneda = 1 CveMoneda = 1
TipoCambio = 1 TipoCambio = 1
@@ -2536,16 +2537,32 @@ Partial Class General_SaldosIniciales
End If End If
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 If Not CveCuentaBancaria > 0 Then
Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia)
ErrorProceso = True ' se registrará primero
Exit For 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
If NumCuenta.ToLower.Contains("caja chica") Then CveTipoCuenta = 1 ' cuando es caja chica
If ObjBancos.AddBancosCuentas(CveBanco, 2, NumCuenta, "", CveMoneda, 1, 1, 1, 9999999, 0, 0, 0, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", False, False) Then
CveCuentaBancaria = ObjBancos.TCveCuenta
Else
Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia)
ErrorProceso = True : Exit For
End If
Else
Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia)
ErrorProceso = True : Exit For
End If
End If End If
If ImporteMX < 0 Then CveTipoTransaccion = 2 'salida de dinero, concepto de transferencia realizada
Dim FolioStr As String = "" Dim FolioStr As String = ""
FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 3) + Contador) FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, CveTipoTransaccion))
Dim CveCuentaContable As Integer = 0 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(" ", "")
@@ -2568,32 +2585,30 @@ Partial Class General_SaldosIniciales
End If End If
If CveCuentaContable > 0 AndAlso Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then
If Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then
ErrorProceso = True ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia) Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For Exit For
End If End If
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Bancos/SaldoInicial", 66, Importe, Importe, CveMoneda, Fecha, FolioStr, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If Importe <> 0 Then
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Bancos/SaldoInicial", 66, Importe, Importe, CveMoneda, Fecha, FolioStr, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not CvePrePoliza > 0 Then
ErrorProceso = True : Exit For
End If
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 CvePrePoliza > 0 Then
ErrorProceso = True
Exit For
End If End If
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, 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
Contador = Contador + 1 Contador = Contador + 1
Next Next
If Not ErrorProceso Then If Not ErrorProceso Then
Alert($"Se agregaron {Contador} Movimientos.") Alert($"Se agregaron {Contador} Movimientos.")
ObjBancos.Commit() ObjBancos.Commit()