|
|
|
|
@@ -516,6 +516,119 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Valor'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "13" Then 'ANTICIPO PROVEEDORES
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(0).ColumnName = "RFC" Then
|
|
|
|
|
Alert("El nombre de la primera columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(1).ColumnName = "Descripcion" Then
|
|
|
|
|
Alert("El nombre de la segunda columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(2).ColumnName = "Fecha" Then
|
|
|
|
|
Alert("El nombre de la tercera columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(3).ColumnName = "Importe" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(4).ColumnName = "Moneda" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(5).ColumnName = "TipoCambio" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(6).ColumnName = "CuentaContable" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "14" Then 'ANTICIPO CLIENTES
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(0).ColumnName = "RFC" Then
|
|
|
|
|
Alert("El nombre de la primera columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(1).ColumnName = "Descripcion" Then
|
|
|
|
|
Alert("El nombre de la segunda columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(2).ColumnName = "Fecha" Then
|
|
|
|
|
Alert("El nombre de la tercera columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(3).ColumnName = "Importe" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(4).ColumnName = "Moneda" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(5).ColumnName = "TipoCambio" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(6).ColumnName = "CuentaContable" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "15" Then 'BANCOS
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(0).ColumnName = "CuentaBancaria" Then
|
|
|
|
|
Alert("El nombre de la primera columna debe ser 'CuentaBancaria'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(1).ColumnName = "Importe" Then
|
|
|
|
|
Alert("El nombre de la segunda columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(2).ColumnName = "Moneda" Then
|
|
|
|
|
Alert("El nombre de la segunda columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(3).ColumnName = "TipoCambio" Then
|
|
|
|
|
Alert("El nombre de la segunda columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(4).ColumnName = "Fecha" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(5).ColumnName = "Descripcion" Then
|
|
|
|
|
Alert("El nombre de la cuarta columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not dt.Columns(6).ColumnName = "CuentaContable" Then
|
|
|
|
|
Alert("El nombre de la tercera columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2094,12 +2207,439 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
ObjMovimientos.Dispose()
|
|
|
|
|
ProductosServiciosRef.Dispose()
|
|
|
|
|
AlmacenRef.Dispose()
|
|
|
|
|
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "13" Then
|
|
|
|
|
ProcesaAnticipoProveedor(dt, DTCuentasContables)
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "14" Then
|
|
|
|
|
ProcesaAnticipoCliente(dt, DTCuentasContables)
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "15" Then
|
|
|
|
|
ProcesaBancos(dt, DTCuentasContables)
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub ProcesaBancos(DTBancos As DataTable, DTCuentasContables As DataTable)
|
|
|
|
|
|
|
|
|
|
Dim ErrorProceso As Boolean = False
|
|
|
|
|
|
|
|
|
|
Dim ObjConta As New ClsContabilidad()
|
|
|
|
|
Dim ObjBancos As New ClsBancos(ObjConta.IniciaTransacSQL)
|
|
|
|
|
|
|
|
|
|
If Not DTBancos.Columns.Contains("CveCuentaContable") Then
|
|
|
|
|
DTBancos.Columns.Add("CveCuentaContable", GetType(Integer))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 NumCuenta As String = dRow("CuentaBancaria").ToString
|
|
|
|
|
Dim ImporteMX As Decimal = 0
|
|
|
|
|
Dim ImporteME As Decimal = 0
|
|
|
|
|
|
|
|
|
|
Dim Moneda As String = dRow("Moneda").ToString
|
|
|
|
|
Dim CveMoneda As Integer
|
|
|
|
|
Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then
|
|
|
|
|
CveMoneda = 1
|
|
|
|
|
TipoCambio = 1
|
|
|
|
|
ElseIf Moneda.ToUpper.Contiene("DÓLARES", "DOLARES", "USD") Then
|
|
|
|
|
CveMoneda = 2
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If CveMoneda.Contiene(1, 2) Then
|
|
|
|
|
If CveMoneda = 2 Then
|
|
|
|
|
If TipoCambio = 0 Then
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda en dólares sin tipo de cambio especificado.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe * TipoCambio
|
|
|
|
|
ImporteME = Importe
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe
|
|
|
|
|
ImporteME = 0
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda ({Moneda}) no valida.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", $" NumCuenta = '{NumCuenta}'").ToEntero
|
|
|
|
|
If Not CveCuentaBancaria > 0 Then
|
|
|
|
|
Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim FolioStr As String = ""
|
|
|
|
|
FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 3) + Contador)
|
|
|
|
|
|
|
|
|
|
Dim CveCuentaContable As Integer = 0
|
|
|
|
|
Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "")
|
|
|
|
|
|
|
|
|
|
If CuentaContable.Length > 0 Then
|
|
|
|
|
|
|
|
|
|
CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero
|
|
|
|
|
|
|
|
|
|
If CveCuentaContable > 0 Then
|
|
|
|
|
dRow("CveCuentaContable") = CveCuentaContable
|
|
|
|
|
Else
|
|
|
|
|
Alert($"Cuenta Bancaria {NumCuenta} cuenta contable {CuentaContable} no encontrada.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
DTBancos.AcceptChanges()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
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, 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
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
Alert($"Se agregaron {Contador} Movimientos.")
|
|
|
|
|
ObjBancos.Commit()
|
|
|
|
|
Else
|
|
|
|
|
ObjBancos.RollBack()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
If Not CveCuentaBancaria > 0 Then
|
|
|
|
|
Alert("No se detecto una cuenta Bancaria", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim ObjConta As New ClsContabilidad()
|
|
|
|
|
Dim ObjBancos As New ClsBancos(ObjConta.IniciaTransacSQL)
|
|
|
|
|
|
|
|
|
|
If Not DtAnticipoProveedor.Columns.Contains("CveCuentaContable") Then
|
|
|
|
|
DtAnticipoProveedor.Columns.Add("CveCuentaContable", GetType(Integer))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim Contador As Integer = 0
|
|
|
|
|
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 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 CveMoneda As Integer
|
|
|
|
|
Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then
|
|
|
|
|
CveMoneda = 1
|
|
|
|
|
TipoCambio = 1
|
|
|
|
|
ElseIf Moneda.ToUpper.Contiene("DÓLARES", "DOLARES", "USD") Then
|
|
|
|
|
CveMoneda = 2
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If CveMoneda.Contiene(1, 2) Then
|
|
|
|
|
|
|
|
|
|
If CveMoneda = 2 Then
|
|
|
|
|
If TipoCambio = 0 Then
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda en dólares sin tipo de cambio especificado.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe * TipoCambio
|
|
|
|
|
ImporteME = Importe
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe
|
|
|
|
|
ImporteME = 0
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda ({Moneda}) no valida.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim FolioStr As String = ""
|
|
|
|
|
FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 1) + Contador)
|
|
|
|
|
Dim CveProveedor As Integer = GlobalDTCompProveedores(CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $" RFC = '{RFC}' ").ToEntero
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not CveProveedor > 0 Then
|
|
|
|
|
Alert($"No se encontro Proveedor con RFC: {RFC}.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim CveCuentaContable As Integer = 0
|
|
|
|
|
Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "")
|
|
|
|
|
|
|
|
|
|
If CuentaContable.Length > 0 Then
|
|
|
|
|
CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If CveCuentaContable > 0 Then
|
|
|
|
|
dRow("CveCuentaContable") = CveCuentaContable
|
|
|
|
|
Else
|
|
|
|
|
Alert($"RFC {RFC} cuenta {CuentaContable} no encontrada.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
DtAnticipoProveedor.AcceptChanges()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not AsignacionCuenta(ObjConta, 10, CveCuentaContable, -1, CveProveedor, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Anticipo/Proveedor/SaldoInicial", 12, 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, 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
|
|
|
|
|
|
|
|
|
|
Contador = Contador + 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
Alert($"Se agregaron {Contador} Anticipos.")
|
|
|
|
|
ObjBancos.Commit()
|
|
|
|
|
Else
|
|
|
|
|
ObjBancos.RollBack()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
If Not CveCuentaBancaria > 0 Then
|
|
|
|
|
Alert("No se detecto una cuenta Bancaria", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim ObjConta As New ClsContabilidad()
|
|
|
|
|
Dim ObjBancos As New ClsBancos(ObjConta.IniciaTransacSQL)
|
|
|
|
|
|
|
|
|
|
If Not DTAnticipoCliente.Columns.Contains("CveCuentaContable") Then
|
|
|
|
|
DTAnticipoCliente.Columns.Add("CveCuentaContable", GetType(Integer))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim Contador As Integer = 0
|
|
|
|
|
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 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 CveMoneda As Integer
|
|
|
|
|
Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal
|
|
|
|
|
|
|
|
|
|
If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then
|
|
|
|
|
CveMoneda = 1
|
|
|
|
|
TipoCambio = 1
|
|
|
|
|
ElseIf Moneda.ToUpper.Contiene("DÓLARES", "DOLARES", "USD") Then
|
|
|
|
|
CveMoneda = 2
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If CveMoneda.Contiene(1, 2) Then
|
|
|
|
|
|
|
|
|
|
If CveMoneda = 2 Then
|
|
|
|
|
If TipoCambio = 0 Then
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda en dólares sin tipo de cambio especificado.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe * TipoCambio
|
|
|
|
|
ImporteME = Importe
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
ImporteMX = Importe
|
|
|
|
|
ImporteME = 0
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
Alert($"Registro {Contador + 1} moneda ({Moneda}) no valida.")
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not CveCliente > 0 Then
|
|
|
|
|
Alert($"No se encontro cliente con RFC: {RFC}.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'Dim RazonSocial As String = Row("RazonSocial").ToString
|
|
|
|
|
Dim CveCuentaContable As Integer = 0
|
|
|
|
|
Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "")
|
|
|
|
|
|
|
|
|
|
If CuentaContable.Length > 0 Then
|
|
|
|
|
CveCuentaContable = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If CveCuentaContable > 0 Then
|
|
|
|
|
dRow("CveCuentaContable") = CveCuentaContable
|
|
|
|
|
Else
|
|
|
|
|
Alert($"RFC {RFC} cuenta {CuentaContable} no encontrada.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
DTAnticipoCliente.AcceptChanges()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not AsignacionCuenta(ObjConta, 66, CveCuentaContable, -1, -1, CveCliente, -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
ErrorProceso = True
|
|
|
|
|
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Anticipo/Cliente/SaldoInicial", 24, 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, 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
|
|
|
|
|
|
|
|
|
|
Contador = Contador + 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
|
Alert($"Se agregaron {Contador} Anticipos.")
|
|
|
|
|
ObjBancos.Commit()
|
|
|
|
|
Else
|
|
|
|
|
ObjBancos.RollBack()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) As Boolean
|
|
|
|
|
|
|
|
|
|
Dim Respuesta As Boolean = False
|
|
|
|
|
|
|
|
|
|
'If Not ObjConta.AddCuentasAsignaciones(28, UsuarioActual.CveEmpresa, CveCuentaContable, -1,
|
|
|
|
|
' -1, -1, ObjRH.CvePersonal, -1, -1, 0, CveBancoCuenta:=-1, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
|
|
|
|
|
' CveTipoGasto:=-1, RegeneraCuenta:=False) Then
|
|
|
|
|
' ErrorRH = True
|
|
|
|
|
' Exit For
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, CveEmpresa, CveCuentaContable, -1,
|
|
|
|
|
CveProveedor, CveCliente, CvePersonal, -1, -1, 0, CveBancoCuenta:=CveBancoCuenta, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
|
|
|
|
|
CveTipoGasto:=-1, RegeneraCuenta:=False) Then
|
|
|
|
|
Respuesta = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Return Respuesta
|
|
|
|
|
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
|
|
|
|
|
|
|
|
|
Dim Directorio As String = ""
|
|
|
|
|
@@ -2127,7 +2667,14 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoPrePoliza.xlsx"
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "12" Then
|
|
|
|
|
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAlmacen.xlsx"
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "13" Then
|
|
|
|
|
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAnticipoProveedor.xlsx"
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "14" Then
|
|
|
|
|
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAnticipoCliente.xlsx"
|
|
|
|
|
ElseIf RblFormato.SelectedValue = "15" Then
|
|
|
|
|
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoBancos.xlsx"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not (Directorio = "") Then
|
|
|
|
|
|
|
|
|
|
Dim Archivo As New IO.FileInfo(Directorio)
|
|
|
|
|
@@ -2462,6 +3009,7 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
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}"
|
|
|
|
|
|
|
|
|
|
@@ -2723,7 +3271,6 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
If CveCuentaContable > 0 Then
|
|
|
|
|
|
|
|
|
|
Dim ObjConta As New ClsContabilidad(ObjRH.IniciaTransacSQL)
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddCuentasAsignaciones(28, UsuarioActual.CveEmpresa, CveCuentaContable, -1,
|
|
|
|
|
-1, -1, ObjRH.CvePersonal, -1, -1, 0, CveBancoCuenta:=-1, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
|
|
|
|
|
CveTipoGasto:=-1, RegeneraCuenta:=False) Then
|
|
|
|
|
@@ -2733,6 +3280,47 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Saldo > 0 Then
|
|
|
|
|
|
|
|
|
|
If Not CveCuentaContable > 0 Then
|
|
|
|
|
Alert($"Personal {NombreCompleto} tiene saldo pero no se especifico cuenta contable.")
|
|
|
|
|
ErrorRH = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim ObjConta As New ClsContabilidad(ObjRH.IniciaTransacSQL)
|
|
|
|
|
Dim ObjBancos As New ClsBancos(ObjRH.IniciaTransacSQL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim Fecha As Date = TxtFecha.Text.ToDate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim FolioStr As String = ""
|
|
|
|
|
|
|
|
|
|
FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 3) + Contador)
|
|
|
|
|
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Saldo/Personal/SaldoInicial", 23, Saldo, Saldo, 1, Fecha, FolioStr, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
|
|
|
|
|
If Not CvePrePoliza > 0 Then
|
|
|
|
|
ErrorRH = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
@@ -3055,6 +3643,7 @@ Partial Class General_SaldosIniciales
|
|
|
|
|
libro.Cell(crow, ccol).Value = "Nominista" : ccol = ccol + 1
|
|
|
|
|
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.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
|
|
|
|
|
|