--Impresion directa, deposito de caja
PA; --PA_Banc_IEMovimientosDepositosGet
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,8 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Net.Http
|
||||
Imports Extensiones
|
||||
Partial Class Bancos_DepositosCaja
|
||||
Inherits ClsPaginas
|
||||
@@ -148,8 +150,9 @@ Partial Class Bancos_DepositosCaja
|
||||
Dim Comision As Decimal = TxtComision.Text.ToDecimal
|
||||
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal
|
||||
Dim IVA As Decimal = TxtIVA.Text.ToDecimal
|
||||
Dim ImporteInter As Decimal = TxtComisionIntermediario.Text.ToDecimal
|
||||
|
||||
Dim ImporteInter As Decimal = TxtComisionIntermediario.Text.ToDecimal
|
||||
|
||||
Dim MsgError As String = "Ocurrió un error al realizar los depositos"
|
||||
|
||||
For Each Gvr As GridViewRow In GvFacturas.Rows
|
||||
If Gvr.FCCheckBox("ChkFactura").Checked Then TotalImporte += Gvr.DataKey("Importe").ToDecimal
|
||||
@@ -184,197 +187,226 @@ Partial Class Bancos_DepositosCaja
|
||||
TotalImporte = TotalImporte - TxtComisionIntermediario.Text.ToDecimal - IVA
|
||||
End If
|
||||
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim ObjConta As New ClsContabilidad()
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim NuevaCvePrePoliza As Integer
|
||||
|
||||
Dim pdf64 As String = ""
|
||||
Dim documentos As String = "Los Depósitos se realizaron exitosamente<br/><br/>"
|
||||
|
||||
Dim CveIEOrigen As Integer = -1 'CajaChica
|
||||
Dim CveIEDestino As Integer = -1 'Banco
|
||||
|
||||
Dim ObjConta As New ClsContabilidad()
|
||||
Dim ObjBancos As New ClsBancos(ObjConta.IniciaTransacSQL())
|
||||
|
||||
Dim CveIEOrigen As Integer 'CajaChica
|
||||
Dim CveIEDestino As Integer 'Banco
|
||||
Dim NuevaCvePrePoliza As Integer
|
||||
Dim FolioIE As Long = -1
|
||||
Dim CveMoneda As Integer = 1
|
||||
Dim TipoCambio As Decimal = 1
|
||||
Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim drOrigen As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
Dim drDestino As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCuentaDeposito.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
Dim CveSubProyecto As Integer = DdlSubProyectos.SelectedValue.ToEntero
|
||||
Dim CveClasificacion As Integer = -1
|
||||
|
||||
Dim CveSubProyectoComision As Integer
|
||||
Dim CveClasificacionComision As Integer
|
||||
|
||||
Dim CveSubProyectoDescuento As Integer
|
||||
Dim CveClasificacionDescuento As Integer
|
||||
|
||||
Dim documentos As String = "Los Depósitos se realizaron exitosamente<br/><br/>"
|
||||
Dim imprimirFolios As String = ""
|
||||
Dim CveSubProyectoIntermediario As Integer
|
||||
Dim CveClasificacionIntermediario As Integer
|
||||
Dim CveProveedorIntermediario As Integer = -1
|
||||
|
||||
If drOrigen IsNot Nothing Then
|
||||
CveMoneda = drOrigen("CveMoneda").ToString.ToEntero
|
||||
End If
|
||||
|
||||
If drDestino IsNot Nothing Then
|
||||
CveMoneda = drDestino("CveMoneda").ToString.ToEntero
|
||||
End If
|
||||
|
||||
NuevaCvePrePoliza = ObjConta.AddPrePolizas("DepCaja", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=1)
|
||||
|
||||
Dim IntermediarioFactura As Boolean = False
|
||||
If UsuarioActual.CveEmpresa = 145 Then IntermediarioFactura = True
|
||||
If ChkIntermediario.Checked Then
|
||||
|
||||
CveSubProyectoIntermediario = DdlSubProyectoIntermediario.SelectedValue.ToEntero
|
||||
CveClasificacionIntermediario = DdlClasificacionIntermediario.SelectedValue.ToEntero
|
||||
CveProveedorIntermediario = DdlProveedorIntermediario.SelectedValue.ToEntero
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then ' empresa llantera
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, TotalImporte, 95, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, TotalImporte, 95, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
Try
|
||||
Dim FolioIE As Long = -1
|
||||
Dim CveMoneda As Integer = 1
|
||||
Dim TipoCambio As Decimal = 1
|
||||
Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim drOrigen As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
Dim drDestino As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCuentaDeposito.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
Dim CveSubProyecto As Integer = DdlSubProyectos.SelectedValue.ToEntero
|
||||
Dim CveClasificacion As Integer = -1
|
||||
|
||||
Dim CveSubProyectoComision As Integer
|
||||
Dim CveClasificacionComision As Integer
|
||||
|
||||
Dim CveSubProyectoDescuento As Integer
|
||||
Dim CveClasificacionDescuento As Integer
|
||||
|
||||
|
||||
Dim imprimirFolios As String = ""
|
||||
Dim CveSubProyectoIntermediario As Integer
|
||||
Dim CveClasificacionIntermediario As Integer
|
||||
Dim CveProveedorIntermediario As Integer = -1
|
||||
|
||||
If drOrigen IsNot Nothing Then
|
||||
CveMoneda = drOrigen("CveMoneda").ToString.ToEntero
|
||||
End If
|
||||
|
||||
If Not IntermediarioFactura Then ' si factura no se manda al gasto sino se disminuye solo lo depositado
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, ImporteInter, ImporteInter, 51, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
If drDestino IsNot Nothing Then
|
||||
CveMoneda = drDestino("CveMoneda").ToString.ToEntero
|
||||
End If
|
||||
|
||||
If IVA <> 0 Then
|
||||
If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, IVA, IVA, 14, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, PorcentajeImpuesto:=0.16D) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Dim CveTransaccionBanco As Integer = 13
|
||||
|
||||
If TotalImporte < 0 Then 'que es una devolución, entonces como es negativo, se cambia el concetpo de bancos, por condición de trigger
|
||||
CveTransaccionBanco = 6
|
||||
End If
|
||||
NuevaCvePrePoliza = ObjConta.AddPrePolizas("DepCaja", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=1)
|
||||
|
||||
'código temporal, para claudia y toñita, monge, anadelia, alba,patricia
|
||||
If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then
|
||||
FolioIE = TxtFolio.Text.ToEntero
|
||||
End If
|
||||
|
||||
If FolioIE <= 0 Then
|
||||
'Entrada a bancos
|
||||
FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco)
|
||||
End If
|
||||
Dim IntermediarioFactura As Boolean = False
|
||||
If UsuarioActual.CveEmpresa = 145 Then IntermediarioFactura = True
|
||||
If ChkIntermediario.Checked Then
|
||||
|
||||
If CveSubProyecto <= 0 Then 'sino se seleccionó del combo, busca en el listado el primero
|
||||
CveSubProyectoIntermediario = DdlSubProyectoIntermediario.SelectedValue.ToEntero
|
||||
CveClasificacionIntermediario = DdlClasificacionIntermediario.SelectedValue.ToEntero
|
||||
CveProveedorIntermediario = DdlProveedorIntermediario.SelectedValue.ToEntero
|
||||
|
||||
For Each Gvr As GridViewRow In GvFacturas.Rows
|
||||
If Gvr.FCCheckBox("ChkFactura").Checked Then
|
||||
CveSubProyecto = Gvr.DataKey("CveSubProyecto").ToEntero
|
||||
Exit For
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then ' empresa llantera
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, TotalImporte, 95, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, TotalImporte, 95, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If FolioIE <= 0 Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario)
|
||||
|
||||
documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a>     <br/> ", CveIEOrigen, FolioIE)
|
||||
|
||||
If Not OcurrioError AndAlso ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, TotalImporte * TipoCambio, 30, "Depósito Bancario", "Depósito Bancario", CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen) Then
|
||||
|
||||
If ChkFaltante.Checked Then
|
||||
CveSubProyectoComision = DdlSubProyectoDeposito.SelectedValue.ToEntero
|
||||
CveClasificacionComision = DdlClasificacion.SelectedValue.ToEntero
|
||||
If Comision <> 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, Comision * TipoCambio, 78, DdlClasificacion.SelectedItem.Text, DdlClasificacion.SelectedItem.Text, CveClasificacion:=CveClasificacionComision, CveSubProyecto:=CveSubProyectoComision) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
If Not IntermediarioFactura Then ' si factura no se manda al gasto sino se disminuye solo lo depositado
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, ImporteInter, ImporteInter, 51, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ChkDescuento.Checked Then
|
||||
CveSubProyectoDescuento = DdlSubProyectoDescuento.SelectedValue.ToEntero
|
||||
CveClasificacionDescuento = DdlClasificacionDescuento.SelectedValue.ToEntero
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Descuento, Descuento * TipoCambio, 51, DdlClasificacionDescuento.SelectedItem.Text, DdlClasificacionDescuento.SelectedItem.Text & " " & DdlPersonal.SelectedItem.Text, CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyectoDescuento, CvePersonal:=DdlPersonal.SelectedValue.ToEntero) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If IVA <> 0 Then
|
||||
If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, IVA, IVA, 14, DdlClasificacionIntermediario.SelectedItem.Text, DdlClasificacionIntermediario.SelectedItem.Text, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, PorcentajeImpuesto:=0.16D) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
If Not OcurrioError Then
|
||||
Dim i As Integer = 0
|
||||
For Each Gvr As GridViewRow In GvFacturas.Rows
|
||||
Dim CveTransaccionBanco As Integer = 13
|
||||
|
||||
If Gvr.FCCheckBox("ChkFactura").Checked Then
|
||||
'Datos de las Nuevas PrePolizas
|
||||
'Entrada a Bancos
|
||||
If TotalImporte < 0 Then 'que es una devolución, entonces como es negativo, se cambia el concetpo de bancos, por condición de trigger
|
||||
CveTransaccionBanco = 6
|
||||
End If
|
||||
|
||||
Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal
|
||||
Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString
|
||||
'código temporal, para claudia y toñita, monge, anadelia, alba,patricia
|
||||
If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then
|
||||
FolioIE = TxtFolio.Text.ToEntero
|
||||
End If
|
||||
|
||||
'si es el primero, se descuenta la "comisión"
|
||||
If i = 0 AndAlso IntermediarioFactura Then
|
||||
Importe = Importe - ImporteInter
|
||||
i += 1
|
||||
End If
|
||||
If FolioIE <= 0 Then
|
||||
'Entrada a bancos
|
||||
FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco)
|
||||
End If
|
||||
|
||||
'Datos de las Prepolizas A Cancelar
|
||||
Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero
|
||||
Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero
|
||||
Dim CveCuentaBancaria As Integer = Gvr.DataKey("CveCuenta").ToEntero
|
||||
Dim tCveSubProyecto As Integer = Gvr.DataKey("CveSubProyecto").ToEntero
|
||||
If CveSubProyecto <= 0 Then 'sino se seleccionó del combo, busca en el listado el primero
|
||||
|
||||
FolioIE = ObjBancos.GetNextFolio(CveCuentaBancaria, 2)
|
||||
If Not FolioIE > 0 Then
|
||||
OcurrioError = True
|
||||
For Each Gvr As GridViewRow In GvFacturas.Rows
|
||||
If Gvr.FCCheckBox("ChkFactura").Checked Then
|
||||
CveSubProyecto = Gvr.DataKey("CveSubProyecto").ToEntero
|
||||
Exit For
|
||||
End If
|
||||
CveIEDestino = ObjBancos.AddBancos_IE(CveCuentaBancaria, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Next
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, Importe * TipoCambio, 30, SerieFolio, String.Format("Depósito Bancario: {0}", SerieFolio), CveClasificacion:=CveClasificacion, CveSubProyecto:=tCveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Asignamos la cuenta Deposito
|
||||
If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
|
||||
|
||||
documentos += String.Format("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", StrEncript, "Depósito Bancario")
|
||||
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ObjConta.ValidacionesPrePoliza(NuevaCvePrePoliza, UsuarioActual, Opcion:=1) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
GuardaLogAD($"Bancos/DepositoCaja | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{NuevaCvePrePoliza}", "LogPrePolizas")
|
||||
If FolioIE <= 0 Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario)
|
||||
|
||||
documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a>     <br/> ", CveIEOrigen, FolioIE)
|
||||
|
||||
If Not OcurrioError AndAlso ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, TotalImporte * TipoCambio, 30, "Depósito Bancario", "Depósito Bancario", CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen) Then
|
||||
|
||||
If ChkFaltante.Checked Then
|
||||
CveSubProyectoComision = DdlSubProyectoDeposito.SelectedValue.ToEntero
|
||||
CveClasificacionComision = DdlClasificacion.SelectedValue.ToEntero
|
||||
If Comision <> 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, Comision * TipoCambio, 78, DdlClasificacion.SelectedItem.Text, DdlClasificacion.SelectedItem.Text, CveClasificacion:=CveClasificacionComision, CveSubProyecto:=CveSubProyectoComision) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ChkDescuento.Checked Then
|
||||
CveSubProyectoDescuento = DdlSubProyectoDescuento.SelectedValue.ToEntero
|
||||
CveClasificacionDescuento = DdlClasificacionDescuento.SelectedValue.ToEntero
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Descuento, Descuento * TipoCambio, 51, DdlClasificacionDescuento.SelectedItem.Text, DdlClasificacionDescuento.SelectedItem.Text & " " & DdlPersonal.SelectedItem.Text, CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyectoDescuento, CvePersonal:=DdlPersonal.SelectedValue.ToEntero) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
If Not OcurrioError Then
|
||||
Dim i As Integer = 0
|
||||
For Each Gvr As GridViewRow In GvFacturas.Rows
|
||||
|
||||
If Gvr.FCCheckBox("ChkFactura").Checked Then
|
||||
'Datos de las Nuevas PrePolizas
|
||||
'Entrada a Bancos
|
||||
|
||||
Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal
|
||||
Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString
|
||||
|
||||
'si es el primero, se descuenta la "comisión"
|
||||
If i = 0 AndAlso IntermediarioFactura Then
|
||||
Importe = Importe - ImporteInter
|
||||
i += 1
|
||||
End If
|
||||
|
||||
'Datos de las Prepolizas A Cancelar
|
||||
Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero
|
||||
Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero
|
||||
Dim CveCuentaBancaria As Integer = Gvr.DataKey("CveCuenta").ToEntero
|
||||
Dim tCveSubProyecto As Integer = Gvr.DataKey("CveSubProyecto").ToEntero
|
||||
|
||||
FolioIE = ObjBancos.GetNextFolio(CveCuentaBancaria, 2)
|
||||
If Not FolioIE > 0 Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
CveIEDestino = ObjBancos.AddBancos_IE(CveCuentaBancaria, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, Importe * TipoCambio, 30, SerieFolio, String.Format("Depósito Bancario: {0}", SerieFolio), CveClasificacion:=CveClasificacion, CveSubProyecto:=tCveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Asignamos la cuenta Deposito
|
||||
If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
|
||||
|
||||
documentos += String.Format("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", StrEncript, "Depósito Bancario")
|
||||
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ObjConta.ValidacionesPrePoliza(NuevaCvePrePoliza, UsuarioActual, Opcion:=1) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
GuardaLogAD($"Bancos/DepositoCaja | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{NuevaCvePrePoliza}", "LogPrePolizas")
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError Then
|
||||
documentos += String.Format("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", NuevaCvePrePoliza)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
OnError("Ocurrió un error al procesar los datos", ex)
|
||||
End Try
|
||||
|
||||
If OcurrioError Then
|
||||
ObjConta.RollBack()
|
||||
Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError)
|
||||
Alert(MsgError, TipoMensaje.MsgError)
|
||||
Else
|
||||
|
||||
ObjConta.Commit()
|
||||
documentos += String.Format("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", NuevaCvePrePoliza)
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
Try
|
||||
pdf64 = ImpresionDirectaPDF(CveIEOrigen, NuevaCvePrePoliza)
|
||||
Catch ex As Exception
|
||||
pdf64 = ""
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
|
||||
If Not String.IsNullOrEmpty(pdf64) Then
|
||||
RegistraScript($"impresionBase64('{pdf64}');", "Imprimir")
|
||||
Else
|
||||
Alert("No se pudo imprimir el pdf", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
Alert(documentos.ToString)
|
||||
CargaDatos()
|
||||
|
||||
End If
|
||||
|
||||
TxtComision.Text = ""
|
||||
TxtDescuento.Text = ""
|
||||
TxtIVA.Text = ""
|
||||
@@ -462,5 +494,80 @@ Partial Class Bancos_DepositosCaja
|
||||
DDlMesesSinIntereses.Visible = False
|
||||
End If
|
||||
DDlMesesSinIntereses.SelectedValue = "-1"
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Function ImpresionDirectaPDF(CveIEOrigen As Integer, CvePrePoliza As Integer) As String
|
||||
|
||||
Dim PDFPago As Byte() = Nothing
|
||||
Dim PDFPrePoliza As Byte() = Nothing
|
||||
|
||||
Dim ParametrosPago As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}&TipoPago={DdlTipoPago.SelectedItem.Text}")
|
||||
Dim ParametrosPrePoliza As String = Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")
|
||||
|
||||
Try
|
||||
PDFPago = DescargarPDF(ParametrosPago, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)
|
||||
If PDFPago IsNot Nothing Then
|
||||
PDFPrePoliza = DescargarPDF(ParametrosPrePoliza, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
GuardaLog(ex.ToString())
|
||||
|
||||
PDFPago = Nothing
|
||||
PDFPrePoliza = Nothing
|
||||
End Try
|
||||
|
||||
If PDFPago IsNot Nothing AndAlso PDFPrePoliza IsNot Nothing Then
|
||||
Dim pdf64 As String = ""
|
||||
'UNIFICAR LOS 2 PDF
|
||||
Using ms As New MemoryStream
|
||||
Using pdfdoc As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfWriter(ms))
|
||||
pdfdoc.InitializeOutlines()
|
||||
|
||||
Dim docPago As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfReader(New MemoryStream(PDFPago)))
|
||||
docPago.CopyPagesTo(1, docPago.GetNumberOfPages(), pdfdoc)
|
||||
docPago.Close()
|
||||
|
||||
Dim docPrePoliza As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfReader(New MemoryStream(PDFPrePoliza)))
|
||||
docPrePoliza.CopyPagesTo(1, docPrePoliza.GetNumberOfPages(), pdfdoc)
|
||||
docPrePoliza.Close()
|
||||
|
||||
pdfdoc.Close()
|
||||
End Using
|
||||
pdf64 = Convert.ToBase64String(ms.ToArray())
|
||||
End Using
|
||||
|
||||
Return pdf64
|
||||
Else
|
||||
Return ""
|
||||
End If
|
||||
|
||||
End Function
|
||||
Private Function DescargarPDF(Parametros As String, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional strURLHOST As String = "") As Byte()
|
||||
|
||||
If String.IsNullOrEmpty(strURLHOST) Then
|
||||
strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
End If
|
||||
|
||||
Dim Url As New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Parametros))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient As New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 0, 40)
|
||||
Using request As New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
File = Nothing
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
Return File
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -1418,7 +1418,11 @@ Partial Class PopUpVerFactura
|
||||
'IMPRIME DEPOSITOS CAJA
|
||||
If UrlParametros("OP").ToString = "DC" Then
|
||||
If UrlParametros("CVEIE") IsNot Nothing AndAlso UrlParametros("CVEIE").ToString.ToEntero > 0 Then
|
||||
CargaDepositosCaja(UrlParametros("CVEIE").ToString.ToEntero, UrlParametros("CUENTACAJA").ToString, UrlParametros("CUENTADEPO").ToString)
|
||||
Dim TipoPago As String = ""
|
||||
If UrlParametros("TIPOPAGO") IsNot Nothing Then
|
||||
TipoPago = UrlParametros("TIPOPAGO").ToString()
|
||||
End If
|
||||
CargaDepositosCaja(UrlParametros("CVEIE").ToString.ToEntero, UrlParametros("CUENTACAJA").ToString, UrlParametros("CUENTADEPO").ToString, TipoPago)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -5261,22 +5265,25 @@ Partial Class PopUpVerFactura
|
||||
#End Region
|
||||
|
||||
#Region "OP = 'DC' - DEPOSITOS CAJA"
|
||||
Private Sub CargaDepositosCaja(CveIE As Integer, CuentaCaja As String, CuentaDeposito As String)
|
||||
Private Sub CargaDepositosCaja(CveIE As Integer, CuentaCaja As String, CuentaDeposito As String, TipoPago As String)
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/DepositoCaja.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
Dim Tabla As DataTable = Nothing
|
||||
|
||||
Dim ObjIE As New ClsBancos()
|
||||
Dim Tabla As DataTable
|
||||
ObjIE.GetBancosIEMovimientosDepositos(CveIE, UsuarioActual.CveEmpresa)
|
||||
If ObjIE.GetBancosIEMovimientosDepositos(CveIE, UsuarioActual.CveEmpresa) Then
|
||||
Tabla = ObjIE.DtResultados.Copy()
|
||||
End If
|
||||
ObjIE.Dispose()
|
||||
|
||||
|
||||
If ObjIE.DtResultados IsNot Nothing AndAlso ObjIE.DtResultados.Rows.Count > 0 Then
|
||||
Tabla = ObjIE.DtResultados
|
||||
If Tabla IsNot Nothing AndAlso Tabla.Rows.Count > 0 Then
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("Fecha", NowADS().ToDateTime.ToString))
|
||||
params.Add(New ReportParameter("FechaIE", ObjIE.DtResultados(0)("FechaDocumento").ToString.ToDate.ToShortDateString))
|
||||
params.Add(New ReportParameter("FechaIE", Tabla(0)("FechaDocumento").ToString.ToDate.ToShortDateString))
|
||||
params.Add(New ReportParameter("CuentaCaja", CuentaCaja))
|
||||
params.Add(New ReportParameter("CuentaDeposito", CuentaDeposito))
|
||||
params.Add(New ReportParameter("TipoPago", TipoPago))
|
||||
|
||||
If Archivo.Exists Then
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
@@ -5287,11 +5294,6 @@ Partial Class PopUpVerFactura
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
ObjIE.Dispose()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
<Width>0.96697in</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>4.66607in</Width>
|
||||
<Width>3.81815in</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>0.98425in</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>0.84873in</Width>
|
||||
@@ -158,6 +161,50 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox9">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Tipo Pago</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Center</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox9</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<TopBorder>
|
||||
<Color>DimGray</Color>
|
||||
<Style>Solid</Style>
|
||||
<Width>1pt</Width>
|
||||
</TopBorder>
|
||||
<BottomBorder>
|
||||
<Color>DimGray</Color>
|
||||
<Style>Solid</Style>
|
||||
<Width>1pt</Width>
|
||||
</BottomBorder>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox10">
|
||||
@@ -346,6 +393,49 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="TipoPago">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!TipoPago.Value</Value>
|
||||
<Style>
|
||||
<FontSize>8pt</FontSize>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Left</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>TipoPago</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<TopBorder>
|
||||
<Color>DimGray</Color>
|
||||
<Style>Solid</Style>
|
||||
<Width>1pt</Width>
|
||||
</TopBorder>
|
||||
<BottomBorder>
|
||||
<Color>DimGray</Color>
|
||||
<Style>Solid</Style>
|
||||
<Width>1pt</Width>
|
||||
</BottomBorder>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Importe">
|
||||
@@ -401,6 +491,7 @@
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
</TablixMembers>
|
||||
</TablixColumnHierarchy>
|
||||
<TablixRowHierarchy>
|
||||
@@ -417,7 +508,7 @@
|
||||
<DataSetName>DataSet1</DataSetName>
|
||||
<Top>1.43975in</Top>
|
||||
<Height>0.43in</Height>
|
||||
<Width>7.75822in</Width>
|
||||
<Width>7.89456in</Width>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
@@ -876,11 +967,99 @@
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<Textbox Name="Textbox25">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Tipo Pago:</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Left</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value />
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Left</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox12</rd:DefaultName>
|
||||
<Top>2.96905cm</Top>
|
||||
<Left>12.49038cm</Left>
|
||||
<Height>0.53299cm</Height>
|
||||
<Width>2.14725cm</Width>
|
||||
<ZIndex>13</ZIndex>
|
||||
<Visibility>
|
||||
<Hidden>=(Parameters!TipoPago.Value = "")</Hidden>
|
||||
</Visibility>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<Textbox Name="Textbox36">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Parameters!TipoPago.Value</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
<Format>dd/MM/yyyy</Format>
|
||||
<Language>es-MX</Language>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Left</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox12</rd:DefaultName>
|
||||
<Top>2.96905cm</Top>
|
||||
<Left>15.61669cm</Left>
|
||||
<Height>0.53299cm</Height>
|
||||
<Width>3.76632cm</Width>
|
||||
<ZIndex>14</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</ReportItems>
|
||||
<Height>5.34917cm</Height>
|
||||
<Style />
|
||||
</Body>
|
||||
<Width>19.70589cm</Width>
|
||||
<Width>20.05217cm</Width>
|
||||
<Page>
|
||||
<PageFooter>
|
||||
<Height>0.02646cm</Height>
|
||||
@@ -934,6 +1113,10 @@
|
||||
<DataField>Cliente</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="TipoPago">
|
||||
<DataField>TipoPago</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="Importe">
|
||||
<DataField>Importe</DataField>
|
||||
<rd:TypeName>System.Double</rd:TypeName>
|
||||
@@ -979,6 +1162,12 @@
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
<ReportParameter Name="TipoPago">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
</ReportParameters>
|
||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||
<rd:ReportID>8ca56a24-e4cd-4986-9105-84383a48863b</rd:ReportID>
|
||||
|
||||
Reference in New Issue
Block a user