Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4446,5 +4446,312 @@ Public Class ClsBancos
|
||||
End Function
|
||||
|
||||
|
||||
#Region "N O T I F I C A C I O N E S D E P A G O P R O V E E D O R E S"
|
||||
|
||||
Public Function NotificacionPago(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActual As Usuario) As Boolean
|
||||
|
||||
Dim RutaComprobante As String = ""
|
||||
If GetBancosIE(CveIENotificar, UsuarioActual.CveEmpresa) Then
|
||||
RutaComprobante = Comprobante
|
||||
End If
|
||||
|
||||
|
||||
Dim Body As String = GeneraCorreo(CveIENotificar, UsuarioActual)
|
||||
'Dim Comprobante As String = ""
|
||||
|
||||
Dim File As Byte() = Nothing
|
||||
|
||||
|
||||
'If MostrarConfirmacion Then
|
||||
Return MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, RutaComprobante, File, UsuarioActual, CopiaPara)
|
||||
'Else
|
||||
' Dim Hilo As New Threading.Thread(Sub() MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, RutaComprobante, File, UsuarioActual, MostrarConfirmacion, CopiaPara))
|
||||
' Hilo.Start()
|
||||
'End If
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Private Function MandaCorreo(Para As String, Asunto As String, Body As String, RutaComprobante As String, File As Byte(), UsuarioActual As Usuario, CopiaPara As String) As Boolean
|
||||
|
||||
Dim Respuesta As Boolean = False
|
||||
|
||||
Try
|
||||
Dim Mail As New ClsSisMail()
|
||||
Para = If(Para IsNot Nothing, Para, "")
|
||||
Asunto = If(Asunto IsNot Nothing, Asunto, "")
|
||||
Body = If(Body IsNot Nothing, Body, "")
|
||||
|
||||
Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail)
|
||||
|
||||
If RutaComprobante IsNot Nothing AndAlso RutaComprobante <> "" Then
|
||||
ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaComprobante})
|
||||
End If
|
||||
|
||||
If File IsNot Nothing Then
|
||||
ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"})
|
||||
End If
|
||||
|
||||
Dim separador As Char() = {";"c, ","c}
|
||||
Dim strArray As String() = Para.Split(separador)
|
||||
|
||||
Para = ""
|
||||
|
||||
For Each sCorreo As String In strArray
|
||||
If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then
|
||||
Para = $"{Para}{sCorreo};"
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If Para.Length > 0 Then
|
||||
|
||||
Para = Para.Substring(0, Para.Length - 1)
|
||||
|
||||
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}", CCP:=CopiaPara) Then
|
||||
|
||||
Respuesta = True
|
||||
'If MostrarConfirmacion Then
|
||||
' Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
'If MostrarConfirmacion Then
|
||||
' Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||||
'End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrio un error al enviar el correo", ex)
|
||||
|
||||
|
||||
End Try
|
||||
|
||||
Return Respuesta
|
||||
|
||||
End Function
|
||||
|
||||
Private Function GeneraCorreo(CveIENotificar As Integer, UsuarioActual As Usuario) As String
|
||||
|
||||
Dim strBody As New StringBuilder
|
||||
|
||||
|
||||
If GetBancosIE(CveIENotificar, UsuarioActual.CveEmpresa) Then
|
||||
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
||||
strBody.Append("<head> ")
|
||||
strBody.Append(" <style type=""text/css""> ")
|
||||
strBody.Append(" body ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" margin:0px; ")
|
||||
strBody.Append(" padding:0px 0px 0px 0px; ")
|
||||
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
||||
strBody.Append(" font-size: 10px; ")
|
||||
strBody.Append(" background-color:#F0F0F0; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" a.Texto ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" font-size:11px; ")
|
||||
strBody.Append(" background-color:#F7F6F3; ")
|
||||
strBody.Append(" text-decoration:none; ")
|
||||
strBody.Append(" font-weight:bold; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Texto ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .TextoAlterno ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
||||
strBody.Append(" vertical-align:middle; height:20px;")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .BarraIdentidad ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" color:#FFFFFF; ")
|
||||
strBody.Append(" background:#F0F0F0; ")
|
||||
strBody.Append(" font-weight:bold; ")
|
||||
strBody.Append(" font-size:19px; ")
|
||||
strBody.Append(" font-style:oblique; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Titulos ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color: Gray;")
|
||||
strBody.Append(" color:White; ")
|
||||
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
||||
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
||||
strBody.Append(" text-decoration:none; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Verde {color: #00CC00;} ")
|
||||
strBody.Append(" .Negro {color: #000000;} ")
|
||||
strBody.Append(" .Rojo {color: #FF0000;} ")
|
||||
strBody.Append(" </style> ")
|
||||
strBody.Append("</head> ")
|
||||
strBody.Append("<body> ")
|
||||
strBody.AppendFormat("<div id='C_div' style='width: 600px'>")
|
||||
strBody.AppendFormat(" <fieldset>")
|
||||
strBody.AppendFormat(" <legend><b>{0}</b></legend>", UsuarioActual.Empresa.Empresa)
|
||||
strBody.AppendFormat(" <table class='TextoG' border='0' cellpadding='0' cellspacing='0' width='100%'>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td style='width:100px'>{0}</td>", UsuarioActual.Empresa.Direccion)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td>Col. {0}</td>", UsuarioActual.Empresa.Colonia)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td>{0}, {1}, C.P.{2}</td>", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td>RFC {0}</td>", UsuarioActual.Empresa.RFC)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" </table>")
|
||||
strBody.AppendFormat(" </fieldset>")
|
||||
strBody.AppendFormat("</div><br/><br/>")
|
||||
|
||||
strBody.AppendFormat("<div style='width: 600px'>")
|
||||
strBody.AppendFormat(" <fieldset>")
|
||||
strBody.AppendFormat(" <legend><b> </b></legend>")
|
||||
strBody.AppendFormat(" <table class='TextoG' style='width:100%'>")
|
||||
|
||||
If CveTipoTransaccion = 1 Then ' cuando es cheque
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.Append(" <td>Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.</td> ")
|
||||
strBody.Append(" </tr> ")
|
||||
End If
|
||||
|
||||
If CveTipoTransaccion.Contiene(2, 9, 17) Then ' cuando es transf
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.Append(" <td>Notificación de transferencia de pago realizada.</td> ")
|
||||
strBody.Append(" </tr> ")
|
||||
End If
|
||||
|
||||
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td> </td> ")
|
||||
strBody.Append(" </tr> ")
|
||||
strBody.Append(" </table> ")
|
||||
strBody.AppendFormat(" </fieldset>")
|
||||
strBody.Append(" </div> ")
|
||||
|
||||
|
||||
strBody.AppendFormat("<div style='width: 600px'>")
|
||||
strBody.AppendFormat(" <table style='width:100%'>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td style='vertical-align: top'>")
|
||||
strBody.AppendFormat(" <fieldset>")
|
||||
strBody.AppendFormat(" <legend>Beneficiario:<b>{0}</b> </legend>", PagueseA)
|
||||
strBody.AppendFormat(" <table width='100%'>")
|
||||
strBody.AppendFormat(" <tr style='background-color: gray; color: White; font-family: Verdana; font-size: 10px; text-align: center; vertical-align: middle; font-weight: bold; height: 20px; text-decoration: none;'>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width:150px;'></th>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width:450px;'></th>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Movimiento:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", TipoTransaccion)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Banco:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", Banco)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Cuenta:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", NumCuenta)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
If CuentaDepositado.ToString <> "" Then
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Cuenta Destino:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", CuentaDepositado)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
End If
|
||||
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Fecha:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", FechaDocumento.ToString("dd/MM/yyyy"))
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Importe:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>$ {0} {1}</td>", Importe.FormatoNumero, Moneda)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>Observaciones:</td>")
|
||||
strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", Observaciones)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td colspan='2'>")
|
||||
strBody.AppendFormat(" <hr />")
|
||||
strBody.AppendFormat(" </td>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" </table>")
|
||||
strBody.AppendFormat(" </fieldset>")
|
||||
strBody.AppendFormat(" </td>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" </table>")
|
||||
strBody.AppendFormat("</div>")
|
||||
|
||||
|
||||
|
||||
|
||||
'MOVIMIENTOS CHEQUE
|
||||
If GetBancosIEMovimientos(CveIENotificar, UsuarioActual.CveEmpresa) Then
|
||||
Dim Textov33 As String = ""
|
||||
If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then
|
||||
Textov33 = "Favor de emitir complemento de pago de los siguientes documentos"
|
||||
End If
|
||||
|
||||
|
||||
strBody.AppendFormat("<div style='width: 1000px'>")
|
||||
strBody.AppendFormat(" <table style='width:1000px'>")
|
||||
strBody.AppendFormat(" <tr>")
|
||||
strBody.AppendFormat(" <td style='vertical-align: top'>")
|
||||
strBody.AppendFormat(" <fieldset>")
|
||||
strBody.AppendFormat(" <legend><b>Documentos abonados o pagados <br/>{0}</b> </legend>", Textov33)
|
||||
strBody.AppendFormat(" <table width='1000px'>")
|
||||
strBody.AppendFormat(" <tr style='background-color: gray; color: White; font-family: Verdana; font-size: 10px; text-align: center; vertical-align: middle; font-weight: bold; height: 20px; text-decoration: none;'>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width: 10%'>Fecha</th>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width: 20%'>Factura</th>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width: 20%'>Importe ($)</th>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width: 40%'>Folio Fiscal</th>")
|
||||
strBody.AppendFormat(" <th scope='col' style='width: 15%'>NC Aplicadas</th>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
|
||||
|
||||
For Each dr As DataRow In DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td>{0}</td>", dr("Fecha").ToString.ToDate.ToShortDateString())
|
||||
strBody.AppendFormat(" <td>{0}</td>", dr("SerieFolio").ToString)
|
||||
strBody.AppendFormat(" <td style='text-align: right'>$ {0}</td>", dr("Importe").ToString.FormatoNumero)
|
||||
strBody.AppendFormat(" <td>{0}</td>", dr("FolioFiscal"))
|
||||
strBody.AppendFormat(" <td>{0}</td>", dr("ImporteNC").ToString.FormatoNumero)
|
||||
strBody.AppendFormat(" </tr>")
|
||||
Next
|
||||
|
||||
|
||||
strBody.AppendFormat(" <tr class='Texto'>")
|
||||
strBody.AppendFormat(" <td colspan='5'>")
|
||||
strBody.AppendFormat(" <hr />")
|
||||
strBody.AppendFormat(" </td>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" </table>")
|
||||
strBody.AppendFormat(" </fieldset>")
|
||||
strBody.AppendFormat(" </td>")
|
||||
strBody.AppendFormat(" </tr>")
|
||||
strBody.AppendFormat(" </table>")
|
||||
strBody.AppendFormat("</div>")
|
||||
End If
|
||||
|
||||
strBody.Append(" <div> Favor de no responder a este correo. </div> ")
|
||||
|
||||
strBody.Append("</body></html>")
|
||||
End If
|
||||
|
||||
'objIE.Dispose()
|
||||
Return strBody.ToString
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
@@ -4820,6 +4820,7 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Ventas/RepVentasMensualesDetalle.aspx".ToUpper(), 721)
|
||||
PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722)
|
||||
PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723)
|
||||
PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 704)
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
@@ -1643,6 +1643,43 @@ Public Class ClsVentas
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
'Reporte de Ventas - Auxiliar Facturas
|
||||
Public Function GetRepAuxliarFacturas(CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CvePS As Integer, FechaI As Date, FechaF As Date,
|
||||
CveCliente As Integer, CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, CveEmpresa As Integer,
|
||||
Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1, Optional CveUsuarioConsulta As Integer = -1, Optional TipoDocto As String = "-1") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_RepAuxiliarGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@FechaI", SqlDbType.Date).Value = FechaI
|
||||
.Add("@FechaF", SqlDbType.Date).Value = FechaF
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio
|
||||
.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico
|
||||
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta
|
||||
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el reporte auxiliar de facturas de venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016
|
||||
|
||||
@@ -26,85 +26,21 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
}
|
||||
}
|
||||
|
||||
private Usuario ValidaUsuarioSistema(int CveEmpresa)
|
||||
{
|
||||
Usuario UsuarioActual = null;
|
||||
ClsSisUsuarios ObjUsuarios = new ClsSisUsuarios();
|
||||
if (ObjUsuarios.GetUsuarios(1727))
|
||||
{
|
||||
if (ObjUsuarios.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
var Usuario = ObjUsuarios.DtResultados.Rows[0]["Usuario"].ToString();
|
||||
var Contrasenia = ObjUsuarios.DtResultados.Rows[0]["Contraseña"].ToString();
|
||||
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, ModExtensiones.IMEI, CveEmpresa);
|
||||
|
||||
UsuarioActual.CveEmpresa = CveEmpresa;
|
||||
UsuarioActual.CveCliente = 183798;
|
||||
|
||||
CreaObjetoEmpresa(ref UsuarioActual);
|
||||
CargaZonasHorarias(ref UsuarioActual);
|
||||
}
|
||||
}
|
||||
ObjUsuarios.Dispose();
|
||||
return UsuarioActual;
|
||||
}
|
||||
private void CreaObjetoEmpresa(ref Usuario UsuarioActual)
|
||||
{
|
||||
ClsSisEmpresas ObjEmpresa = new ClsSisEmpresas();
|
||||
if (ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1"))
|
||||
{
|
||||
if (ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
System.Data.DataTable dttmp = ObjEmpresa.DtResultados;
|
||||
|
||||
var EmpresasFuncionalidades = new HybridDictionary();
|
||||
foreach (System.Data.DataRow Row in dttmp.Rows)
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row["CveFuncionalidad"]), Row["Valor"].ToString());
|
||||
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades);
|
||||
}
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa;
|
||||
}
|
||||
ObjEmpresa.Dispose();
|
||||
}
|
||||
private void CargaZonasHorarias(ref Usuario UsuarioActual)
|
||||
{
|
||||
ClsClientes ObjClientes = new ClsClientes();
|
||||
try
|
||||
{
|
||||
if (ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus: 1))
|
||||
{
|
||||
if (ObjClientes.DtResultados.Rows.Count == 1)
|
||||
UsuarioActual.UTCOffset = ObjClientes.DtResultados.Rows[0]["UTCOffset"].ToString().ToEntero();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString().GuardaLog();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ObjClientes.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReusable => false;
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
context.Response.ContentType = "text/plain";
|
||||
bool retorno = false;
|
||||
try
|
||||
{
|
||||
context.Response.ContentType = "text/plain";
|
||||
bool retorno = false;
|
||||
|
||||
string Metodo = context.Request["Metodo"] == null ? "" : context.Request["Metodo"];
|
||||
switch (Metodo)
|
||||
{
|
||||
case "EjecutaServicio":
|
||||
ModExtensiones.GuardaLogAD("Servicio Ejecutado...........", "LogServicioConfiable");
|
||||
IniciarTransmision(context);
|
||||
retorno = true;
|
||||
retorno = IniciarTransmision();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -123,11 +59,14 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
{
|
||||
ex.GuardaLog(ex.Message);
|
||||
}
|
||||
|
||||
context.Response.End();
|
||||
}
|
||||
|
||||
private void IniciarTransmision(HttpContext context)
|
||||
private bool IniciarTransmision()
|
||||
{
|
||||
var UsuarioActual = ValidaUsuarioSistema(121);
|
||||
var retorno = false;
|
||||
var TieneError = false;
|
||||
|
||||
var WS = new RCGPSService.RCServiceClient();
|
||||
|
||||
@@ -142,6 +81,10 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
{
|
||||
DtTrackings = ObjGPS.DtResultados.Copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
TieneError = true;
|
||||
}
|
||||
|
||||
if (DtTrackings != null)
|
||||
{
|
||||
@@ -152,6 +95,10 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
{
|
||||
dtTracking = ObjGPS.DtResultados.Copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
TieneError = true;
|
||||
}
|
||||
if (dtTracking != null)
|
||||
{
|
||||
foreach (DataRow Row in dtTracking.Rows)
|
||||
@@ -175,6 +122,7 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TieneError = true;
|
||||
this.OnError("Ocurrió un error al enviar los datos", ex);
|
||||
}
|
||||
ObjGPS.Dispose();
|
||||
@@ -182,15 +130,22 @@ public class SIGGPSRCService : IHttpHandler, IRequiresSessionState
|
||||
DtTrackings.Dispose();
|
||||
DtTrackings = null;
|
||||
|
||||
if (ListaEventos.Count > 0)
|
||||
if (ListaEventos.Count > 0 && !TieneError)
|
||||
{
|
||||
|
||||
var respuesta = WS.GPSAssetTracking(Token.token, ListaEventos.ToArray());
|
||||
context.Response.Write(JsonConvert.SerializeObject(respuesta));
|
||||
if (respuesta.Length > 0)
|
||||
{
|
||||
retorno = !TieneError;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
retorno = !TieneError;
|
||||
}
|
||||
|
||||
WS.Close();
|
||||
//context.Response.Write(JsonConvert.SerializeObject(new { idJob = "1", exception = "" }));
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
153
Bancos/IE.aspx
153
Bancos/IE.aspx
@@ -441,6 +441,115 @@
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="portlet light xspadding bordered " runat="server" id="DVDevolucion" visible="false">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Notas de Crédito</span>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
|
||||
<a href="javascript:;" class="remove" data-original-title="" title=""></a>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body ">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpGvNotas" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvA" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Notas de Crédito" DataKeyNames="CveCompra,Saldo,SerieFolio,Fecha"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" GridLines="None" BorderColor="#D3D3D3" BorderWidth="1">
|
||||
<Columns>
|
||||
<asp:TemplateField ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
|
||||
|
||||
<HeaderTemplate>
|
||||
<input type="checkbox" class="form-check-input" id="ChkSelector" onclick="SelectorNotas(this)">
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="Chk" runat="server" CssClass="CssSelector" onclick="FCSumaTotalesNotas()" />
|
||||
</ItemTemplate>
|
||||
|
||||
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-Width="100px" HeaderText="NC">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink ID="HplFactura" runat="server" CssClass="Texto" Text='<%# Eval("SerieFolio")%>' NavigateUrl='<%# If(Eval("CveCompra").ToString <> "0", Eval("CveCompra", "/Compras/Compras.aspx?CveCompra={0}"), If(Eval("CveIE").ToString <> "0", Eval("CveIE", "/Bancos/IE.aspx?CveIE={0}"), ""))%>'></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Fecha">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Original" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Saldo" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField Visible="False" HeaderText="Abonar">
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="ImgAbonar" runat="server" ImageUrl="~/Imagenes/Money_add.png" AlternateText="Registrar Pago/Abono" Style="cursor: pointer;" Visible="False" />
|
||||
<%-- Visible='<%# Eval("CveCompra").ToString <> "" andalso CDbl(Eval("Saldo")) > 0%>' />--%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Devolución" ItemStyle-HorizontalAlign="Center" Visible="false" ItemStyle-Width="50px">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink ID="HLDevolverDinero" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-usd'></i>" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<AlternatingRowStyle CssClass="TextoAlterno" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
|
||||
|
||||
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="ModalUpload" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
@@ -872,6 +981,8 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
@@ -1163,6 +1274,7 @@
|
||||
</div>
|
||||
|
||||
<%-- COMPLEMENTOS PAGO --%>
|
||||
|
||||
<div id="ModalComplementoPagos" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel ID="UpComplementoPagos" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
@@ -1569,7 +1681,46 @@
|
||||
$get("BtnCambiaTipoMoneda").click();
|
||||
TipoCambioActual = TipoCambioTxt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SelectorNotas(Chk) {
|
||||
|
||||
$(`.CssSelector input[type=checkbox]`).each(function () {
|
||||
$(this).prop('checked', Chk.checked);
|
||||
});
|
||||
|
||||
FCSumaTotalesNotas()
|
||||
}
|
||||
|
||||
|
||||
function FCSumaTotalesNotas() {
|
||||
var Total = 0.0;
|
||||
|
||||
$(`.CssSelector input[type=checkbox]`).each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
Total += parseFloat($(this).attr("data-saldo"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (Total > 0) {
|
||||
|
||||
$(`#TxtImporte`).val(Total);
|
||||
|
||||
FormatoMoneda( $get("TxtImporte"));
|
||||
|
||||
} else {
|
||||
$(`#TxtImporte`).val("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function DeshabilitarTxt(){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -148,7 +148,14 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
Private Property SerieFolioDeCDin As String
|
||||
Get
|
||||
Return ViewState("SerieFolioDeCDin").ToString
|
||||
|
||||
If ViewState("SerieFolioDeCDin") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("SerieFolioDeCDin").ToString
|
||||
End If
|
||||
|
||||
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("SerieFolioDeCDin") = value
|
||||
@@ -438,7 +445,12 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
Private Property CveCorte As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveCorte"), -1, ViewState("CveCorte").ToString().ToString()).ToString().ToEntero()
|
||||
If ViewState("CveCorte") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveCorte").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCorte") = value
|
||||
@@ -446,6 +458,21 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
|
||||
|
||||
Private Property Masivonotas As Boolean
|
||||
Get
|
||||
|
||||
If ViewState("Masivonotas") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return Boolean.Parse(ViewState("Masivonotas").ToString)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("Masivonotas") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CANCELACIÓN COMPLEMENTO MODAL V2"
|
||||
|
||||
Property CveComplementoPagoCancelar As Integer
|
||||
@@ -544,7 +571,7 @@ Partial Class Bancos_IE
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If Not IsPostBack Then
|
||||
|
||||
Me.CveCorte = -1
|
||||
Folio = ""
|
||||
IDCtaBeneficiario = 0
|
||||
IDCtaBeneficiarioComplementaria = 0
|
||||
@@ -572,6 +599,8 @@ Partial Class Bancos_IE
|
||||
'Guarda el modo actual de la pagina
|
||||
Opcion = If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "-1")
|
||||
|
||||
Masivonotas = If(Request("Masivo") IsNot Nothing, True, False)
|
||||
|
||||
Session("FileUpload") = ""
|
||||
TRCveIE.Visible = False
|
||||
|
||||
@@ -604,6 +633,18 @@ Partial Class Bancos_IE
|
||||
CargaProveedor(CveProveedor, "-1")
|
||||
End If
|
||||
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" AndAlso Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then
|
||||
If Masivonotas Then
|
||||
'CargaNotas()
|
||||
DVDevolucion.Visible = True
|
||||
HdnCveProveedor.Value = Request("CveProveedor")
|
||||
DivOtrosIngresosEgresos.Visible = False
|
||||
End If
|
||||
TxtImporte.Attributes.Add("onkeypress", "javascript: return false;")
|
||||
End If
|
||||
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then
|
||||
LblPagueseA.Text = ""
|
||||
LblPagueseA.Visible = False
|
||||
@@ -1225,6 +1266,7 @@ Partial Class Bancos_IE
|
||||
Dim EsDevolucion As Boolean = False
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" Then
|
||||
CveIE = -1
|
||||
EsDevolucion = True
|
||||
RBL.SelectedValue = "P"
|
||||
RBL.Enabled = False
|
||||
@@ -1237,6 +1279,8 @@ Partial Class Bancos_IE
|
||||
DdlProveedores.SelectedValue = ObjProveedor.CveProveedor.ToString
|
||||
DivOtrosIngresosEgresos.Visible = True
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Select Case RBL.SelectedValue
|
||||
@@ -1289,6 +1333,78 @@ Partial Class Bancos_IE
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Private Sub CargaNotas(CvemonedaInterna As Integer)
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
|
||||
If CvemonedaInterna > 0 Then
|
||||
If ObjMovtos.GetAnticiposProveedor(CveProveedor, -1, CvemonedaInterna, -1) AndAlso ObjMovtos.DtResultados.FiltraParametros("TipoDocto = 'NC'").Rows.Count > 0 Then
|
||||
GvA.DataSource = ObjMovtos.DtResultados.FiltraParametros("TipoDocto = 'NC' and Saldo > 0 and CveCompra > 0")
|
||||
|
||||
Else
|
||||
GvA.DataSource = Nothing
|
||||
End If
|
||||
Else
|
||||
GvA.DataSource = Nothing
|
||||
End If
|
||||
|
||||
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
|
||||
GvA.DataBind()
|
||||
UpGvNotas.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvAH_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvA.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.RowIndex = 0 Then 'e.Row.BackColor = Drawing.Color.LightGray
|
||||
|
||||
e.Row.Cells(1).Width = Unit.Pixel(120)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(100)
|
||||
End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "Egsc" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(1).Text = "Egreso Por Comprobar"
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "Ant" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(1).Text = "Anticipos"
|
||||
'End If
|
||||
|
||||
If e.Row.DBCampo("TipoDocto") = "NC" AndAlso e.Row.DataKey("CveCompra").ToString.ToEntero > 0 Then
|
||||
e.Row.FCCheckBox("Chk").InputAttributes.Add("data-saldo", e.Row.DataKey("Saldo"))
|
||||
End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "DEV" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(0).Text = "Devolución"
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("CveProveedor") = "" Then
|
||||
' e.Row.BackColor = Drawing.Color.LightGray
|
||||
'End If
|
||||
|
||||
'If UsuarioActual.TienePermisoProceso(273) Then
|
||||
' If CType(sender, GridView).ID = "GvA" And e.Row.DBCampo("CveCompra").ToEntero > 0 And e.Row.DBCampo("TipoDocto") = "NC" Then
|
||||
' Dim Parametros = Encripta($"CveCompra={e.Row.DBCampo("CveCompra").ToEntero}&SerieFolio={e.Row.DBCampo("SerieFolio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveProveedor={CveProveedor}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}&FechaCompra={e.Row.DBCampo("Fecha")}")
|
||||
' e.Row.FCHyperLink("HLDevolverDinero").Visible = True
|
||||
' e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinC&P={Parametros}"
|
||||
' End If
|
||||
'End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region " CARGA CLIENTE "
|
||||
Protected Sub DdlCliente_selectedindexchange(sender As Object, e As EventArgs)
|
||||
HdnCveCliente.Value = DdlCliente.SelectedValue
|
||||
@@ -1445,6 +1561,15 @@ Partial Class Bancos_IE
|
||||
Banco.Dispose()
|
||||
TxtFolio.Text = Folio.ToString
|
||||
|
||||
Dim drI As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue))
|
||||
|
||||
If drI IsNot Nothing Then
|
||||
CargaNotas(drI("CveMoneda").ToString.ToEntero)
|
||||
Else
|
||||
CargaNotas(-1)
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
TxtFolio.Text = ""
|
||||
End If
|
||||
@@ -1676,7 +1801,7 @@ Partial Class Bancos_IE
|
||||
|
||||
|
||||
|
||||
If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then
|
||||
If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Or Opcion = "DevDinC" AndAlso Masivonotas Then
|
||||
DdlTipoTransaccion.DataSource = dt.FiltraParametros("Tipo = 'Ing' ")
|
||||
Else
|
||||
DdlTipoTransaccion.DataSource = dt
|
||||
@@ -2862,235 +2987,513 @@ Partial Class Bancos_IE
|
||||
End If
|
||||
|
||||
Dim TCCompra As Decimal = 1
|
||||
Dim TCDocumento As Decimal = 1
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'BANCOS
|
||||
Dim TCDocumento As Decimal = 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'BANCOS
|
||||
IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0)
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
'OTROS INGRESOS/EGRESOS
|
||||
If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
Dim TipoMovtoIE As Boolean = False
|
||||
Dim CveConcIE As Integer = 78
|
||||
If Impo > 0 Then
|
||||
TipoMovtoIE = True
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 78
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
Else
|
||||
TipoMovtoIE = False
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 211
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
|
||||
If Masivonotas Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvA.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCCheckBox("Chk").Checked Then
|
||||
|
||||
|
||||
Dim FechaCompraNota As Date = GvRow.DataKey("Fecha").ToDate
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompraNota).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ImporteAplicar = GvRow.DataKey("Saldo").ToDecimal
|
||||
ImporteAplicarME = ImporteAplicar
|
||||
|
||||
|
||||
'CONSIDERA COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ImporteAplicar
|
||||
Else
|
||||
ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
End If
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(GvRow.DataKey("Fecha").ToDate).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {ImporteAplicar} NC:{GvRow.DataKey("SerieFolio")}"
|
||||
|
||||
CveCompraDeCDin = GvRow.DataKey("CveCompra").ToEntero
|
||||
|
||||
''
|
||||
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
''OTROS INGRESOS/EGRESOS
|
||||
'If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
' Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
' Dim TipoMovtoIE As Boolean = False
|
||||
' Dim CveConcIE As Integer = 78
|
||||
' If Impo > 0 Then
|
||||
' TipoMovtoIE = True
|
||||
' Impo = Math.Abs(Impo)
|
||||
' CveConcIE = 78
|
||||
' IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
' Else
|
||||
' TipoMovtoIE = False
|
||||
' Impo = Math.Abs(Impo)
|
||||
' CveConcIE = 211
|
||||
' IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
' End If
|
||||
|
||||
|
||||
' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
' MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
' Exit Select
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar '- TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (ImporteAplicar / ImporteAplicar).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
'Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((ImporteAplicar * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
''
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Else
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
'OTROS INGRESOS/EGRESOS
|
||||
If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
Dim TipoMovtoIE As Boolean = False
|
||||
Dim CveConcIE As Integer = 78
|
||||
If Impo > 0 Then
|
||||
TipoMovtoIE = True
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 78
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
Else
|
||||
TipoMovtoIE = False
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 211
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar - TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar - TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
'Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución "
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
Case "EGSCREDITO"
|
||||
|
||||
Dim ConceptoContable As Integer
|
||||
@@ -3276,7 +3679,7 @@ Partial Class Bancos_IE
|
||||
End If
|
||||
|
||||
'Notificación de Pago
|
||||
If TxtNotificarA.Text.Trim <> "" Then
|
||||
If TxtNotificarA.Text.Trim <> "" And MsgError = "" Then
|
||||
NotificacionPago(CveIE, TxtNotificarA.Text.Trim)
|
||||
End If
|
||||
|
||||
@@ -5335,6 +5738,11 @@ Partial Class Bancos_IE
|
||||
TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero)
|
||||
|
||||
CargaProveedor(CveProveedor, "-1")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'BuscarCliente()
|
||||
|
||||
DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString
|
||||
|
||||
@@ -1669,6 +1669,8 @@
|
||||
</tr>
|
||||
</table>--%>
|
||||
|
||||
|
||||
|
||||
<div class="portlet light xspadding bordered ">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
@@ -1734,6 +1736,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="pull-right">
|
||||
<asp:HyperLink ID="HplAbonarMasivoNotas" Visible="False" runat="server" CssClass="Texto" NavigateUrl="#" ToolTip="Devolución múltiple">Devolución múltiple <img src="/Imagenes/Money_Add.png" alt="Pagar múltiples facturas" /></asp:HyperLink>  
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="portlet light xspadding bordered ">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
@@ -1816,6 +1824,7 @@
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="portlet light xspadding bordered ">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
|
||||
@@ -828,6 +828,8 @@ Partial Class Compras_Proveedores
|
||||
|
||||
HplAbonarMasivo.NavigateUrl = String.Format("/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&Serie={1}&CveMoneda={2}", CveProveedor, Serie, CveMoneda)
|
||||
|
||||
HplAbonarMasivoNotas.NavigateUrl = String.Format("/Bancos/IE.aspx?OPCION=DevDinC&CveProveedor={0}&Masivo={1}", CveProveedor, 1)
|
||||
|
||||
TxtCorreoCobranza.Text = ObjProveedor.CorreoCobranza
|
||||
LblUsuarioPortalCliente.Text = ObjProveedor.CorreoCobranza
|
||||
LblUsuarioPortalCliente.Attributes("style") = "font-weight: bold;"
|
||||
@@ -1112,6 +1114,14 @@ Partial Class Compras_Proveedores
|
||||
DtAntNCH = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'")
|
||||
GvAH.DataSource = DtAntNCH
|
||||
End If
|
||||
|
||||
|
||||
' e.Row.DBCampo("TipoDocto") = "NC"
|
||||
If ObjMovtos.DtResultados.FiltraParametros("TipoDocto = 'NC'").Rows.Count > 0 And UsuarioActual.TienePermisoProceso(273) Then
|
||||
HplAbonarMasivoNotas.Visible = True
|
||||
UpAnticipos.Update()
|
||||
End If
|
||||
|
||||
Else
|
||||
GvA.DataSource = Nothing
|
||||
GvAH.DataSource = Nothing
|
||||
|
||||
202
Ventas/RepAuxiliarFacturas.aspx
Normal file
202
Ventas/RepAuxiliarFacturas.aspx
Normal file
@@ -0,0 +1,202 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAuxiliarFacturas.aspx.vb" Inherits="Ventas_RepAuxiliarFacturas" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte auxiliar de facturas de venta.
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPdf" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="ImgExcel" runat="server"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
|
||||
<a href="javascript:;" class="expand"></a>
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate">Productos Servicios:</label>
|
||||
<div class="col-md-2">
|
||||
<ADS:Dropdownlost runat="server" ID="DdlPS" Style="width: 95%;" CssClass="DdlPS" CssClassDdl="select2me " DataTextField="PSCodigo" DataValueField="CvePS" />
|
||||
</div>
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Inicio:
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Fin:
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<label class="col-md-1 ">Estatus:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlEstatus" runat="server" AppendDataBoundItems="true" DataTextField="EstatusFactura" DataValueField="CveEstatusFactura" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none">
|
||||
<div class="row">
|
||||
<label runat="server" id="LblProyecto" class="col-md-1 truncate">Proyecto:</label>
|
||||
<div runat="server" id="DivProyecto" class="col-md-2">
|
||||
<asp:DropDownList ID="DdlProyecto" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label runat="server" id="LblSubProyecto" class="col-md-1 truncate">SubProyecto:</label>
|
||||
<div runat="server" id="DivSubProyecto" class="col-md-2">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 ">Cliente:</label>
|
||||
<div class="col-md-2">
|
||||
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Vendedor:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Class="table-group-action-input form-control input-inline input-small input-sm select2me" Style="width: 100%">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate">Clasificación:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlClasificacion" AutoPostBack="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me" runat="server" AppendDataBoundItems="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Style="width: 100%">
|
||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1">Tipo: </label>
|
||||
<div class="col-md-2">
|
||||
<asp:ListBox ID="DdlTipoComprobante" AutoPostBack="true" OnTextChanged="DdlTipoComprobante_SelectedIndexChanged" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server">
|
||||
<asp:ListItem Text="Ingresos" Value="Ing"></asp:ListItem>
|
||||
<asp:ListItem Text="Egresos" Value="Egs"></asp:ListItem>
|
||||
<asp:ListItem Text="Remisión" Value="Rem"></asp:ListItem>
|
||||
<asp:ListItem Text="Cotización" Value="Cot"></asp:ListItem>
|
||||
<asp:ListItem Text="Anticipos" Value="Ant"></asp:ListItem>
|
||||
<asp:ListItem Text="Pedido Con" Value="Ped"></asp:ListItem>
|
||||
<asp:ListItem Text="Devolucion" Value="Dev"></asp:ListItem>
|
||||
<asp:ListItem Text="Pedido" Value="Pd2"></asp:ListItem>
|
||||
</asp:ListBox>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Ventas"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" Style="text-align: center;" GridLines="None" Width="99%">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cliente" DataField="Cliente" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField HeaderText="Grupo" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlGrupo" runat="server" Text='<%# Eval("GPO") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" ItemStyle-Width="10%" DataFormatString="{0:###,###,###,###.##}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Sub Total" DataField="SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Descuento" DataField="Descuento" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total" DataField="Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Sub. Máximo" DataField="MAX_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
<asp:BoundField HeaderText="Sub. Promedio" DataField="AVG_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
<asp:BoundField HeaderText="Sub. Mínimo" DataField="MIN_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
<asp:BoundField HeaderText="Tot. Máximo" DataField="MAX_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
<asp:BoundField HeaderText="Tot. Promedio" DataField="AVG_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
<asp:BoundField HeaderText="Tot. Mínimo" DataField="MIN_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div id="DivTipoCambio" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Label ID="Label2" runat="server" ClientIDMode="Static" Text="Cambiar Tipo Cambio de Dólares"></asp:Label></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:RadioButtonList runat="server" ID="RblTipoCambio" AutoPostBack="true">
|
||||
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Compra" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>
|
||||
</asp:RadioButtonList>
|
||||
|
||||
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">
|
||||
Especifico:
|
||||
|
||||
<asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnTipoCambio" OnClick="BtnTipoCambio_Click1" runat="server" Text="Aceptar" class="btn btn-primary" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
304
Ventas/RepAuxiliarFacturas.aspx.vb
Normal file
304
Ventas/RepAuxiliarFacturas.aspx.vb
Normal file
@@ -0,0 +1,304 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
|
||||
|
||||
Partial Class Ventas_RepAuxiliarFacturas
|
||||
Inherits ClsPaginas
|
||||
#Region "P R O P I E D A D E S"
|
||||
|
||||
Private Property DtVentas As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtVentas"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtVentas") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtColor As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtColor"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtColor") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Agrupador As String
|
||||
Get
|
||||
Return ViewState("Agrupador").ToString
|
||||
End Get
|
||||
|
||||
Set(value As String)
|
||||
ViewState("Agrupador") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TCEspecifico As Double
|
||||
Get
|
||||
Return ViewState("TCEspecifico").ToString.ToDouble
|
||||
End Get
|
||||
|
||||
Set(value As Double)
|
||||
ViewState("TCEspecifico") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TipoCambio As Integer
|
||||
Get
|
||||
Return ViewState("TipoCambio").ToString.ToEntero
|
||||
End Get
|
||||
|
||||
Set(value As Integer)
|
||||
ViewState("TipoCambio") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "C A R G A - C O M B O S"
|
||||
Private Sub CargaClientes()
|
||||
DdlClientes.ddl.Items.Clear()
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
DdlClientes.DataBind()
|
||||
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DdlEstatus.Items.Clear()
|
||||
If DdlTipoComprobante.SelectedValue <> "-1" Then
|
||||
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto = '{0}'", DdlTipoComprobante.SelectedValue))
|
||||
Else
|
||||
DdlEstatus.DataSource = GlobalDTEstatusFactura
|
||||
|
||||
End If
|
||||
DdlEstatus.Items.Add(New ListItem("Todos", "-1"))
|
||||
DdlEstatus.DataBind()
|
||||
DdlEstatus.SelectedValueExist("3")
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
|
||||
DdlSubProyecto.Items.Clear()
|
||||
If DdlProyecto.SelectedValue <> "-1" Then
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.DataBind()
|
||||
End If
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClasificacion.SelectedIndexChanged
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "" Then
|
||||
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacion.SelectedValue.ToEntero)
|
||||
DdlPS.DataBind()
|
||||
DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
Else
|
||||
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
|
||||
DdlPS.SelectedText = "Todos"
|
||||
DdlPS.SelectedValue = "-1"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaTipoCentroCosto()
|
||||
|
||||
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DivProyecto.Visible = False
|
||||
LblProyecto.Visible = False
|
||||
LblSubProyecto.InnerText = "Sucursal:"
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DivProyecto.Visible = False
|
||||
LblProyecto.Visible = False
|
||||
LblSubProyecto.InnerText = "Proyecto:"
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then
|
||||
LblProyecto.InnerText = "Sucursal:"
|
||||
LblSubProyecto.InnerText = "Proyecto:"
|
||||
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
|
||||
LblProyecto.InnerText = "Proyecto:"
|
||||
LblSubProyecto.InnerText = "Sucursal:"
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
'Cargo Clientes
|
||||
CargaClientes()
|
||||
|
||||
'Cargo Proyectos
|
||||
DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1)
|
||||
DdlProyecto.DataBind()
|
||||
|
||||
'Cargo Clasificaciones
|
||||
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
|
||||
DdlClasificacion.DataBind()
|
||||
|
||||
|
||||
'CargaSubProyectos
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
'Vendedor
|
||||
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedor.DataBind()
|
||||
|
||||
|
||||
'Carga Productos
|
||||
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
|
||||
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
|
||||
DdlPS.SelectedText = ""
|
||||
DdlPS.SelectedValue = "-1"
|
||||
Else
|
||||
DdlPS.ddl.Items.Clear()
|
||||
DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacion.SelectedValue.ToEntero)
|
||||
DdlPS.ddl.DataBind()
|
||||
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
|
||||
End If
|
||||
|
||||
'CargaEstatus
|
||||
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(" CveEstatusFactura NOT IN (1, 4, 5) ")
|
||||
DdlEstatus.DataBind()
|
||||
DdlEstatus.Items.Add(New ListItem("Canceladas", "4"))
|
||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" Then
|
||||
DdlEstatus.SelectedIndex = 2
|
||||
Else
|
||||
DdlEstatus.SelectedIndex = 1
|
||||
End If
|
||||
|
||||
CargaTipoCentroCosto()
|
||||
|
||||
TipoCambio = 1
|
||||
TCEspecifico = 0
|
||||
|
||||
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
|
||||
If EsWS Then
|
||||
DdlClientes.setEsWebService(True)
|
||||
Else
|
||||
DdlClientes.setEsWebService(False)
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
DdlClientes.DataBind()
|
||||
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "C A R G A - D A T O S"
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim TipoComprobante As String = If(DdlTipoComprobante.GetSelectedValuesM = "", "-1", DdlTipoComprobante.GetSelectedValuesM)
|
||||
Dim FechaI, FechaF As Date
|
||||
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
|
||||
If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDouble Else TCEspecifico = -1
|
||||
|
||||
Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1)
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
If ObjVentas.GetRepAuxliarFacturas(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero,
|
||||
FechaI, FechaF, CveCliente, DdlVendedor.SelectedValue.ToEntero, -1, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa,
|
||||
CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:=TipoComprobante, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then
|
||||
DtVentas = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
GvDatos.DataSource = DtVentas
|
||||
GvDatos.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnTipoCambio_Click1(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Select Case e.Row.DBCampo("TipoFila")
|
||||
Case "1"
|
||||
e.Row.CssClass = "Totales"
|
||||
Case "2"
|
||||
e.Row.CssClass = "SubTotales"
|
||||
e.Row.FCLiteral("LtlGrupo").Text = String.Format("<a target=""_blank"" Class=""{0}"" href=""{1}"">{2}</a>", "SubTotales", String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DBCampo("CveVenta")), e.Row.DBCampo("Gpo"))
|
||||
End Select
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
GvDatos.ExportToExcel("RepAuxiliarFacturas" & Now.ToShortDateString)
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||
If GvDatos.Rows.Count > 0 Then
|
||||
GenerarPDF()
|
||||
Else
|
||||
Alert("No hay datos para imprimir")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF()
|
||||
Dim FechaI, FechaF As Date
|
||||
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
|
||||
Dim Cliente = If(DdlClientes.SelectedText = "", "", $" <b>Cliente:</b> {DdlClientes.SelectedText}")
|
||||
Dim FechaInicio = If(txtFechaI.Text = "", "", $" <b>Fecha Inicio:</b> {txtFechaI.Text}")
|
||||
Dim FechaFin = If(txtFechaF.Text = "", "", $" <b>Fecha Fin:</b> {txtFechaF.Text}")
|
||||
Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $" <b>Clasificación:</b> {DdlClasificacion.SelectedItem.Text}")
|
||||
Dim PS = If(DdlPS.SelectedValue = "-1", "", $" <b>P.S.:</b> {DdlPS.SelectedText}")
|
||||
Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $" <b>Proyecto:</b> {DdlSubProyecto.SelectedItem.Text}")
|
||||
Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $" <b>Estatus:</b> {DdlEstatus.SelectedItem.Text}")
|
||||
|
||||
|
||||
If DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", If(txtFechaI.Text <> "", FechaI.ToShortDateString, "")))
|
||||
params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, "")))
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("Filtros", $"{Cliente}{FechaInicio}{FechaFin}{Clasificacion}{PS}{Proyecto}{Estatus}"))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepAuxiliarFacturas.rdlc", DtVentas, params, "ReporteAuxiliarFacturas")
|
||||
Else
|
||||
Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -72,6 +72,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user