Merge branch 'master' of http://agonzalez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -6698,10 +6698,12 @@ Public Class ClsPaginas
|
||||
'If EmpresaActual = 48 Then
|
||||
' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE"
|
||||
'End If
|
||||
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta))
|
||||
If Not Archivo.Exists OrElse EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 72, 80, 122, 126) Then
|
||||
params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2)))
|
||||
End If
|
||||
'DATOS PARA DESCUENTO
|
||||
If EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 72, 80, 122, 126) Then 'EMPRESAS QUE YA TIENEN EL AJUSTE EN EL FORMATO
|
||||
params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2)))
|
||||
params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString))
|
||||
params.Add(New ReportParameter("SubTotal2", DtDetalle.SUM("Total").ToString))
|
||||
Else
|
||||
@@ -6768,8 +6770,8 @@ Public Class ClsPaginas
|
||||
Dim FirmaSol As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioSol))
|
||||
params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioSol))).AbsoluteUri, "")))
|
||||
Dim FirmaAut As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioAut))
|
||||
params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, "")))
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta))
|
||||
params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, "")))
|
||||
|
||||
If Archivo.Exists Then
|
||||
bytes = StreamPDF(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta), DtDetalle, params, $"OC_{ObjOC.Folio.ToString}", RDSName:="DsOC", MR:=MR)
|
||||
Else
|
||||
|
||||
@@ -3823,13 +3823,6 @@ Namespace Modelos
|
||||
|
||||
Dim TieneAlmacen As Boolean = False
|
||||
|
||||
'If Not EsRefacturacion AndAlso ObjFactura.SaldoAlmacen <> 0 Then
|
||||
' Retorno.Mensaje = "El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén."
|
||||
' Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
||||
|
||||
' Return Retorno
|
||||
'End If
|
||||
|
||||
'VALIDA QUE LA FACTURA NO TENGA PAGOS
|
||||
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
|
||||
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
|
||||
@@ -4286,13 +4279,6 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If Not GeneraMovimientosApartados(ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
||||
End If
|
||||
End If
|
||||
|
||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
||||
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
||||
@@ -4302,22 +4288,25 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||
If CveMovimiento > 0 AndAlso RealizarDevolucionAlmacen Then
|
||||
If Not ErrorCancelar Then
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
If Not GeneraMovimientosApartados(ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
||||
End If
|
||||
End If
|
||||
|
||||
'AGREGA BITACORA A VENTA
|
||||
If Not ErrorCancelar Then
|
||||
Dim MensajeBitacora = "Devuelta"
|
||||
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||
If Not ErrorCancelar Then
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
|
||||
'AGREGA BITACORA A VENTA
|
||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimiento > 0 Then
|
||||
Dim MensajeBitacora = "Devuelta"
|
||||
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -4432,7 +4421,7 @@ Namespace Modelos
|
||||
End If
|
||||
Else
|
||||
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
|
||||
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd hh:mm:ss.mmm")) Then
|
||||
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm")) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
|
||||
End If
|
||||
@@ -4551,58 +4540,47 @@ Namespace Modelos
|
||||
Dim SeCancela As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = DrMovtos("CveRem").ToString.ToEntero()))
|
||||
|
||||
If Not SeCancela Then
|
||||
Dim ObjRem As New Modelos.Factura(UsuarioActual, DrMovtos("CveRem").ToString.ToEntero(), UsuarioActual.CveEmpresa)
|
||||
|
||||
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||
If ObjRem.SaldoAlmacen = 0 Then
|
||||
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||
|
||||
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'SALIDA GENERAL
|
||||
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacenDevolucion, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
|
||||
FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
|
||||
'ENTRADA ADELANTADO
|
||||
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDevolucion)
|
||||
FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
|
||||
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'SALIDA POR TRAPASO DE GENERAL
|
||||
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
|
||||
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
|
||||
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
|
||||
|
||||
If Not CveVentaDetalleRem > 0 Then
|
||||
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
'SALIDA GENERAL
|
||||
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacenDevolucion, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
|
||||
FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
|
||||
'ENTRADA ADELANTADO
|
||||
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, DrMovtos("CveRem").ToString.ToEntero, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDevolucion)
|
||||
FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
|
||||
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'SALIDA POR TRAPASO DE GENERAL
|
||||
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
|
||||
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
|
||||
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
|
||||
|
||||
If Not CveVentaDetalleRem > 0 Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If ErrorCancelar Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If ErrorCancelar Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
ErrorCancelar = True
|
||||
If ErrorCancelar Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
@@ -4611,16 +4589,31 @@ Namespace Modelos
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If ErrorCancelar Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
ObjRem.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
@@ -769,7 +769,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
||||
Using httpClient = New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
|
||||
3119
Bancos/IE.aspx
3119
Bancos/IE.aspx
File diff suppressed because it is too large
Load Diff
@@ -2686,7 +2686,31 @@ Partial Class Bancos_IE
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
'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
|
||||
Else
|
||||
TipoMovtoIE = False
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 211
|
||||
End If
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=Impo, ImporteME:=0) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'IMPUESTOS
|
||||
If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin) Then
|
||||
Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
|
||||
@@ -1,281 +1,281 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Compras_RepNotasCredito
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
DdlProveedores.DataBind()
|
||||
TxtFechaSaldar.Text = Now.ToShortDateString
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjCompras As New ClsCompras
|
||||
Dim FechaI, FechaF As String
|
||||
|
||||
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
|
||||
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
|
||||
|
||||
|
||||
If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjCompras.DtResultados
|
||||
CargaGrid("")
|
||||
Else
|
||||
Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjCompras.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||||
e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
||||
If DtDatos IsNot Nothing Then
|
||||
Dim StrFiltro As New StringBuilder
|
||||
'StrFiltro.AppendFormat(String.Format("<b>Proveedor:</b> {0}, <b>Estatus:</b> {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text))
|
||||
' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Tipo Documento</b>: {0}", DdlTipoComprobante.SelectedItem.Text)
|
||||
If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Proveedor:</b> {0}", DdlProveedores.SelectedItem.Text)
|
||||
If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Estatus:</b> {0}", DdlOpcion.SelectedItem.Text)
|
||||
|
||||
If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Inicio </b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
|
||||
If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString)
|
||||
|
||||
|
||||
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 dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"})
|
||||
Dim FechaI, FechaF As String
|
||||
FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
|
||||
FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato)
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
|
||||
For Each gr As GridViewRow In GvDatos.Rows
|
||||
If gr.DataKey("CveCompra") <> "" Then
|
||||
gr.FCCheckBox("Chk").Visible = True
|
||||
HLSaldar.Visible = True
|
||||
LnkHabilitarSaldar.Visible = False
|
||||
UpDatos.Update()
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
ObjConta.IniciaTransacSQL()
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim IdCtaContableComplementaria As Integer = 0
|
||||
Dim Importe As Decimal = 0
|
||||
Dim ImporteMN As Decimal = 0
|
||||
Dim ImporteComplementaria As Decimal = 0
|
||||
Dim CveMoneda As Integer = 0
|
||||
Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal
|
||||
Dim TCCompra As Decimal = 0
|
||||
Dim Concepto As String = TxtConcepto.Text
|
||||
Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119)
|
||||
Dim MensajeAlert = New StringBuilder
|
||||
|
||||
For Each gr As GridViewRow In GvDatos.Rows
|
||||
If gr.FCCheckBox("Chk").Checked Then
|
||||
IdCtaContable = 0
|
||||
IdCtaContableComplementaria = 0
|
||||
Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL
|
||||
ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL
|
||||
TCCompra = gr.DataKey("TipoCambio").ToDecimal
|
||||
CveMoneda = gr.DataKey("CveMoneda").ToEntero
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 2, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If CveMoneda > 1 Then
|
||||
IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero
|
||||
ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL
|
||||
Else
|
||||
IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If UsaComplementaria AndAlso CveMoneda > 1 Then
|
||||
ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL
|
||||
IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
End If
|
||||
|
||||
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then
|
||||
Dim difFluctuacion As Decimal = TC - TCCompra
|
||||
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
||||
Dim TipoMovtoFluctua As Boolean = True
|
||||
Dim IdCtaContableFluctua As Integer
|
||||
Dim CveCuenta As Integer = 0
|
||||
If difFluctuacion < 0 Then
|
||||
CveConceptoFluctua = 65
|
||||
TipoMovtoFluctua = False
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
||||
Else
|
||||
CveConceptoFluctua = 64
|
||||
TipoMovtoFluctua = True
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
||||
End If
|
||||
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
MsgError = ObjConta.MensajePolizaDescuadre
|
||||
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
||||
If MensajeAlert.ToString = "" Then
|
||||
MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>")
|
||||
End If
|
||||
MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
|
||||
End If
|
||||
End If
|
||||
|
||||
If MsgError <> "" Then Exit For
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If MsgError = "" Then
|
||||
ObjConta.Commit()
|
||||
If MensajeAlert.ToString <> "" Then
|
||||
Alert(MensajeAlert.ToString)
|
||||
Else
|
||||
Alert("Los movimientos fueron saldados correctamente.")
|
||||
End If
|
||||
Alert(MensajeAlert.ToString)
|
||||
CargaDatos()
|
||||
HLSaldar.Visible = False
|
||||
RegistraScript("$('#DivSaldar').modal('hide')")
|
||||
LnkHabilitarSaldar.Visible = True
|
||||
Else
|
||||
ObjConta.RollBack()
|
||||
Alert(MsgError, TipoMensaje.MsgError)
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
End Sub
|
||||
Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
CargaGrid(Orden)
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaGrid(Orden As String)
|
||||
Dim DV As DataView = Nothing
|
||||
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
|
||||
If Orden <> String.Empty Then
|
||||
GvDatos.DataSource = DV.ToTable()
|
||||
Else
|
||||
GvDatos.DataSource = DtDatos
|
||||
End If
|
||||
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
DV.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
End Class
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Compras_RepNotasCredito
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
DdlProveedores.DataBind()
|
||||
TxtFechaSaldar.Text = Now.ToShortDateString
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjCompras As New ClsCompras
|
||||
Dim FechaI, FechaF As String
|
||||
|
||||
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
|
||||
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
|
||||
|
||||
|
||||
If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjCompras.DtResultados
|
||||
CargaGrid("")
|
||||
Else
|
||||
Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjCompras.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||||
e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
||||
If DtDatos IsNot Nothing Then
|
||||
Dim StrFiltro As New StringBuilder
|
||||
'StrFiltro.AppendFormat(String.Format("<b>Proveedor:</b> {0}, <b>Estatus:</b> {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text))
|
||||
' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Tipo Documento</b>: {0}", DdlTipoComprobante.SelectedItem.Text)
|
||||
If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Proveedor:</b> {0}", DdlProveedores.SelectedItem.Text)
|
||||
If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Estatus:</b> {0}", DdlOpcion.SelectedItem.Text)
|
||||
|
||||
If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Inicio </b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
|
||||
If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString)
|
||||
|
||||
|
||||
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 dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"})
|
||||
Dim FechaI, FechaF As String
|
||||
FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
|
||||
FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato)
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
|
||||
For Each gr As GridViewRow In GvDatos.Rows
|
||||
If gr.DataKey("CveCompra") <> "" Then
|
||||
gr.FCCheckBox("Chk").Visible = True
|
||||
HLSaldar.Visible = True
|
||||
LnkHabilitarSaldar.Visible = False
|
||||
UpDatos.Update()
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs)
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
ObjConta.IniciaTransacSQL()
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim IdCtaContableComplementaria As Integer = 0
|
||||
Dim Importe As Decimal = 0
|
||||
Dim ImporteMN As Decimal = 0
|
||||
Dim ImporteComplementaria As Decimal = 0
|
||||
Dim CveMoneda As Integer = 0
|
||||
Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal
|
||||
Dim TCCompra As Decimal = 0
|
||||
Dim Concepto As String = TxtConcepto.Text
|
||||
Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119)
|
||||
Dim MensajeAlert = New StringBuilder
|
||||
|
||||
For Each gr As GridViewRow In GvDatos.Rows
|
||||
If gr.FCCheckBox("Chk").Checked Then
|
||||
IdCtaContable = 0
|
||||
IdCtaContableComplementaria = 0
|
||||
Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL
|
||||
ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL
|
||||
TCCompra = gr.DataKey("TipoCambio").ToDecimal
|
||||
CveMoneda = gr.DataKey("CveMoneda").ToEntero
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 103, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If CveMoneda > 1 Then
|
||||
IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero
|
||||
ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL
|
||||
Else
|
||||
IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If UsaComplementaria AndAlso CveMoneda > 1 Then
|
||||
ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL
|
||||
IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
End If
|
||||
|
||||
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then
|
||||
Dim difFluctuacion As Decimal = TC - TCCompra
|
||||
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
||||
Dim TipoMovtoFluctua As Boolean = True
|
||||
Dim IdCtaContableFluctua As Integer
|
||||
Dim CveCuenta As Integer = 0
|
||||
If difFluctuacion < 0 Then
|
||||
CveConceptoFluctua = 65
|
||||
TipoMovtoFluctua = False
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
||||
Else
|
||||
CveConceptoFluctua = 64
|
||||
TipoMovtoFluctua = True
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
||||
End If
|
||||
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then
|
||||
MsgError = "Ocurrio un Error al saldar el movimiento"
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
MsgError = ObjConta.MensajePolizaDescuadre
|
||||
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
||||
If MensajeAlert.ToString = "" Then
|
||||
MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>")
|
||||
End If
|
||||
MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
|
||||
End If
|
||||
End If
|
||||
|
||||
If MsgError <> "" Then Exit For
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If MsgError = "" Then
|
||||
ObjConta.Commit()
|
||||
If MensajeAlert.ToString <> "" Then
|
||||
Alert(MensajeAlert.ToString)
|
||||
Else
|
||||
Alert("Los movimientos fueron saldados correctamente.")
|
||||
End If
|
||||
Alert(MensajeAlert.ToString)
|
||||
CargaDatos()
|
||||
HLSaldar.Visible = False
|
||||
RegistraScript("$('#DivSaldar').modal('hide')")
|
||||
LnkHabilitarSaldar.Visible = True
|
||||
Else
|
||||
ObjConta.RollBack()
|
||||
Alert(MsgError, TipoMensaje.MsgError)
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
End Sub
|
||||
Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
CargaGrid(Orden)
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaGrid(Orden As String)
|
||||
Dim DV As DataView = Nothing
|
||||
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
|
||||
If Orden <> String.Empty Then
|
||||
GvDatos.DataSource = DV.ToTable()
|
||||
Else
|
||||
GvDatos.DataSource = DtDatos
|
||||
End If
|
||||
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
DV.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -140,12 +140,14 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row" id="trNotificar" runat="server" visible="False">
|
||||
<label class="col-md-2">Notificar:</label>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtNotificarA" CssClass="form-control input-sm" runat="server" MaxLength="12" Width="400px" Rows="2" TextMode="MultiLine" ClientIDMode="Static"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="trCuentaDeposito" runat="server" visible="False">
|
||||
<label class="col-md-2">Cuenta Depósito:</label>
|
||||
<div class="col-md-10">
|
||||
|
||||
@@ -212,8 +212,14 @@ Partial Class ContabilidadC_RegPrePoliza
|
||||
End If
|
||||
Exit Sub
|
||||
Else
|
||||
|
||||
CreaDT()
|
||||
BtnEliminar.Visible = False
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ChkAutoConta.Checked = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
@@ -816,7 +822,7 @@ Partial Class ContabilidadC_RegPrePoliza
|
||||
Dim Conta As ClsContPAQi = Nothing
|
||||
Dim IDPoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
Dim CveIE As Integer
|
||||
Dim CveIE As Integer = -1
|
||||
Dim CveIEInsertado As Integer = -1
|
||||
Dim FolioIE As String = ""
|
||||
|
||||
@@ -889,7 +895,7 @@ Partial Class ContabilidadC_RegPrePoliza
|
||||
Next
|
||||
|
||||
'El movimiento 2 es el de Pago
|
||||
If ChkAutoConta.Checked AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
|
||||
If ChkAutoConta.Checked AndAlso MsgError = "" Or UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" Then
|
||||
If idCuentaContabilizacion > 0 Then
|
||||
If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
||||
|
||||
@@ -925,7 +931,7 @@ Partial Class ContabilidadC_RegPrePoliza
|
||||
|
||||
If MsgError = "" Then
|
||||
'MENSAJE IE
|
||||
If CveIE Then
|
||||
If CveIE > 0 Then
|
||||
MensajeAlert.AppendFormat("<br/><br/>Folio Bancario: <b><a href = ""/Bancos/IE.aspx?CveIE={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CveIE, FolioIE)
|
||||
Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()")
|
||||
Else
|
||||
|
||||
@@ -1,267 +1,268 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
.truncate2 {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width:100px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte de Impuestos
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" 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:UpdatePanel runat="server" ID="UpAccionesDIOT" UpdateMode="Conditional" >
|
||||
<ContentTemplate>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkAccionesDIOT" OnClick="LnkAccionesDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar DIOT</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkAccionesDIOT" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</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="UPPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="BtnConsultar_Click" CssClass="btn btn-primary" />
|
||||
</div>
|
||||
<div class="titlefiltros caption ">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate">Fecha Inicio:</label>
|
||||
<div class="col-md-2">
|
||||
<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 ID="txtFechaI" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="ImgCalendarioI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<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="CalendarExtender1" TargetControlID="txtFechaI" PopupButtonID="ImgCalendarioI" 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>
|
||||
<label class="col-md-1 truncate">Fecha Fin:</label>
|
||||
<div class="col-md-2">
|
||||
<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 ID="txtFechaF" runat="server" CssClass="form-control" Width="99%" 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>
|
||||
<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>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Tipo Movto:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlTipoMovto" runat="server">
|
||||
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Conciliados" Value="1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<ajax:TabContainer ID="TT" runat="server" ActiveTabIndex="0" Width="100%">
|
||||
<ajax:TabPanel ID="TTr" runat="server" HeaderText="IVA Trasladado">
|
||||
<ContentTemplate>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<h4><b>IVA Trasladado</b></h4>
|
||||
<asp:GridView ID="GvT" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVATrasladado_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Folio" ControlStyle-Width="85px" />
|
||||
<asp:BoundField HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA" DataField="RetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetISR" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
|
||||
<asp:HyperLinkField HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataTextField="Nombre" ControlStyle-CssClass="truncate2" />
|
||||
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
|
||||
|
||||
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass="truncate2" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
|
||||
<div id="DvTipo" class="col-md-6">
|
||||
<h4><b>IEPS por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIEPSA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIEPS" />
|
||||
<asp:BoundField HeaderText="Categoria" DataField="Categoria" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><b>IVA por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIVAA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
<ajax:TabPanel ID="TA" runat="server" HeaderText="IVA Acreditable">
|
||||
<ContentTemplate>
|
||||
<h4><b>IVA Acreditable</b></h4>
|
||||
<asp:GridView ID="GvA" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVAAcreditable_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" />
|
||||
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" />
|
||||
<asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
<asp:Label ID="LblHRetIVAHon" data-toggle="tooltip" data-placement="top" ToolTip="Ret IVA Honorario/Serv. Prof." runat="server">RetIVA <br/>Hon/Ser.Prof.</asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblRetIVAHon" runat="server" Text='<%# Eval("RetIVAHonorario", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.F" HtmlEncode="False" DataField="RetIVAFletePF" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.M." HtmlEncode="False" DataField="RetIVAFletePM" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Arrenda." HtmlEncode="False" DataField="RetIVAArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
<asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
<%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 6%" DataField="IEPS6" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 7%" DataField="IEPS7" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 9%" DataField="IEPS9" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
|
||||
|
||||
|
||||
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
|
||||
|
||||
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass ="truncate2"/>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
<div class="row">
|
||||
<h4><b>IVA por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIVA2" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
</ajax:TabContainer>
|
||||
|
||||
</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" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
|
||||
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" 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" runat="server" OnClick="BtnTipoCambio_Click" 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>
|
||||
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
.truncate2 {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width:100px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte de Impuestos
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" 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:UpdatePanel runat="server" ID="UpAccionesDIOT" UpdateMode="Conditional" >
|
||||
<ContentTemplate>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkAccionesDIOT" OnClick="LnkAccionesDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar DIOT</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkAccionesDIOT" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</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="UPPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="BtnConsultar_Click" CssClass="btn btn-primary" />
|
||||
</div>
|
||||
<div class="titlefiltros caption ">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate">Fecha Inicio:</label>
|
||||
<div class="col-md-2">
|
||||
<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 ID="txtFechaI" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="ImgCalendarioI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<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="CalendarExtender1" TargetControlID="txtFechaI" PopupButtonID="ImgCalendarioI" 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>
|
||||
<label class="col-md-1 truncate">Fecha Fin:</label>
|
||||
<div class="col-md-2">
|
||||
<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 ID="txtFechaF" runat="server" CssClass="form-control" Width="99%" 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>
|
||||
<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>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Tipo Movto:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlTipoMovto" runat="server">
|
||||
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Conciliados" Value="1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<ajax:TabContainer ID="TT" runat="server" ActiveTabIndex="0" Width="100%">
|
||||
<ajax:TabPanel ID="TTr" runat="server" HeaderText="IVA Trasladado">
|
||||
<ContentTemplate>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<h4><b>IVA Trasladado</b></h4>
|
||||
<asp:GridView ID="GvT" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVATrasladado_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Folio" ControlStyle-Width="85px" />
|
||||
<asp:BoundField HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA" DataField="RetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetISR" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
|
||||
<asp:HyperLinkField HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataTextField="Nombre" ControlStyle-CssClass="truncate2" />
|
||||
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
|
||||
|
||||
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass="truncate2" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
|
||||
<div id="DvTipo" class="col-md-6">
|
||||
<h4><b>IEPS por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIEPSA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIEPS" />
|
||||
<asp:BoundField HeaderText="Categoria" DataField="Categoria" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><b>IVA por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIVAA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
<ajax:TabPanel ID="TA" runat="server" HeaderText="IVA Acreditable">
|
||||
<ContentTemplate>
|
||||
<h4><b>IVA Acreditable</b></h4>
|
||||
<asp:Label ID="LblMsgAcreditable" runat="server" Text="" ForeColor="Red"></asp:Label>
|
||||
<asp:GridView ID="GvA" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVAAcreditable_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" />
|
||||
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" />
|
||||
<asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
<asp:Label ID="LblHRetIVAHon" data-toggle="tooltip" data-placement="top" ToolTip="Ret IVA Honorario/Serv. Prof." runat="server">RetIVA <br/>Hon/Ser.Prof.</asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblRetIVAHon" runat="server" Text='<%# Eval("RetIVAHonorario", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.F" HtmlEncode="False" DataField="RetIVAFletePF" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.M." HtmlEncode="False" DataField="RetIVAFletePM" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetIVA <br/> Arrenda." HtmlEncode="False" DataField="RetIVAArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
<asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
<%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 6%" DataField="IEPS6" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 7%" DataField="IEPS7" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="IEPS 9%" DataField="IEPS9" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
|
||||
|
||||
|
||||
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
|
||||
|
||||
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass ="truncate2"/>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
<div class="row">
|
||||
<h4><b>IVA por Porcentaje</b></h4>
|
||||
<asp:GridView ID="GvIVA2" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
|
||||
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
</ajax:TabContainer>
|
||||
|
||||
</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" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
|
||||
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" 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" runat="server" OnClick="BtnTipoCambio_Click" 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>
|
||||
|
||||
|
||||
@@ -1,307 +1,316 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
using static Extensiones.ModExtensiones;
|
||||
using Microsoft.Reporting.WebForms;
|
||||
using System.Activities.Expressions;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
{
|
||||
#region PROPIEDADES
|
||||
|
||||
private DataTable DtIVATrasladado
|
||||
{
|
||||
get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; }
|
||||
set { ViewState["DtIVATrasladado"] = value; }
|
||||
}
|
||||
private DataTable DtIVAAcreditable
|
||||
{
|
||||
get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; }
|
||||
set { ViewState["DtIVAAcreditable"] = value; }
|
||||
}
|
||||
private double TCEspecifico
|
||||
{
|
||||
get { return TCEspecifico = (double)ViewState["TCEspecifico"]; }
|
||||
set { ViewState["TCEspecifico"] = value; }
|
||||
}
|
||||
|
||||
private int TipoCambio
|
||||
{
|
||||
get { return TipoCambio = (int)ViewState["TipoCambio"]; }
|
||||
set { ViewState["TipoCambio"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaValores();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void InicializaValores()
|
||||
{
|
||||
TipoCambio = 1;
|
||||
TCEspecifico = -1;
|
||||
txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}";
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
|
||||
LnkAccionesDIOT.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
public void Consulta()
|
||||
{
|
||||
if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; }
|
||||
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
|
||||
|
||||
ClsContabilidad ObjCont = new ClsContabilidad();
|
||||
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
GvT.DataSource = ObjCont.DtResultados;
|
||||
DtIVATrasladado = ObjCont.DtResultados;
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIEPSA.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIVAA.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
GvA.DataSource = ObjCont.DtResultados;
|
||||
DtIVAAcreditable = ObjCont.DtResultados;
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIVA2.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
}
|
||||
ObjCont.Dispose();
|
||||
GvT.DataBind();
|
||||
GvA.DataBind();
|
||||
GvIEPSA.DataBind();
|
||||
GvIVAA.DataBind();
|
||||
GvIVA2.DataBind();
|
||||
UpDatos.Update();
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
Consulta();
|
||||
}
|
||||
|
||||
protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveVenta").ToEntero() < 1)
|
||||
{
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveCompra").ToEntero() < 1)
|
||||
{
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 )
|
||||
{
|
||||
Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) );
|
||||
|
||||
Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2);
|
||||
if (dif > 1)
|
||||
{
|
||||
e.Row.ForeColor = System.Drawing.Color.Red;
|
||||
e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err";
|
||||
|
||||
e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkPdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
Imprimir("PDF");
|
||||
}
|
||||
|
||||
protected void LnkExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Imprimir("EXCEL");
|
||||
}
|
||||
|
||||
public void Imprimir(String Opcion)
|
||||
{
|
||||
String FechaF;
|
||||
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" <b>Fecha Final:</b> {txtFechaF.Text}"; }
|
||||
String FechaI;
|
||||
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" <b>Fecha Inicial:</b> {txtFechaI.Text}"; }
|
||||
if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0)
|
||||
{
|
||||
System.IO.FileInfo Imagen;
|
||||
String logouri = "";
|
||||
|
||||
if (UsuarioActual.CveEmpresa.Contiene(119))
|
||||
{
|
||||
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta));
|
||||
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
else
|
||||
{
|
||||
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
||||
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
|
||||
List<CrystalParametro> para = new List<CrystalParametro>();
|
||||
para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa));
|
||||
para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre));
|
||||
para.Add(new CrystalParametro("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}"));
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
para.Add(new CrystalParametro("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
para.Add(new CrystalParametro("LogoPath", ""));
|
||||
}
|
||||
|
||||
DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy();
|
||||
string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt";
|
||||
para.Add(new CrystalParametro("Excel", Formato));
|
||||
|
||||
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnTipoCambio_Click(object sender, EventArgs e)
|
||||
{
|
||||
Consulta();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"));
|
||||
}
|
||||
|
||||
protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
TipoCambio = RblTipoCambio.SelectedValue.ToEntero();
|
||||
if (TipoCambio == 3)
|
||||
{
|
||||
LiEspecifico.Visible = true;
|
||||
TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble();
|
||||
TxtEspecifico.Text = TCEspecifico.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
LiEspecifico.Visible = false;
|
||||
}
|
||||
UpBodyTipoCambio.Update();
|
||||
}
|
||||
|
||||
|
||||
protected string GenerarDIOT()
|
||||
{
|
||||
System.Text.StringBuilder Respuesta = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
|
||||
return Respuesta.ToString();
|
||||
}
|
||||
|
||||
protected void LnkAccionesDIOT_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
ClsContabilidad Objconta = new ClsContabilidad();
|
||||
StringBuilder SBDIOT = new StringBuilder();
|
||||
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
|
||||
|
||||
if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
|
||||
foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0)
|
||||
{
|
||||
SBDIOT.AppendLine(
|
||||
Drow["TipoTercero"].ToString() + "|" +
|
||||
Drow["TipoOperacion"].ToString() + "|" +
|
||||
Drow["RFC"].ToString() +"|"+
|
||||
Drow["NumeroIDFiscal"].ToString() + "|" +
|
||||
Drow["NombreExtranjero"].ToString() +"|"+
|
||||
Drow["PaisResidencia"].ToString() + "|" +
|
||||
Drow["Nacionalidad"].ToString() +"|"+
|
||||
LV(Drow["valorActos1516"].ToString()) + "|"+
|
||||
LV(Drow["valorActos15"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo1516"].ToString()) +"|"+
|
||||
|
||||
LV(Drow["valorActos1011"].ToString()) + "|" +
|
||||
LV(Drow["valorActos10"].ToString()) + "|" +
|
||||
LV(Drow["valorActosImp8"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo10"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo08"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["valorActosImp1516"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNoImp16"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["valorActosImp10"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNoImp10"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["IvaExentoImpo"].ToString()) + "|"+
|
||||
LV(Drow["IVACero"].ToString()) + "|" +
|
||||
LV(Drow["IvaExento"].ToString()) + "|"+
|
||||
LV(Drow["IvaRetenido"].ToString()) + "|" +
|
||||
LV(Drow["IvaDevoluciones"].ToString()) + "|");
|
||||
}
|
||||
}
|
||||
|
||||
Objconta.Dispose();
|
||||
|
||||
//MemoryStream ms = new MemoryStream();
|
||||
//TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8);
|
||||
|
||||
//tw.Write(SBDIOT.ToString());
|
||||
|
||||
//tw.Flush();
|
||||
|
||||
//byte[] bytes = ms.ToArray();
|
||||
//ms.Close();
|
||||
|
||||
//Response.Clear();
|
||||
//Response.AppendHeader("Content-Length", text.Length.ToString());
|
||||
//Response.ContentType = "text/plain";
|
||||
//Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
|
||||
//Response.BinaryWrite(bytes);
|
||||
//Response.End();
|
||||
|
||||
Response.Clear();
|
||||
Response.ClearHeaders();
|
||||
|
||||
Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString());
|
||||
Response.ContentType = "text/plain";
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
|
||||
|
||||
Response.Write(SBDIOT.ToString());
|
||||
Response.End();
|
||||
}
|
||||
|
||||
protected string LV(string Valor )
|
||||
{
|
||||
return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : "";
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
using static Extensiones.ModExtensiones;
|
||||
using Microsoft.Reporting.WebForms;
|
||||
using System.Activities.Expressions;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
{
|
||||
#region PROPIEDADES
|
||||
|
||||
private DataTable DtIVATrasladado
|
||||
{
|
||||
get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; }
|
||||
set { ViewState["DtIVATrasladado"] = value; }
|
||||
}
|
||||
private DataTable DtIVAAcreditable
|
||||
{
|
||||
get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; }
|
||||
set { ViewState["DtIVAAcreditable"] = value; }
|
||||
}
|
||||
private double TCEspecifico
|
||||
{
|
||||
get { return TCEspecifico = (double)ViewState["TCEspecifico"]; }
|
||||
set { ViewState["TCEspecifico"] = value; }
|
||||
}
|
||||
|
||||
private int TipoCambio
|
||||
{
|
||||
get { return TipoCambio = (int)ViewState["TipoCambio"]; }
|
||||
set { ViewState["TipoCambio"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaValores();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void InicializaValores()
|
||||
{
|
||||
TipoCambio = 1;
|
||||
TCEspecifico = -1;
|
||||
txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}";
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
|
||||
LnkAccionesDIOT.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
public void Consulta()
|
||||
{
|
||||
if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; }
|
||||
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
|
||||
LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos
|
||||
|
||||
ClsContabilidad ObjCont = new ClsContabilidad();
|
||||
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
GvT.DataSource = ObjCont.DtResultados;
|
||||
DtIVATrasladado = ObjCont.DtResultados;
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIEPSA.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIVAA.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
GvA.DataSource = ObjCont.DtResultados;
|
||||
DtIVAAcreditable = ObjCont.DtResultados;
|
||||
if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0)
|
||||
{
|
||||
LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT";
|
||||
}
|
||||
|
||||
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIVA2.DataSource = ObjCont.DtResultados;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ObjCont.Dispose();
|
||||
GvT.DataBind();
|
||||
GvA.DataBind();
|
||||
GvIEPSA.DataBind();
|
||||
GvIVAA.DataBind();
|
||||
GvIVA2.DataBind();
|
||||
UpDatos.Update();
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
Consulta();
|
||||
}
|
||||
|
||||
protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveVenta").ToEntero() < 1)
|
||||
{
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveCompra").ToEntero() < 1)
|
||||
{
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 )
|
||||
{
|
||||
Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) );
|
||||
|
||||
Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2);
|
||||
if (dif > 1)
|
||||
{
|
||||
e.Row.ForeColor = System.Drawing.Color.Red;
|
||||
e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err";
|
||||
|
||||
e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkPdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
Imprimir("PDF");
|
||||
}
|
||||
|
||||
protected void LnkExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Imprimir("EXCEL");
|
||||
}
|
||||
|
||||
public void Imprimir(String Opcion)
|
||||
{
|
||||
String FechaF;
|
||||
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" <b>Fecha Final:</b> {txtFechaF.Text}"; }
|
||||
String FechaI;
|
||||
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" <b>Fecha Inicial:</b> {txtFechaI.Text}"; }
|
||||
if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0)
|
||||
{
|
||||
System.IO.FileInfo Imagen;
|
||||
String logouri = "";
|
||||
|
||||
if (UsuarioActual.CveEmpresa.Contiene(119))
|
||||
{
|
||||
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta));
|
||||
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
else
|
||||
{
|
||||
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
||||
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
|
||||
List<CrystalParametro> para = new List<CrystalParametro>();
|
||||
para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa));
|
||||
para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre));
|
||||
para.Add(new CrystalParametro("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}"));
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
para.Add(new CrystalParametro("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
para.Add(new CrystalParametro("LogoPath", ""));
|
||||
}
|
||||
|
||||
DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy();
|
||||
string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt";
|
||||
para.Add(new CrystalParametro("Excel", Formato));
|
||||
|
||||
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnTipoCambio_Click(object sender, EventArgs e)
|
||||
{
|
||||
Consulta();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"));
|
||||
}
|
||||
|
||||
protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
TipoCambio = RblTipoCambio.SelectedValue.ToEntero();
|
||||
if (TipoCambio == 3)
|
||||
{
|
||||
LiEspecifico.Visible = true;
|
||||
TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble();
|
||||
TxtEspecifico.Text = TCEspecifico.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
LiEspecifico.Visible = false;
|
||||
}
|
||||
UpBodyTipoCambio.Update();
|
||||
}
|
||||
|
||||
|
||||
protected string GenerarDIOT()
|
||||
{
|
||||
System.Text.StringBuilder Respuesta = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
|
||||
return Respuesta.ToString();
|
||||
}
|
||||
|
||||
protected void LnkAccionesDIOT_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
ClsContabilidad Objconta = new ClsContabilidad();
|
||||
StringBuilder SBDIOT = new StringBuilder();
|
||||
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
|
||||
|
||||
if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
|
||||
{
|
||||
|
||||
foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0)
|
||||
{
|
||||
SBDIOT.AppendLine(
|
||||
Drow["TipoTercero"].ToString() + "|" +
|
||||
Drow["TipoOperacion"].ToString() + "|" +
|
||||
Drow["RFC"].ToString() +"|"+
|
||||
Drow["NumeroIDFiscal"].ToString() + "|" +
|
||||
Drow["NombreExtranjero"].ToString() +"|"+
|
||||
Drow["PaisResidencia"].ToString() + "|" +
|
||||
Drow["Nacionalidad"].ToString() +"|"+
|
||||
LV(Drow["valorActos1516"].ToString()) + "|"+
|
||||
LV(Drow["valorActos15"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo1516"].ToString()) +"|"+
|
||||
|
||||
LV(Drow["valorActos1011"].ToString()) + "|" +
|
||||
LV(Drow["valorActos10"].ToString()) + "|" +
|
||||
LV(Drow["valorActosImp8"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo10"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNo08"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["valorActosImp1516"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNoImp16"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["valorActosImp10"].ToString()) + "|" +
|
||||
LV(Drow["ValorIvaNoImp10"].ToString()) + "|" +
|
||||
|
||||
LV(Drow["IvaExentoImpo"].ToString()) + "|"+
|
||||
LV(Drow["IVACero"].ToString()) + "|" +
|
||||
LV(Drow["IvaExento"].ToString()) + "|"+
|
||||
LV(Drow["IvaRetenido"].ToString()) + "|" +
|
||||
LV(Drow["IvaDevoluciones"].ToString()) + "|");
|
||||
}
|
||||
}
|
||||
|
||||
Objconta.Dispose();
|
||||
|
||||
//MemoryStream ms = new MemoryStream();
|
||||
//TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8);
|
||||
|
||||
//tw.Write(SBDIOT.ToString());
|
||||
|
||||
//tw.Flush();
|
||||
|
||||
//byte[] bytes = ms.ToArray();
|
||||
//ms.Close();
|
||||
|
||||
//Response.Clear();
|
||||
//Response.AppendHeader("Content-Length", text.Length.ToString());
|
||||
//Response.ContentType = "text/plain";
|
||||
//Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
|
||||
//Response.BinaryWrite(bytes);
|
||||
//Response.End();
|
||||
|
||||
Response.Clear();
|
||||
Response.ClearHeaders();
|
||||
|
||||
Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString());
|
||||
Response.ContentType = "text/plain";
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
|
||||
|
||||
Response.Write(SBDIOT.ToString());
|
||||
Response.End();
|
||||
}
|
||||
|
||||
protected string LV(string Valor )
|
||||
{
|
||||
return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : "";
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -271,8 +271,13 @@ Partial Class General_SaldosIniciales
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(12).ColumnName = "Litraje" Then
|
||||
Alert("El nombre de la treceava columna debe ser 'Litraje'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
If Not dt.Columns(12).ColumnName = "Servicio" Then
|
||||
Alert("El nombre de la treceava columna debe ser 'Servicio'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(13).ColumnName = "Conversion Unidad" Then
|
||||
Alert("El nombre de la catorceava columna debe ser 'Conversion Unidad'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -563,7 +568,8 @@ Partial Class General_SaldosIniciales
|
||||
Dim IEPS As Decimal = Row("IEPS").ToString.ToDecimal
|
||||
Dim Tamaño As String = Row("Tamaño").ToString.Trim
|
||||
Dim SATClavePS As String = Row("Código SAT").ToString.Trim
|
||||
Dim Litraje As Double = Row("Litraje").ToString.ToDouble
|
||||
Dim Clasificacion2 As String = Row("Servicio").ToString.Trim
|
||||
Dim Litraje As Double = Row("Conversion Unidad").ToString.ToDouble
|
||||
Dim RinTamaño As String = If(Row.Table.Columns.Contains("Tamaño de Rin"), Row("Tamaño de Rin").ToString.Trim, "")
|
||||
Dim Medida As String = If(Row.Table.Columns.Contains("Medida"), Row("Medida").ToString.Trim, "")
|
||||
Dim SATClaveUnidadMedida As String = If(Row.Table.Columns.Contains("Clave Unidad"), Row("Clave Unidad").ToString.Trim, "")
|
||||
@@ -572,11 +578,12 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
Dim CvePS As Integer = DTPS.FiltroPrimeroValor("CvePS", $"Codigo = '{Codigo}'").ToString.ToEntero
|
||||
|
||||
Dim CveTipoPS As Integer = If(TipoPS = "PRODUCTO", 2, 1)
|
||||
Dim CveTipoPS As Integer = If(TipoPS.ToUpper = "PRODUCTO", 2, 1)
|
||||
Dim CveClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero
|
||||
Dim CveUnidadMedida As Integer = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString.ToEntero
|
||||
Dim CveSATPS As Integer = GlobalDTPSATPS.FiltroPrimeroValor("CveSATPS", $"SATClavePS = '{SATClavePS}'").ToString.ToEntero
|
||||
Dim CveTamaño As Integer = GlobalDTAcumTamaños.FiltroPrimeroValor("CveTamaño", $"Tamaño = '{Tamaño}'").ToString.ToEntero
|
||||
Dim CveTamaño As Integer = GlobalDTAcumTamaños.FiltroPrimeroValor("CveTamaño", $"Tamaño = '{Tamaño}' AND CveEmpresa = {UsuarioActual.CveEmpresa}").ToString.ToEntero
|
||||
Dim CveClasificacion2 As Integer = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString.ToEntero
|
||||
|
||||
If Not CveClasificacion > 0 AndAlso Clasificacion <> "" Then
|
||||
If ObjClas.AddClasificaciones(Clasificacion, "", -1, "-1", -1, "-1", -1, "-1",
|
||||
@@ -588,7 +595,7 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
|
||||
If Not CveUnidadMedida > 0 AndAlso UnidadMedida <> "" Then
|
||||
If ObjUM.AddUnidadMedida(UnidadMedida, "", "", "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).ToEntero > 0 Then
|
||||
If ObjUM.AddUnidadMedida(UnidadMedida, UnidadMedida, "", "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).ToEntero > 0 Then
|
||||
If ObjUM.GetUnidadesMedida() Then Application("GlobalDTUnidadesMedida") = ObjUM.DtResultados
|
||||
CveUnidadMedida = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString.ToEntero
|
||||
End If
|
||||
@@ -646,6 +653,26 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not CveClasificacion2 > 0 AndAlso Clasificacion2 <> "" Then
|
||||
Dim CveCategoria As Integer
|
||||
If ObjGral.GetCategorias(UsuarioActual.CveEmpresa, 4) Then
|
||||
CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero
|
||||
End If
|
||||
If Not CveCategoria > 0 Then
|
||||
If ObjGral.AddCategorias(Clasificacion2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 4) Then
|
||||
|
||||
If ObjGral.GetCategorias(UsuarioActual.CveEmpresa, 4) Then
|
||||
CveCategoria = ObjGral.DtResultados.FiltroPrimeroValor("CveCategoria", "").ToEntero
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
If ObjClas.AddClasificaciones(Clasificacion2, "", -1, "-1", -1, "-1", -1, "-1", CveCategoria, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa) Then
|
||||
If ObjClas.GetClasificaciones(Tipo:=4) Then Application("GlobalDTClasificaciones2") = ObjClas.DtResultados
|
||||
CveClasificacion2 = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not CveClasificacion > 0 AndAlso Clasificacion <> "" Then Alert("No se encontró la Clasificación: " + Clasificacion, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
If Not CveUnidadMedida > 0 AndAlso UnidadMedida <> "" Then Alert("No se encontró la Unidad de Medida: " + UnidadMedida, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
If Not CveSATPS > 0 AndAlso SATClavePS <> "" Then Alert("No se encontró la Clve SAT PS: " + SATClavePS, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
@@ -653,11 +680,12 @@ Partial Class General_SaldosIniciales
|
||||
If Not CveMedida > 0 AndAlso Medida <> "" Then Alert("No se encontró la Media: " + Medida, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
If Not CveRinTamaño > 0 AndAlso RinTamaño <> "" Then Alert("No se encontró el Tamaño: " + RinTamaño, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
If Not CveModelo > 0 AndAlso Modelo <> "" Then Alert("No se encontró el Modelo: " + Modelo, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
If Not CveClasificacion2 > 0 AndAlso Clasificacion2 <> "" Then Alert("No se encontró la Serie: " + Clasificacion2, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For
|
||||
|
||||
If CvePS > 0 Then
|
||||
If Not ObjPS.UpdatePS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, 1, 1, False, 0, True, True, True, UsuarioActual.CveUsuario, CvePS, -1, -1, CveSATPS,
|
||||
CveTipoPS:=CveTipoPS, CveMarca:=CveMarca, CveMedida:=CveMedida, CveRinTamaño:=CveRinTamaño,
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS) Then
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS, CveClasificacion2:=CveClasificacion2, CveTamaño:=CveTamaño) Then
|
||||
'If Not ObjPS.UpdatePS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, 0, 1, 1, False, 0, True, True, True, UsuarioActual.CveUsuario, CvePS, -1, -1, CveSATPS,
|
||||
' CveTipoPS:=CveTipoPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida) Then
|
||||
ErrorPS = True
|
||||
@@ -666,10 +694,11 @@ Partial Class General_SaldosIniciales
|
||||
Else
|
||||
Contador += 1
|
||||
End If
|
||||
|
||||
Else
|
||||
If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida, CveRinTamaño:=CveRinTamaño,
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS) <= 0 Then
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS, CveClasificacion2:=CveClasificacion2) <= 0 Then
|
||||
'If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, 0, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
' CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida) <= 0 Then
|
||||
ErrorPS = True
|
||||
@@ -772,7 +801,9 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
ObjClientes.IniciaTransacSQL()
|
||||
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
|
||||
NumRow = NumRow + 1
|
||||
NumRow = NumRow + 1
|
||||
|
||||
|
||||
Dim Codigo As String = Row("Codigo").ToString
|
||||
Dim RazonSocial As String = Row("RazonSocial").ToString
|
||||
Dim RFC As String = Row("RFC").ToString.Trim
|
||||
@@ -783,36 +814,148 @@ Partial Class General_SaldosIniciales
|
||||
Dim Poblacion As String = Row("Población").ToString
|
||||
Dim Estado As String = Row("Estado").ToString
|
||||
Dim Pais As String = Row("Pais").ToString
|
||||
Dim Telefono As String = Row("Teléfono").ToString
|
||||
Dim Contacto As String = Row("Contacto").ToString
|
||||
Dim CelularContacto As String = Row("Celular Contacto").ToString
|
||||
Dim Telefono As String = Row("Teléfono").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
|
||||
Dim Contacto As String = Row("Contacto").ToString
|
||||
|
||||
|
||||
Dim Vendedor As String = Row("Vendedor").ToString
|
||||
Dim Clasificacion As String = Row("Clasificación").ToString
|
||||
Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero
|
||||
|
||||
Dim CveVendedor As Integer = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString.ToEntero
|
||||
Dim CveClasificación As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero
|
||||
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString = "si", True, False)
|
||||
Dim CargoUsado As Boolean = If(Row("CargoUsado").ToString = "si", True, False)
|
||||
Dim BonificacionUsado As Boolean = If(Row("BonificacionUsado").ToString = "si", True, False)
|
||||
|
||||
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString.ToUpper = "SI", True, False)
|
||||
Dim CargoUsado As Boolean = If(Row("Cargo Usados").ToString.ToUpper = "SI", True, False)
|
||||
Dim BonificacionUsado As Boolean = If(Row("EmitirBon Usado").ToString.ToUpper = "SI", True, False)
|
||||
|
||||
Dim LimiteCredito As Decimal = Row("Limite Credito").ToString.ToDecimal
|
||||
Dim CobranzaCorreo As String = Row("CorreoPago").ToString
|
||||
Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero
|
||||
|
||||
Dim DìaVisita As String = Row("Dia Pago").ToString
|
||||
Dim DiasPagoEspecifico As String = Row("Dìa Visita").ToString
|
||||
Dim CobranzaContacto As String = Row("Encargado Pago").ToString
|
||||
Dim CobranzaTelefono As String = Row("Celular Contacto").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
|
||||
|
||||
|
||||
' CobranzaContacto = Regex.Replace(CobranzaContacto, "[^0-9]", "")
|
||||
|
||||
'Telefono
|
||||
|
||||
If Telefono.Trim.Length > 10 Then
|
||||
Telefono = ""
|
||||
End If
|
||||
|
||||
If CobranzaTelefono.Trim.Length > 10 Then
|
||||
|
||||
CobranzaTelefono = ""
|
||||
End If
|
||||
|
||||
Dim FormaPago As String = Row("Forma Pago").ToString
|
||||
Dim CveFormaPago33 As Integer = 99
|
||||
|
||||
Select Case FormaPago
|
||||
|
||||
Case "01"
|
||||
CveFormaPago33 = 1
|
||||
Exit Select
|
||||
Case "02"
|
||||
CveFormaPago33 = 2
|
||||
Exit Select
|
||||
Case "03"
|
||||
CveFormaPago33 = 3
|
||||
Exit Select
|
||||
Case "04"
|
||||
CveFormaPago33 = 4
|
||||
Exit Select
|
||||
Case "05"
|
||||
CveFormaPago33 = 5
|
||||
Exit Select
|
||||
Case "06"
|
||||
CveFormaPago33 = 6
|
||||
Exit Select
|
||||
Case "08"
|
||||
CveFormaPago33 = 7
|
||||
Exit Select
|
||||
Case "12"
|
||||
CveFormaPago33 = 8
|
||||
Exit Select
|
||||
Case "13"
|
||||
CveFormaPago33 = 9
|
||||
Exit Select
|
||||
Case "14"
|
||||
CveFormaPago33 = 10
|
||||
Exit Select
|
||||
Case "15"
|
||||
CveFormaPago33 = 11
|
||||
Exit Select
|
||||
Case "17"
|
||||
CveFormaPago33 = 12
|
||||
Exit Select
|
||||
Case "23"
|
||||
CveFormaPago33 = 13
|
||||
Exit Select
|
||||
Case "24"
|
||||
CveFormaPago33 = 14
|
||||
Exit Select
|
||||
Case "25"
|
||||
CveFormaPago33 = 15
|
||||
Exit Select
|
||||
Case "26"
|
||||
CveFormaPago33 = 16
|
||||
Exit Select
|
||||
Case "27"
|
||||
CveFormaPago33 = 17
|
||||
Exit Select
|
||||
Case "28"
|
||||
CveFormaPago33 = 18
|
||||
Exit Select
|
||||
Case "29"
|
||||
CveFormaPago33 = 19
|
||||
Exit Select
|
||||
Case "99"
|
||||
CveFormaPago33 = 20
|
||||
Exit Select
|
||||
Case "30"
|
||||
CveFormaPago33 = 21
|
||||
Exit Select
|
||||
Case "31"
|
||||
CveFormaPago33 = 22
|
||||
Exit Select
|
||||
Case Else
|
||||
CveFormaPago33 = 99
|
||||
|
||||
End Select
|
||||
|
||||
|
||||
|
||||
'Dim RazonSocial As String = Row("RazonSocial").ToString
|
||||
|
||||
'Contacto
|
||||
|
||||
If CveCliente > 0 Then
|
||||
ExisteCliente = True
|
||||
Contador = Contador + 1
|
||||
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
|
||||
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
|
||||
' ErrorClientes = True
|
||||
' RFC.GuardaLog
|
||||
' Exit For
|
||||
'End If
|
||||
Contador = Contador + 1
|
||||
|
||||
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
|
||||
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
|
||||
' ErrorClientes = True
|
||||
' RFC.GuardaLog
|
||||
' Exit For
|
||||
'End If
|
||||
Else
|
||||
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, Pais, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, -1, -1,
|
||||
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado, BonificacionUsado:=BonificacionUsado) Then
|
||||
|
||||
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString, "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1,
|
||||
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, LimiteCredito, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado,
|
||||
BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33) Then
|
||||
|
||||
ErrorClientes = True
|
||||
RFC.GuardaLog
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
@@ -1684,7 +1827,7 @@ Partial Class General_SaldosIniciales
|
||||
If firstRowHasHeaders Then
|
||||
|
||||
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
|
||||
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
|
||||
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString().Trim)
|
||||
Else
|
||||
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
|
||||
End If
|
||||
@@ -1693,9 +1836,11 @@ Partial Class General_SaldosIniciales
|
||||
Else
|
||||
dataTable.Columns.Add("Column " & (cols + 1))
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
While curRow < worksheet.Rows.Count
|
||||
While curRow < worksheet.Rows.Count
|
||||
|
||||
columns = New String(cols - 1) {}
|
||||
|
||||
For curCol = 0 To cols - 1
|
||||
@@ -1705,13 +1850,16 @@ Partial Class General_SaldosIniciales
|
||||
Else
|
||||
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
dataTable.Rows.Add(columns)
|
||||
curRow += 1
|
||||
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -588,8 +588,8 @@ Partial Class Inventarios_EntradasSalidas
|
||||
If DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero > 0 Then
|
||||
HplPrePoliza.Visible = True
|
||||
HplPrePoliza.NavigateUrl = String.Format("/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}", DtMov.Rows(0)("CvePrePoliza"))
|
||||
CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero
|
||||
Else
|
||||
CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero
|
||||
Else
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
BtnGeneraPrepoliza.Visible = True
|
||||
End If
|
||||
@@ -874,7 +874,18 @@ Partial Class Inventarios_EntradasSalidas
|
||||
TxtFecha.Enabled = True
|
||||
ImgFecha.Enabled = True
|
||||
TxtObservaciones.Enabled = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjContabilidad.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||
Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("")
|
||||
If dr IsNot Nothing Then
|
||||
If dr("IdPoliza").ToString.ToEntero > 0 Then
|
||||
BtnEliminar.Visible = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
ObjContabilidad.Dispose()
|
||||
|
||||
'SI TIENE PREPOLIZA NO SE DEBE PODER EDITAR
|
||||
If Mov.TienePrePoliza > 0 Then
|
||||
|
||||
@@ -1897,83 +1897,91 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GeneraPrePolizaSalidaEntregaDirecta(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContaContPAQ As ClsContPAQi) As Boolean
|
||||
Dim DtCostos As DataTable = Nothing
|
||||
Dim ValorInventario As Decimal = 0
|
||||
Dim ValorInventarioME As Decimal = 0
|
||||
Dim CveConcepto As Integer = 3
|
||||
Dim Retorno As Boolean = True
|
||||
|
||||
ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa)
|
||||
Dim CveVenta As Integer = ObjInventario.CveVenta
|
||||
Dim CveAlmacen As Integer = ObjInventario.CveAlmacen
|
||||
Dim SerieFolio As String = ObjInventario.DtResultados.Rows(0)("SerieFolioVenta").ToString
|
||||
Dim MovAlmacen As Boolean = True
|
||||
|
||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConcepto).ToEntero
|
||||
If OrigenMov = 1 Then MovAlmacen = False Else MovAlmacen = True
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
DtCostos = ObjInventario.DtResultados
|
||||
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim ConceptoPoliza As String = String.Format("{0}-{1}", "Salida de Almacen", SerieFolio)
|
||||
|
||||
If tmpCostos.Rows.Count > 0 Then
|
||||
Dim Concepto As String = ConceptoPoliza
|
||||
Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||
Dim tCveConcepto As Integer = 69
|
||||
|
||||
For Each RowInv As DataRow In tmpCostos.Rows
|
||||
ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL
|
||||
If tCveConcepto = 69 Then
|
||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then
|
||||
Retorno = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total").RoundSQL) Then
|
||||
Retorno = False
|
||||
End If
|
||||
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
'CONTABILIZAR - SIMPLIFICAR
|
||||
If Retorno Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
|
||||
If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
||||
If ObjContaContPAQ Is Nothing Then
|
||||
ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa)
|
||||
ObjContaContPAQ.IniciaTransacSQL()
|
||||
End If
|
||||
|
||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Private Function GeneraPrePolizaSalidaEntregaDirecta(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContaContPAQ As ClsContPAQi) As Boolean
|
||||
Dim Retorno As Boolean = True
|
||||
Try
|
||||
Dim DtCostos As DataTable = Nothing
|
||||
Dim ValorInventario As Decimal = 0
|
||||
Dim ValorInventarioME As Decimal = 0
|
||||
Dim CveConcepto As Integer = 3
|
||||
|
||||
ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa)
|
||||
Dim CveVenta As Integer = ObjInventario.CveVenta
|
||||
Dim CveAlmacen As Integer = ObjInventario.CveAlmacen
|
||||
Dim SerieFolio As String = ObjInventario.DtResultados.Rows(0)("SerieFolioVenta").ToString
|
||||
Dim MovAlmacen As Boolean = True
|
||||
|
||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConcepto).ToEntero
|
||||
If OrigenMov = 1 Then MovAlmacen = False Else MovAlmacen = True
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
DtCostos = ObjInventario.DtResultados
|
||||
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim ConceptoPoliza As String = String.Format("{0}-{1}", "Salida de Almacen", SerieFolio)
|
||||
|
||||
If tmpCostos.Rows.Count > 0 Then
|
||||
Dim Concepto As String = ConceptoPoliza
|
||||
Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||
Dim tCveConcepto As Integer = 69
|
||||
|
||||
For Each RowInv As DataRow In tmpCostos.Rows
|
||||
ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL
|
||||
If tCveConcepto = 69 Then
|
||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then
|
||||
Retorno = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total").RoundSQL) Then
|
||||
Retorno = False
|
||||
End If
|
||||
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
GuardaLogAD($"Inventarios/RecepcionAlmacen-PPCompOC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
'CONTABILIZAR - SIMPLIFICAR
|
||||
If Retorno Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
|
||||
If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
||||
If ObjContaContPAQ Is Nothing Then
|
||||
ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa)
|
||||
ObjContaContPAQ.IniciaTransacSQL()
|
||||
End If
|
||||
|
||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then
|
||||
Retorno = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
Retorno = False
|
||||
End If
|
||||
Else
|
||||
Retorno = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guadar la prepoliza", ex)
|
||||
Retorno = False
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
@@ -1465,8 +1465,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'VALIDA CANTIDAD DE SALIDA
|
||||
Dim Cantidad As Decimal = 0.0D
|
||||
For Each Gvr As GridViewRow In GvDatos.Rows
|
||||
@@ -2214,122 +2212,123 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
' SE REALIZARA AL MOMENTO DE CANCELAR LA FACTURA {
|
||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||
If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
|
||||
Dim DtDevRem As New DataTable
|
||||
Dim DtMovtosDev As New DataTable
|
||||
Dim CveAlmacenTraspasoDestinoDevRem = -1
|
||||
|
||||
Dim CveVentaDetalleRem = -1
|
||||
Dim CantidadDevolver As Decimal = 0
|
||||
Dim CantidadRem As Decimal = 0
|
||||
'If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
|
||||
' Dim DtDevRem As New DataTable
|
||||
' Dim DtMovtosDev As New DataTable
|
||||
' Dim CveAlmacenTraspasoDestinoDevRem = -1
|
||||
|
||||
'CARGA REMISIONES DE LA VENTA DEVUELTA
|
||||
If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
|
||||
DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0")
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
' Dim CveVentaDetalleRem = -1
|
||||
' Dim CantidadDevolver As Decimal = 0
|
||||
' Dim CantidadRem As Decimal = 0
|
||||
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
DtMovtosDev = ObjInventario.DtResultados
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
' 'CARGA REMISIONES DE LA VENTA DEVUELTA
|
||||
' If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
|
||||
' DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0")
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then
|
||||
' 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
' If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
' DtMovtosDev = ObjInventario.DtResultados
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
|
||||
For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows
|
||||
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al obtener el almacén de devolucion de remisión."
|
||||
Exit For
|
||||
End If
|
||||
' If Not ErrorMovInv Then
|
||||
' If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then
|
||||
|
||||
'SALIDA GENERAL
|
||||
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
|
||||
FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
' For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows
|
||||
' CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||
' If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener el almacén de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
'ENTRADA ADELANTADO
|
||||
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero)
|
||||
FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
' 'SALIDA GENERAL
|
||||
' CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
|
||||
' FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
|
||||
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al generar los movimientos de devolución a remisión."
|
||||
Exit For
|
||||
End If
|
||||
' 'ENTRADA ADELANTADO
|
||||
' CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero)
|
||||
' FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
|
||||
' If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al generar los movimientos de devolución a remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
|
||||
'SALIDA POR TRAPASO DE GENERAL
|
||||
For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
|
||||
CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
|
||||
CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
|
||||
'CantidadDevolver = DtMovtosDev.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").ToDouble
|
||||
'If (Dr("Cantidad").ToString.ToDouble > CantidadRem, CantidadRem, Dr("Cantidad").ToString.ToDouble) Then
|
||||
' 'SALIDA POR TRAPASO DE GENERAL
|
||||
' For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
|
||||
' CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
|
||||
' CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
|
||||
' 'CantidadDevolver = DtMovtosDev.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").ToDouble
|
||||
' 'If (Dr("Cantidad").ToString.ToDouble > CantidadRem, CantidadRem, Dr("Cantidad").ToString.ToDouble) Then
|
||||
|
||||
If Not CveVentaDetalleRem > 0 Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al obtener la relación de la venta con la remisión."
|
||||
Exit For
|
||||
End If
|
||||
' If Not CveVentaDetalleRem > 0 Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener la relación de la venta con la remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de salida de traspaso de devolucion de remisión."
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
|
||||
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al guardar los movimientos de salida de traspaso de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
If ErrorMovInv Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
If ErrorMovInv Then
|
||||
Exit For
|
||||
End If
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de entrada de traspaso de devolucion de remisión."
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' 'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
|
||||
' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
' For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al guardar los movimientos de entrada de traspaso de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
If ErrorMovInv Then
|
||||
Exit For
|
||||
End If
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al obtener los detalles de la devolución de almacén"
|
||||
Exit For
|
||||
End If
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener los detalles de la devolución de almacén"
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
|
||||
TextoError = "Ocurrió un error al hacer la devolucion hacia la remision. Por favor vuelva a intentar."
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
' If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
|
||||
' TextoError = "Ocurrió un error al hacer la devolucion hacia la remision. Por favor vuelva a intentar."
|
||||
' ErrorMovInv = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
End If
|
||||
' Next
|
||||
' End If
|
||||
' Else
|
||||
' TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
'End If
|
||||
'}
|
||||
|
||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||
If Not ErrorMovInv And EsDevolucionVenta = 1 Then
|
||||
|
||||
@@ -148,7 +148,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="DivFactura" runat="server" visible="false">
|
||||
<label class="col-md-1 truncate" style="width: 110px">Factura:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlFactura" runat="server" CssClass="form-control input-sm select2me" Style="max-width: 200px" DataTextField="SerieFolio" DataValueField="CveVenta">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="DivDepartamentoEntrega" runat="server" visible="False">
|
||||
<label class="col-md-1 truncate" style="width: 110px">
|
||||
<asp:Label runat="server" ID="LblDepartamentoEntrega"> Depto. entrega:</asp:Label>
|
||||
|
||||
@@ -373,18 +373,11 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End Sub
|
||||
Private Sub PermisoVerImportes()
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Private Function isWhitFamily() As Boolean
|
||||
Return (UsuarioActual.CveEmpresa = 66)
|
||||
End Function
|
||||
|
||||
|
||||
#Region " VALORES INICIALES "
|
||||
Protected Sub CreaDT()
|
||||
Dim dt As New DataTable
|
||||
@@ -435,31 +428,16 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DtMovimientosSalidaInvFisico = dt.Clone
|
||||
|
||||
End Sub
|
||||
Private Sub CargaCombos()
|
||||
'Llenar el dropdownlist de Secciones
|
||||
If UsuarioActual.CveEmpresa = 66 Then
|
||||
'DdlClasificacion.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion")
|
||||
Else
|
||||
Dim ObjClasificaciones As New ClsClasificaciones
|
||||
If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then
|
||||
' DdlClasificacion.DataSource = ObjClasificaciones.DtResultados
|
||||
End If
|
||||
ObjClasificaciones.Dispose()
|
||||
End If
|
||||
'DdlClasificacion.DataBind()
|
||||
|
||||
Private Sub CargaCombos()
|
||||
|
||||
DdlSeccion.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlSeccion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlSeccion.DataBind()
|
||||
|
||||
|
||||
|
||||
'Llenar el dropdownlist de monedas
|
||||
DdlMoneda.DataSource = GlobalDTMonedas
|
||||
DdlMoneda.DataBind()
|
||||
|
||||
|
||||
|
||||
'Llenar el dropdownlist de almacén
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen IN (22)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
|
||||
@@ -472,10 +450,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DdlAlmacen_SelectedIndexChanged(DdlAlmacen, EventArgs.Empty)
|
||||
End If
|
||||
|
||||
|
||||
CargaPS()
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub CargaPS()
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
@@ -487,45 +462,24 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If drow("CvePSCargo").ToString.ToEntero > 0 Then
|
||||
lista.Add(drow("CvePSCargo").ToString)
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
If lista.Count > 0 Then
|
||||
|
||||
Filtro = "CvePS in(" & String.Join(",", lista) & ")"
|
||||
|
||||
|
||||
|
||||
'DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTamaño > 0")
|
||||
' Filtro
|
||||
|
||||
DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros(Filtro)
|
||||
DdlProducto2.DataBind()
|
||||
DdlProducto2.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
'DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
'If UsuarioActual.CveEmpresa = 66 Then
|
||||
' DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios")
|
||||
'End If
|
||||
|
||||
'If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then
|
||||
|
||||
' DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2")
|
||||
' DdlProducto2.DataBind()
|
||||
' DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
'End If
|
||||
ObjAcum.Dispose()
|
||||
End Sub
|
||||
Private Sub CargaSubProyectos()
|
||||
DdlSubProyecto.DataSource = If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
|
||||
'DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End Sub
|
||||
@@ -564,13 +518,12 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DdlPersonal.DataSource = dt
|
||||
DdlPersonal.DataBind()
|
||||
'DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub BloqueaEdicionEncabezado()
|
||||
|
||||
|
||||
@@ -596,11 +549,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DdlSeccion.Enabled = False
|
||||
End If
|
||||
UppGrid.Update()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region " BOTONES: ELIMINAR, NUEVO "
|
||||
Protected Sub BtnNuevo_Click(sender As Object, e As EventArgs) Handles BtnNuevo.Click
|
||||
'Response.Redirect("EntradasSalidas.aspx")
|
||||
@@ -993,8 +945,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim ImporteConcepto = 0.0
|
||||
|
||||
Try
|
||||
|
||||
|
||||
Dim CveSubProyecto = -1
|
||||
Dim ActivoFijo = -1
|
||||
|
||||
@@ -1015,16 +965,18 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim tCveProveedor As Integer = -1
|
||||
If DdlProveedor.SelectedValue.ToEntero > 0 Then tCveProveedor = DdlProveedor.SelectedValue.ToEntero
|
||||
Dim CveVenta As Integer = -1
|
||||
|
||||
If CveRemisionRecibida > 0 Then
|
||||
CveVenta = CveRemisionRecibida
|
||||
ElseIf EsDistribuidor AndAlso DdlFactura.SelectedValue.ToEntero() > 0 Then
|
||||
CveVenta = DdlFactura.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
'Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, $" {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta,
|
||||
CveSubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero,
|
||||
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
|
||||
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor)
|
||||
|
||||
|
||||
If CveMovimiento <= 0 Then
|
||||
Alert("No se pudo almacenar el movimiento correctamente", TipoMensaje.MsgError)
|
||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
@@ -1054,13 +1006,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2)
|
||||
|
||||
|
||||
If RBLOpcion.SelectedValue.ToEntero <> 3 Then
|
||||
If EsDistribuidor Then
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, -1, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
|
||||
|
||||
|
||||
'CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
|
||||
'CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String
|
||||
|
||||
@@ -1069,11 +1018,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
@@ -1088,10 +1033,8 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ObjInventario.Commit() ' aplica los movimientos insertados
|
||||
'If ObjContaAC IsNot Nothing Then ObjContaAC.Commit()
|
||||
|
||||
|
||||
Alert(Msg.ToString, TipoMensaje.MsgInformacion)
|
||||
|
||||
|
||||
'Limpia Valores cuando inserta de campos especiales
|
||||
If UsuarioActual.CveEmpresa = 66 Then
|
||||
DdlSubProyecto.SelectedValueExist("-1")
|
||||
@@ -1103,7 +1046,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
UPDatos.Update()
|
||||
LimpiarMovimiento()
|
||||
|
||||
|
||||
Else
|
||||
ObjInventario.RollBack() 'deshace lo insertado
|
||||
CveMovimiento = 0
|
||||
@@ -1111,18 +1053,11 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError)
|
||||
' RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ObjInventario.RollBack() 'deshace lo insertado
|
||||
CveMovimiento = 0
|
||||
@@ -1138,11 +1073,11 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgError)
|
||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " ADD INVENTARIO INICIAL "
|
||||
Protected Sub BtnCodigoBarras_Click(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -1218,12 +1153,11 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
TxtCodigoBarras.Focus()
|
||||
RegistraScript("beep-07.wav')")
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region " DdlConcepto, DdlClasificacion, DdlAlmacen | Index CHANGED "
|
||||
|
||||
|
||||
Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
|
||||
If EsConsumoInterno Then
|
||||
@@ -1270,34 +1204,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
FolioAsignado = Folio
|
||||
|
||||
End Sub
|
||||
'Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged
|
||||
' ChangeDdlProducto()
|
||||
'End Sub
|
||||
'Private Sub ChangeDdlProducto()
|
||||
' If UsuarioActual.Empresa.Funcionalidad(105) = "" Then
|
||||
' Dim filtro As String = ""
|
||||
' If Not (DdlClasificacion.SelectedValue = "-1") Then
|
||||
|
||||
' If isWhitFamily() Then
|
||||
' filtro = String.Format("CveSubFamilia={0}", DdlClasificacion.SelectedValue)
|
||||
' Else
|
||||
' filtro = String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue)
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros($"{filtro} AND CveTipoPS = 2", "PSCodigo")
|
||||
' DdlProducto2.DataBind()
|
||||
' DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
' Else
|
||||
' If isWhitFamily() Then
|
||||
' DdlProducto2.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacion.SelectedValue)
|
||||
' Else
|
||||
' DdlProducto2.ddlWS.Attributes.Add("data-idClasificacion", DdlClasificacion.SelectedValue)
|
||||
' End If
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
|
||||
Protected Sub DdlProducto2_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
ElProductoChange()
|
||||
End Sub
|
||||
@@ -1343,10 +1249,9 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ObjAcum.Dispose()
|
||||
UPDatos.Update()
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region " GVM "
|
||||
Private Sub CargaGVM(DtTemp As DataTable)
|
||||
GvM.DataSource = DtTemp
|
||||
@@ -1441,16 +1346,9 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " TIPO DE CAMBIO "
|
||||
Protected Sub DdlMonedaTC_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
Select Case DdlMonedaTC.SelectedValue.ToEntero
|
||||
@@ -1485,14 +1383,13 @@ Partial Class Inventarios_RecepcionUsados
|
||||
'LtTotal.Text = DtMovimientos.SUM("Total", "").ToString.FormatoNumero
|
||||
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region " BITACORA "
|
||||
Private Sub InicializaBitacoraTemporal()
|
||||
|
||||
@@ -1693,61 +1590,56 @@ Partial Class Inventarios_RecepcionUsados
|
||||
UPEventoBitacora.Update()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " CONSUMO INTERNO "
|
||||
'Private Sub ActivaConsumoInterno()
|
||||
' EsConsumoInterno = True
|
||||
|
||||
|
||||
|
||||
' DdlAlmacen.AutoPostBack = False
|
||||
' DivFolio1.Visible = False
|
||||
' DivFolio2.Visible = False
|
||||
|
||||
' divMonedaSeccion.Visible = False
|
||||
' divGuia.Visible = False
|
||||
' TrResponsable.Visible = False
|
||||
' CargaPersonal()
|
||||
|
||||
|
||||
' 'RECARGA ALMACENES SOLO DE CONSUMO INTERNO
|
||||
' DdlAlmacen.Items.Clear()
|
||||
' DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
' DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
' DdlAlmacen.SelectedValue = "-1"
|
||||
' DdlAlmacen.DataBind()
|
||||
' If IsNothing(Request("CveMovimiento")) Then
|
||||
' DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
|
||||
' End If
|
||||
|
||||
'End Sub
|
||||
'Private Sub ActivaConsumoInterno()
|
||||
' EsConsumoInterno = True
|
||||
|
||||
|
||||
|
||||
' DdlAlmacen.AutoPostBack = False
|
||||
' DivFolio1.Visible = False
|
||||
' DivFolio2.Visible = False
|
||||
|
||||
' divMonedaSeccion.Visible = False
|
||||
' divGuia.Visible = False
|
||||
' TrResponsable.Visible = False
|
||||
' CargaPersonal()
|
||||
|
||||
|
||||
' 'RECARGA ALMACENES SOLO DE CONSUMO INTERNO
|
||||
' DdlAlmacen.Items.Clear()
|
||||
' DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
' DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
' DdlAlmacen.SelectedValue = "-1"
|
||||
' DdlAlmacen.DataBind()
|
||||
' If IsNothing(Request("CveMovimiento")) Then
|
||||
' DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
|
||||
' End If
|
||||
|
||||
'End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region "PAQUETERIA GUIA"
|
||||
'Protected Sub LnkAgregarGuia_Click(sender As Object, e As EventArgs)
|
||||
' RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveMovimiento={0}',800,620);", CveMovimiento))
|
||||
'End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'Protected Sub LnkAgregarGuia_Click(sender As Object, e As EventArgs)
|
||||
' RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveMovimiento={0}',800,620);", CveMovimiento))
|
||||
'End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
#Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED"
|
||||
Private Sub InicializaClientes()
|
||||
|
||||
@@ -1775,6 +1667,26 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DivClienteSucursal.Visible = False
|
||||
DdlClientesSucursales.Items.Clear()
|
||||
CargaSucursalesCliente()
|
||||
CargaFacturasCliente()
|
||||
|
||||
UpGenerales.Update()
|
||||
End Sub
|
||||
Private Sub CargaFacturasCliente()
|
||||
DivFactura.Visible = True
|
||||
Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero()
|
||||
If CveCliente > 0 Then
|
||||
Me.EsDistribuidor = True
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then
|
||||
DdlFactura.DataSource = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
DdlFactura.DataBind()
|
||||
DdlFactura.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub CargaSucursalesCliente()
|
||||
DdlClientesSucursales.Enabled = True
|
||||
@@ -1882,14 +1794,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String)
|
||||
Dim ObjEventos As New ClsOIEventos()
|
||||
|
||||
@@ -1907,7 +1815,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkAgregarUsado_Click(sender As Object, e As EventArgs)
|
||||
AgregarUsado = True
|
||||
ResetModalUsados()
|
||||
@@ -1916,8 +1823,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
UpModalAgregar.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkModalAgregarUsado_Click(sender As Object, e As EventArgs)
|
||||
AgregarPS()
|
||||
End Sub
|
||||
@@ -1970,7 +1875,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End Sub
|
||||
|
||||
Private Sub RBLOpcion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLOpcion.SelectedIndexChanged
|
||||
|
||||
If RBLOpcion.SelectedValue.ToEntero = 3 Then
|
||||
DivCliente.Visible = False
|
||||
Else
|
||||
@@ -1996,7 +1900,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Me.CveRemisionRecibida = -1
|
||||
Me.CveRemisionRecibida = CType(CType(sender, LinkButton).NamingContainer, GridViewRow).DataKey("CveVenta").ToEntero()
|
||||
|
||||
|
||||
Dim DtUsados As DataTable = Nothing
|
||||
Dim CveCliente As Integer = -1
|
||||
|
||||
@@ -2008,10 +1911,13 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If EsDistribuidor Then
|
||||
DivCliente.Visible = True
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
|
||||
DdlFactura.SelectedValueExist(CveRemisionRecibida)
|
||||
Else
|
||||
DivCliente.Visible = False
|
||||
DivFactura.Visible = False
|
||||
End If
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
|
||||
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
|
||||
DtUsados = ObjVentas.DtResultados.Copy()
|
||||
|
||||
@@ -964,6 +964,7 @@ Partial Class OC
|
||||
DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer))
|
||||
DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double))
|
||||
|
||||
DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
|
||||
|
||||
' DtDetalle.Columns.Add("ClasificacionOG", GetType(String))
|
||||
|
||||
@@ -5872,7 +5873,7 @@ Partial Class OC
|
||||
|
||||
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath)
|
||||
Dim excelFile As ExcelFile = excelFile.Load(flatFilePath)
|
||||
|
||||
Dim unnamed As Integer = 0
|
||||
Dim cols As Integer
|
||||
|
||||
@@ -6401,6 +6401,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaTotalRNCChk(TxtImporte, Saldo, Chk) {
|
||||
if (Chk.checked) {
|
||||
TxtImporte.value = FormatoNumero(Saldo, 2);
|
||||
} else {
|
||||
TxtImporte.value = "";
|
||||
}
|
||||
|
||||
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1')
|
||||
{
|
||||
CompararNC();
|
||||
}
|
||||
}
|
||||
|
||||
function LimitaCantidadRNCMasivo(TxtImporte,Saldo, Chk) {
|
||||
var ImporteNuevo = TxtImporte.value;
|
||||
Chk.checked = true;
|
||||
|
||||
if (ImporteNuevo > Saldo) {
|
||||
ImporteNuevo = Saldo;
|
||||
Entro = 1;
|
||||
}
|
||||
|
||||
if (Entro == 1) {
|
||||
TxtImporte.value = FormatoNumero(ImporteNuevo, 2);
|
||||
}
|
||||
|
||||
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1')
|
||||
{
|
||||
CompararNC();
|
||||
}
|
||||
}
|
||||
|
||||
function LimitaCantidadNCMasivo(Porcentaje, Saldo, Total, Subtotal, TxtTotalGv, TxtTotal, Chk, TxtImporte) {
|
||||
var ImporteNivel = 0, ImporteNuevo = 0, Entro = 0, ValorMaximoPorPorcentaje = 0, TotalConPorcentaje = 0, TotalImportes = 0;
|
||||
ImporteNivel = ($('#C_DdlNCNivelImporte').val() == "1" ? Total : Subtotal);
|
||||
|
||||
@@ -6859,6 +6859,10 @@ Partial Class Ventas
|
||||
If CveVenta > 0 Then MensajeAlert = New StringBuilder
|
||||
Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
If Opcion = "Cot" And UsuarioActual.CveEmpresa = 141 Then
|
||||
MensajeAlert.AppendFormat("<b><a class='Texto' href=""Ventas.aspx?CveVenta={0}"">Facturar</a></b><br/><br/>", CveVenta)
|
||||
End If
|
||||
|
||||
If ArchivoCotizacion.Exists Then
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta)))
|
||||
Else
|
||||
@@ -7306,7 +7310,7 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||
|
||||
''Timbramos
|
||||
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
||||
@@ -8801,7 +8805,9 @@ Partial Class Ventas
|
||||
|
||||
|
||||
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing)
|
||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
||||
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
|
||||
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||
|
||||
Dim Msgok As New StringBuilder
|
||||
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
||||
@@ -9125,8 +9131,10 @@ Partial Class Ventas
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos)
|
||||
If ErrorList.Count = 0 Then
|
||||
'inventarios
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
If Not EsNCAmortizacion Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
End If
|
||||
End If
|
||||
If ErrorList.Count = 0 Then
|
||||
'estimaciones
|
||||
@@ -9147,7 +9155,9 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing)
|
||||
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
|
||||
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||
|
||||
Dim CveIE As Integer = -1
|
||||
Dim DT As DataTable = Nothing
|
||||
@@ -9175,7 +9185,9 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi, Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing) As Boolean
|
||||
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
|
||||
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False) As Boolean
|
||||
Try
|
||||
Dim DT As DataTable
|
||||
Dim CvePlantilaPoliza As Integer
|
||||
@@ -9422,146 +9434,149 @@ Partial Class Ventas
|
||||
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||
End If
|
||||
|
||||
'APLICA NC SALDOS DIRECTOS
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
For Each Dr As DataRow In DtVentasNC.Rows
|
||||
If Not EsNCAmortizacion Then
|
||||
'APLICA NC SALDOS DIRECTOS
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
For Each Dr As DataRow In DtVentasNC.Rows
|
||||
|
||||
|
||||
Dim Importe91 As Decimal = 0
|
||||
Dim ImporteMN91 As Decimal = 0
|
||||
Dim Importe251 As Decimal = 0
|
||||
Dim ImporteMN251 As Decimal = 0
|
||||
Dim Importe91 As Decimal = 0
|
||||
Dim ImporteMN91 As Decimal = 0
|
||||
Dim Importe251 As Decimal = 0
|
||||
Dim ImporteMN251 As Decimal = 0
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||
TipoCambioNC = 1
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||
TipoCambioNC = 1
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
|
||||
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
|
||||
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||
End If
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||
Else
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
Importe251 = (Importe251 * Multiplicador).RoundSQL
|
||||
|
||||
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
|
||||
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
|
||||
|
||||
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
|
||||
|
||||
Dim ImporteComplementarioIngreso As Decimal = 0
|
||||
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
|
||||
ImporteMN91 = Importe91
|
||||
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
|
||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||
End If
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
ImporteAcumulado91 += (ImporteMN91).RoundSQL
|
||||
|
||||
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Importe251
|
||||
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
|
||||
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
|
||||
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||
End If
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
'considero fluctuación.
|
||||
|
||||
|
||||
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
|
||||
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
|
||||
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
||||
Dim TipoMovtoFluctua As Boolean = True
|
||||
Dim IdCtaContableFluctua As Integer
|
||||
If difFluctuacion < 0 Then
|
||||
CveConceptoFluctua = 65
|
||||
TipoMovtoFluctua = False
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
||||
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||
Else
|
||||
CveConceptoFluctua = 64
|
||||
TipoMovtoFluctua = True
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||
End If
|
||||
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
|
||||
Importe251 = (Importe251 * Multiplicador).RoundSQL
|
||||
|
||||
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
|
||||
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
|
||||
|
||||
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
|
||||
|
||||
Dim ImporteComplementarioIngreso As Decimal = 0
|
||||
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
|
||||
ImporteMN91 = Importe91
|
||||
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
ImporteAcumulado91 += (ImporteMN91).RoundSQL
|
||||
|
||||
Next
|
||||
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||
ImporteMN251 = Importe251
|
||||
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If ImporteConcepto12 < ImporteAcumulado91 Then
|
||||
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
|
||||
'considero fluctuación.
|
||||
|
||||
|
||||
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
|
||||
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
|
||||
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
||||
Dim TipoMovtoFluctua As Boolean = True
|
||||
Dim IdCtaContableFluctua As Integer
|
||||
If difFluctuacion < 0 Then
|
||||
CveConceptoFluctua = 65
|
||||
TipoMovtoFluctua = False
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
||||
Else
|
||||
CveConceptoFluctua = 64
|
||||
TipoMovtoFluctua = True
|
||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
||||
End If
|
||||
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If ImporteConcepto12 < ImporteAcumulado91 Then
|
||||
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
Else
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
Else
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
'ErrorPrepoliza = True
|
||||
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
|
||||
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
'ErrorPrepoliza = True
|
||||
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
|
||||
|
||||
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
|
||||
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
|
||||
' Dim DtTest = ObjConta.DtResultados
|
||||
'End If
|
||||
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
|
||||
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
|
||||
' Dim DtTest = ObjConta.DtResultados
|
||||
'End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ErrorPrepoliza Then
|
||||
Exit For
|
||||
If ErrorPrepoliza Then
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'APLICA DEVOLUCION SALDOS DIRECTOS
|
||||
If AplicaDevolucion Then
|
||||
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
|
||||
@@ -16754,6 +16769,21 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ObjCliente.Dispose()
|
||||
|
||||
RecargaGlobalCliente()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub RecargaGlobalCliente()
|
||||
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
|
||||
Hilo.Start()
|
||||
End Sub
|
||||
Private Sub GeneraGlobalDTCliente()
|
||||
Dim Objclientes As New ClsClientes
|
||||
If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then
|
||||
Application("GlobalDTCliente") = Objclientes.DtResultados
|
||||
End If
|
||||
Objclientes.Dispose()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -20330,6 +20360,12 @@ Partial Class Ventas
|
||||
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadNCMasivo({TxtNCPorcentaje.Text.ToDouble()},{e.Row.DBCampo("Saldo").ToDouble},{e.Row.DBCampo("Original").ToDouble},{e.Row.DBCampo("SubTotal").ToDouble},{TxtTotalGv.ClientID},{TxtNCImporte.ClientID},{e.Row.FCCheckBox("ChkCxC").ClientID}, this);")
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvRemisionesNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNC.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaTotalRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
||||
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadRNCMasivo({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0
|
||||
|
||||
Reference in New Issue
Block a user