diff --git a/Acumuladores/EntradasUsadosResumenRep.aspx b/Acumuladores/EntradasUsadosResumenRep.aspx index eb86ecdc5..9fe1ff8df 100644 --- a/Acumuladores/EntradasUsadosResumenRep.aspx +++ b/Acumuladores/EntradasUsadosResumenRep.aspx @@ -11,7 +11,10 @@
  • - + +
  • +
  • +
  • @@ -97,6 +100,87 @@
    + + diff --git a/Acumuladores/EntradasUsadosResumenRep.aspx.vb b/Acumuladores/EntradasUsadosResumenRep.aspx.vb index ced8542ab..4043c344f 100644 --- a/Acumuladores/EntradasUsadosResumenRep.aspx.vb +++ b/Acumuladores/EntradasUsadosResumenRep.aspx.vb @@ -1,6 +1,8 @@ Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms +Imports GemBox.Spreadsheet +Imports System.IO Partial Class Acumuladores_RepEntradasUsados Inherits ClsPaginas @@ -22,6 +24,9 @@ Partial Class Acumuladores_RepEntradasUsados txtFechaI.Text = Today.AddDays((-1) * (Today.Day - 1)) txtFechaF.Text = Today CargarDatos() + CargarCombos() + + End If End Sub @@ -30,6 +35,18 @@ Partial Class Acumuladores_RepEntradasUsados DdlAlmacenes.DataBind() End Sub + Protected Sub CargarCombos() + Dim ObjAcum As New ClsAcumuladores + Dim fecha As Date = Date.Now.AddMonths(-1) + ObjAcum.GetAñosVentas(UsuarioActual.CveEmpresa) + DdlAño.DataSource = ObjAcum.DtResultados + DdlAño.DataBind() + DdlAño.SelectedValue = fecha.Year.ToEntero + ObjAcum.Dispose() + + DdlMes.SelectedValue = fecha.Month.ToEntero + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Dim ObjAcum As New ClsAcumuladores @@ -63,5 +80,77 @@ Partial Class Acumuladores_RepEntradasUsados ImprimirPDF(String.Format("Empresas/{0}/Formatos/RepEntradasUsados.rdlc", UsuarioActual.CveEmpresa), DatosEntradasUsados, params, "Reporte entrada usados", "PDF") + End Sub + + Protected Sub BtnDescargaSabana_Click(sender As Object, e As EventArgs) Handles BtnDescargaSabana.Click + RegistraScript(String.Format("$('#{0}').modal('show');", "DivModalSabana")) + + 'RegistraScript("$('#DModalEditarFecha').modal('hide')") + + End Sub + + Protected Sub BtnDescargarSabana_Click(sender As Object, e As EventArgs) Handles BtnDescargarSabana.Click + Dim Retorno As New IO.MemoryStream() + Dim ObjAcum As New ClsAcumuladores + Dim Mes As String = DdlMes.SelectedValue.ToString + Dim Año As String = DdlAño.SelectedValue.ToString + Dim Fecha As Date = (String.Format("01/{0}/{1}", Mes, Año)).ToDate + Dim dt As DataTable + Dim NombreArchivo As String + Try + If DdlOpcion.SelectedValue = 1 Then + ObjAcum.GetSabanaVenta(Fecha, 1, UsuarioActual.CveEmpresa) + + ElseIf DdlOpcion.SelectedValue = 2 Then + ObjAcum.GetSabanaVenta(Fecha, 2, UsuarioActual.CveEmpresa) + + End If + dt = ObjAcum.DtResultados + + If dt IsNot Nothing And dt.Rows.Count > 0 Then + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim workbook As New ExcelFile() + + Dim worksheet = workbook.Worksheets.Add("Sabana de ventas") + worksheet.InsertDataTable(dt, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255) + + Dim columnCount = worksheet.CalculateMaxUsedColumns() + For i = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next + + Año = Strings.Right(Año, 2) + If Mes.ToEntero < 10 Then + Mes = String.Format("0{0}", Mes) + End If + If DdlOpcion.SelectedValue = 1 Then + NombreArchivo = String.Format("700415-{0}{1}-GE", Mes, Año) + workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault) + + + ElseIf DdlOpcion.SelectedValue = 2 Then + NombreArchivo = String.Format("700415-{0}{1}-CS", Mes, Año) + workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault) + + End If + End If + Catch ex As Exception + GuardaLog(String.Format("Ocurrio un error al generar el excel {0}", ex.Message)) + + End Try + + ObjAcum.Dispose() + RegistraScript("$('#DModalEditarFecha').modal('hide')") + + + + End Sub End Class diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 4648e11e5..da170c392 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -367,7 +367,7 @@ Public Class CFDINominaOtrosPagos Public Property Subsidiocausado As Decimal Public Property RemanenteSalFav As Decimal Public Property ejercicio As Integer - Public Property SaldoAFavor As Integer + Public Property SaldoAFavor As Decimal End Class diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index c37e75652..b14e03dfe 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -1173,6 +1173,42 @@ Public Class ClsAcumuladores End Function + Public Function GetSabanaVenta(Fecha As Date, CveOpcion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + SqlDataAdapter("PA_Acum_SabanaVentaGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Opcion", SqlDbType.Int).Value = CveOpcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los movimientos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetAñosVentas(CveEmprea As Integer) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter(String.Format("select year(Fecha) as Año from Ventas where CveEmpresa = {0} group by year(Fecha) Order by year(Fecha)", CveEmprea.ToString), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError(String.Format("Ocurrió un error al consultar los año de venta"), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + + End Function + #Region " IDisposable Support " ' IDisposable diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 79507b7fc..75a06a6fe 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -2001,6 +2001,36 @@ Public Class ClsNominas End With + SqlAdapter.Fill(DTSet) + retorno = True + Catch sqEx As SqlException + retorno = False + OnError("Ocurrió un error al Realizar el calculo de nomina.", sqEx, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + retorno = False + OnError("Ocurrió un error al Realizar el calculo de nomina.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function GetNominaAcumulado(Ejercicio As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodoI As Integer, CvePeriodoF As Integer, CveEmpresa As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1) As Boolean + Dim retorno As Boolean = False + + Try + DTSet = New DataSet() + DataAdapter("PA_Nom_ReporteAcumulado", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@Ejercicio", SqlDbType.Int).Value = Ejercicio + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveTurno", SqlDbType.Int).Value = CveTurno + .Add("@CvePeriodoI", SqlDbType.Int).Value = CvePeriodoI + .Add("@CvePeriodoF", SqlDbType.Int).Value = CvePeriodoF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion + .Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal + End With + + SqlAdapter.Fill(DTSet) retorno = True Catch sqEx As SqlException diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 1203a0395..b4557e050 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4676,6 +4676,7 @@ Public Class ClsPaginas PaginaDict.Add("/Nomina/Nomina.aspx".ToUpper(), 75) PaginaDict.Add("/Nomina/NominaB.aspx".ToUpper(), 75) PaginaDict.Add("/Nomina/Nomina2.aspx".ToUpper(), 75) + PaginaDict.Add("/Nomina/ReportedeAcumulados.aspx".ToUpper(), 75) PaginaDict.Add("/Nomina/ListaAsistencias.aspx".ToUpper(), 91) PaginaDict.Add("/Nomina/ConceptosEspeciales.aspx".ToUpper(), 136) PaginaDict.Add("/Nomina/CatConceptos.aspx".ToUpper(), 172) @@ -7792,6 +7793,7 @@ Public Class ClsPaginas #End Region #Region "PDF NOMINA" + Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String) As Byte() Dim ObjNomina As New ClsNominas @@ -7809,6 +7811,7 @@ Public Class ClsPaginas Dim CveNomina = ObjNomina.CveNomina Dim DTPercepciones As Data.DataTable Dim DTDeducciones As Data.DataTable + Dim DTDeducciones2 As New Data.DataTable Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\" Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml" @@ -7820,7 +7823,6 @@ Public Class ClsPaginas SelloSAT = "" NoSerieCertificadoContribuyente = "" - Dim RutaCBB As String = String.Format("{0}CBB\Nomina\{1}.jpg", RutaEmpresa, ObjNomina.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) Dim ImgCBB As String @@ -7906,7 +7908,8 @@ Public Class ClsPaginas RptParametro.Add(New ReportParameter("NSS", ObjPersonal.NumeroSS)) RptParametro.Add(New ReportParameter("Departamento", ObjPersonal.Departamento)) - RptParametro.Add(New ReportParameter("Puesto", ObjPersonal.Puesto.ToString)) + RptParametro.Add(New ReportParameter("Puesto", ObjPersonal.Puesto.ToString())) + RptParametro.Add(New ReportParameter("FechaIngreso", ObjPersonal.FechaIngreso.ToString("dd/MM/yyyy"))) RptParametro.Add(New ReportParameter("Contrato", ObjPersonal.TipoContrato.ToString)) @@ -7927,7 +7930,7 @@ Public Class ClsPaginas RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo)) RptParametro.Add(New ReportParameter("DiasPagados", ObjNomina.DiasPagados.ToString)) - RptParametro.Add(New ReportParameter("MetodoPago", """PUE"" (Pago en una sola exhibición)")) + RptParametro.Add(New ReportParameter("MetodoPago", ObjNomina.MetodoPago)) '"""PUE"" (Pago en una sola exhibición)" RptParametro.Add(New ReportParameter("FormaPago", """99"" (Por definir)")) RptParametro.Add(New ReportParameter("Cantidad", "1")) @@ -7959,6 +7962,7 @@ Public Class ClsPaginas If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then DTPercepciones = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0") DTDeducciones = ObjNomina.DtResultados.FiltraParametros("Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0") + DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveConcepto IN (1471,1491)") For Each row As DataRow In DTPercepciones.Rows If row("Tipo").ToString() = "D" Then row("Codigo") = row("Codigo").ToString().Replace("D", "OP") @@ -7973,6 +7977,7 @@ Public Class ClsPaginas RptParametro.Add(New ReportParameter("PU", DTPercepciones.SUM("Importe").ToString())) RptParametro.Add(New ReportParameter("Importe", DTPercepciones.SUM("Importe").ToString())) + RptParametro.Add(New ReportParameter("ImporteDeducciones", DTDeducciones.SUM("Importe").ToString())) RptParametro.Add(New ReportParameter("SubTotal", DTPercepciones.SUM("Importe").ToString())) RptParametro.Add(New ReportParameter("Descuentos", DTDeducciones.SUM("Importe", "SATCveConcepto <> '002'").ToString())) @@ -7991,12 +7996,40 @@ Public Class ClsPaginas Dim rds2 = New ReportDataSource() - Dim limagenes = New List(Of utilImage)() - limagenes.Add(New utilImage(cQr)) - rds2.Name = "dsImagenes" - rds2.Value = limagenes - LSRds.Add(rds2) + Dim dtqr As New DataTable + + Dim column As DataColumn = New DataColumn("ImagenByte") + column.DataType = System.Type.[GetType]("System.Byte[]") + column.AllowDBNull = True + column.Caption = "ImagenByte" + dtqr.Columns.Add(column) + Dim rowqr As DataRow = dtqr.NewRow() + rowqr("ImagenByte") = cQr + + dtqr.Rows.Add(rowqr) + rds2.Name = "dsImagenes" + rds2.Value = dtqr + LSRds.Add(rds2) + Dim numnewfiles As Integer = 0 + If DTPercepciones.Rows.Count > DTDeducciones2.Rows.Count Then + + numnewfiles = DTPercepciones.Rows.Count - DTDeducciones2.Rows.Count + For index = 1 To numnewfiles + + DTDeducciones2.Rows.Add(DTDeducciones2.NewRow) + Next + Else + + If DTDeducciones2.Rows.Count > DTPercepciones.Rows.Count Then + numnewfiles = DTDeducciones2.Rows.Count - DTPercepciones.Rows.Count + For index = 1 To numnewfiles + + DTPercepciones.Rows.Add(DTPercepciones.NewRow) + Next + + End If + End If Dim RptDS As New ReportDataSource RptDS.Name = "DsOC" @@ -8005,7 +8038,7 @@ Public Class ClsPaginas Dim RDS As New ReportDataSource RDS.Name = "DataSet1" - RDS.Value = DTDeducciones + RDS.Value = DTDeducciones2 LSRds.Add(RDS) Dim Archivo As New System.IO.FileInfo(RutaFormato) @@ -8020,6 +8053,7 @@ Public Class ClsPaginas File.WriteAllBytes(String.Format("{0}PDF\Nomina\{1}.pdf", RutaEmpresa, ObjNomina.SerieFolio), Retorno) Catch ex As Exception Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + GuardaLog(String.Format("Ocurrió un error al generar el PDF {0}", ex)) End Try End If Else @@ -8040,12 +8074,6 @@ Public Class ClsPaginas Return Retorno End Function - Public Class utilImage - Public Sub New(imagenByte As Byte()) - Me.ImagenByte = imagenByte - End Sub - Public Property ImagenByte As Byte() - End Class #End Region #Region "PDF PAGOS" @@ -8311,7 +8339,7 @@ Public Class ClsPaginas End Sub #End Region - Public Sub CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos") + Public Sub CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing) Select Case UsuarioActual.Empresa.Tipo_CentroCosto Case 1 If DdlProyecto IsNot Nothing Then DdlProyecto.Visible = False @@ -8339,6 +8367,12 @@ Public Class ClsPaginas If AplicaTodos <> "" Then DdlProyecto.Items.Insert(0, New ListItem(AplicaTodos, "-1")) End If + If DdlSubProyectoMultiple IsNot Nothing Then + + DdlSubProyectoMultiple.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)) + DdlSubProyectoMultiple.DataBind() + If AplicaTodos <> "" Then DdlSubProyectoMultiple.Items.Insert(0, New ListItem(AplicaTodos, "-1")) + End If If DdlSubProyecto IsNot Nothing Then DdlSubProyecto.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)) DdlSubProyecto.DataBind() @@ -8353,7 +8387,7 @@ Public Class ClsPaginas DdlSeccionAlmacen.DataSource = dtsec DdlSeccionAlmacen.DataBind() If dtsec Is Nothing Then Exit Sub - If dtsec.Rows.Count = 1 Then + If dtsec.Rows.Count = 1 Then DdlSeccionAlmacen.SelectedIndex = 0 DdlSeccionAlmacen.Enabled = False Else 'si es mayor a uno que por default seleccione el primero, que seria el predeterminado diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index c8fd108b0..e378f3aae 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -144,8 +144,10 @@ Public Class LogicNominas End If If continuar AndAlso objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then If objNomina.DtResultados.Rows.Count > 0 Then - DtPercepciones = objNomina.DtResultados.FiltraParametros("Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0") - DtDeducciones = objNomina.DtResultados.FiltraParametros("Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL)") + Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0" + DtPercepciones = objNomina.DtResultados.FiltraParametros(filtropercepciones) + Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL)" + DtDeducciones = objNomina.DtResultados.FiltraParametros(filtrodeduc) DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'") Dim disrcomp As DataRow = DtOtrosPagos.FiltroPrimero("Codigo ='D999'") For Each drow As DataRow In DtDeducciones.Rows @@ -183,6 +185,9 @@ Public Class LogicNominas If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero() + 'If Asistencias > 15 Then + ' Asistencias = 15 + 'End If Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero() DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero() DiasPagados = Asistencias - Vacaciones @@ -279,18 +284,19 @@ Public Class LogicNominas End If 'subsidio al empleo - 'If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 17 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio - ' ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo - ' .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal}) - 'End If + If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 17 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio + ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo + .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal}) + End If Next End If If DtOtrosPagos IsNot Nothing AndAlso DtOtrosPagos.Rows.Count > 0 Then For Each Row As DataRow In DtOtrosPagos.Rows + If (Row("Importe").ToString().ToDecimal() > 0) OrElse - (Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 2 AndAlso (CveRegimenContratacion.ToEntero() = 2 OrElse Row("Importe").ToString().ToDecimal() <> 0)) OrElse - (Row("SATCveConcepto").ToString().ToEntero().ToEntero().Contiene(2, 4) AndAlso Row("Importe").ToString().ToDecimal() < 0) Then + (Row("SATCveConcepto").ToString().ToEntero() = 2 AndAlso (CveRegimenContratacion.ToEntero() = 2 OrElse Row("Importe").ToString().ToDecimal() <> 0)) OrElse + (Row("SATCveConcepto").ToString().ToEntero().Contiene(2, 4) AndAlso Row("Importe").ToString().ToDecimal() < 0) Then If Row("CveSATConcepto").ToString() = "" Then cfdi.AddMsg(String.Format("Concepto No registrado ({0})", Row("Concepto").ToString())) : Exit For Dim otrp = New CFDINominaOtrosPagos With {.TipoOtroPago = Row("SATCveConcepto").ToString(), .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), @@ -298,11 +304,11 @@ Public Class LogicNominas ObjOtrosPagos.Add(otrp) - If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 7 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio + If Row("SATCveConcepto").ToString().ToEntero() = 7 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio ObjDeducciones.Add(New CFDINominaDeducciones With {.TipoDeduccion = "002", ' codigo fijo .Clave = Row("Codigo").ToString(), .Concepto = "ISR", .Importe = Row("Importe").ToString().ToDecimal}) End If - If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 8 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio + If Row("SATCveConcepto").ToString().ToEntero() = 8 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio ObjDeducciones.Add(New CFDINominaDeducciones With {.TipoDeduccion = "071", ' codigo fijo .Clave = Row("Codigo").ToString(), .Concepto = "(Ajuste en Subsidio para el empleo (efectivamente entregado al trabajador)", .Importe = Row("Importe").ToString().ToDecimal}) End If diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 26418aaed..9a5f4a0c9 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -2061,7 +2061,7 @@ Public Class Timbrado If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then If otpag.ejercicio > 0 Then - cfdi.CompensacionSaldosAFavor(otpag.Importe, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor + cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor End If End If diff --git a/Bancos/PopIEVentas.aspx b/Bancos/PopIEVentas.aspx index cdaa66505..81291fcc3 100644 --- a/Bancos/PopIEVentas.aspx +++ b/Bancos/PopIEVentas.aspx @@ -38,7 +38,7 @@ -   +   diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 00a20f1f1..07c87b1ed 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -694,14 +694,8 @@ Partial Class Bancos_PopIEVentas If Valida.EsValida > 0 Then If Valida.EsValida = 2 Then - Validada = False - 'Dim ObjDatos As New ClsCompras - - 'If ObjDatos.UpdateEstatus(Valida.EsValida, gvr.DataKey("CveFactura").ToEntero) Then - - 'End If - 'ObjDatos.Dispose() - + Validada = False + BtnGuardar.Enabled = False If UsuarioActual.Empresa.UsaAC Then @@ -715,7 +709,9 @@ Partial Class Bancos_PopIEVentas End If Else 'no se pudo validar, pero ya tuvo la primera vuelta de validacion + Alert("La factura no se pudo validar.") Validada = False + BtnGuardar.Visible = False End If Valida.Dispose() Else diff --git a/CRM/EmpresaCRM.aspx b/CRM/EmpresaCRM.aspx index 24e763256..1f64d8e96 100644 --- a/CRM/EmpresaCRM.aspx +++ b/CRM/EmpresaCRM.aspx @@ -72,8 +72,8 @@
    - - +<%-- + --%>
    diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index d55250157..f93c37a81 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -14523,7 +14523,7 @@ Partial Class Compras_Compras Protected Sub BtnRefacturacionVer_Click(sender As Object, e As EventArgs) Handles BtnRefacturacionVer.Click Dim Opcion As Integer = 1 - If UsuarioActual.CveEmpresa.Contiene(119, 72, 1) Then Opcion = 2 + If UsuarioActual.CveEmpresa.Contiene(119, 1) Then Opcion = 2 Dim ObjCompras As New ClsCompras @@ -17961,12 +17961,12 @@ Partial Class Compras_Compras Exit Sub End If - If UsuarioActual.Empresa.Tipo_CentroCosto = 3 Or UsuarioActual.Empresa.Tipo_CentroCosto = 4 Or UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then - If Not DdlProyecto.SelectedValue.ToEntero > 0 Then - Alert("Es necesario seleccionar un proyecto.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If + 'If UsuarioActual.Empresa.Tipo_CentroCosto = 3 Or UsuarioActual.Empresa.Tipo_CentroCosto = 4 Or UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then + ' If Not DdlProyecto.SelectedValue.ToEntero > 0 Then + ' Alert("Es necesario seleccionar un proyecto.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + 'End If If Not DdlSubProyecto.SelectedValue.ToEntero > 0 Then Alert("Es necesario seleccionar un subproyecto.", TipoMensaje.MsgAdvertencia) diff --git a/Contabilidad/PlantillasPolizasDetalle.aspx.vb b/Contabilidad/PlantillasPolizasDetalle.aspx.vb index 7449e664d..c80bca90a 100644 --- a/Contabilidad/PlantillasPolizasDetalle.aspx.vb +++ b/Contabilidad/PlantillasPolizasDetalle.aspx.vb @@ -381,7 +381,7 @@ CveCuenta:=DdlCuentas.SelectedValue.ToEntero) Then If UsuarioActual.Empresa.TipoContabilizacion = 0 Then 'busco en la cuenta contable, lo que tenga asignado Dim Con As New ClsContabilidad - Dim dtt As DataTable + Dim dtt As DataTable = Nothing If Con.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then dtt = Con.DtResultados End If diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index 5d6f271af..286ca172c 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -273,7 +273,7 @@
    - +
    @@ -309,86 +309,112 @@
    - - - - Cuenta - -
    - -
    - -
    - - Referencia - - - - - - - Concepto - - - - - - - SubProyecto - - - - - - - TipoGasto - - - - - - - Ref. Bancaria - - - - - - - Cargo - - - - - - - Abono - - - - - - - - - - - - - - - - - - - -
    - - - -
    +
    +
    +
    + + Movimientos +
    + +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + + Cuenta + +
    + +
    + +
    + + Referencia + + + + + + + Concepto + + + + + + + SubProyecto + + + + + + + TipoGasto + + + + + + + Ref. Bancaria + + + + + + + Cargo + + + + + + + Abono + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    +
    +
    @@ -396,116 +422,141 @@
    - - - - Movimiento - -
    -<%-- +
    +
    +
    + + Movimientos +
    + +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + + + Movimiento + +
    + <%-- --%> -
    - -
    + + + - - Documento - - -
    -
    - -
    + + Documento + + +
    +
    + +
    - - Referencia - -
    -
    - -
    + + Referencia + +
    +
    + +
    - - Concepto - -
    -
    - -
    - - - SubProyecto + + Concepto + +
    +
    + +
    + + + SubProyecto <%-- --%> - - -
    - <%----%> - <%--
    --%> -
    - -
    - - TipoGasto - -
    - <%----%> - <%----%> -
    - -
    - - Cuenta - -
    - <%----%> - <%--
    --%> -
    - -
    - - TC - -
    -
    - -
    - - Cargo - -
    -
    -
    - <%-- +
    + +
    + <%----%> + <%--
    --%> +
    + +
    + + TipoGasto + +
    + <%----%> + <%----%> +
    + +
    + + Cuenta + +
    + <%----%> + <%--
    --%> +
    + +
    + + TC + +
    +
    + +
    + + Cargo + +
    +
    +
    + <%-- --%> -
    -
    - - Abono - -
    -
    -
    - <%-- +
    +
    + + Abono + +
    +
    +
    + <%-- --%> -
    -
    + + - - - - - - + + + + + + -
    - - - -
    + + + + + +
    +
    @@ -650,7 +701,7 @@ - +
    diff --git a/Empresas/119/Formatos/Nomina.rdlc b/Empresas/119/Formatos/Nomina.rdlc index 939e14537..23240a972 100644 --- a/Empresas/119/Formatos/Nomina.rdlc +++ b/Empresas/119/Formatos/Nomina.rdlc @@ -656,8 +656,8 @@ DsOC - 8.83958cm - 0.1598cm + 8.8134cm + 0.14687cm 2.05138cm 10.0953cm - Textbox230 + Textbox4 @@ -1100,6 +1100,7 @@ es-MX + true @@ -1234,8 +1235,8 @@ DataSet1 - 8.84178cm - 10.25511cm + 8.8156cm + 10.24218cm 2.05606cm 9.79494cm 1 @@ -1266,10 +1267,10 @@ - 5.73971cm + 7.3669cm - 5.74636cm + 7.37355cm @@ -1328,7 +1329,7 @@ - Sello digital del Emisor + Sello digital del emisor @@ -2258,14 +2260,13 @@ Lugar de expedición: 83220 Hermosillo - Black - 1pt 2pt 2pt 2pt 2pt + es-MX @@ -2431,8 +2432,8 @@ Lugar de expedición: 83220 Hermosillo DsOC - 11.00367cm - 0.1598cm + 10.97749cm + 0.14687cm 2.21479cm 19.89025cm 4 @@ -2446,30 +2447,30 @@ Lugar de expedición: 83220 Hermosillo - 2.24293cm + 2.2642cm - 2.0898cm + 2.11107cm - 2.18893cm + 2.2102cm - 2.55215cm + 2.57342cm - 4.82941cm + 4.85068cm - 2.61173cm + 2.633cm - 3.23933cm + 3.2606cm - 0.6cm + 0.49417cm @@ -2518,7 +2519,7 @@ Lugar de expedición: 83220 Hermosillo - 0.49417cm + 0.46771cm @@ -2782,7 +2783,7 @@ Lugar de expedición: 83220 Hermosillo - 0.44125cm + 0.46771cm @@ -3186,7 +3187,7 @@ Lugar de expedición: 83220 Hermosillo - 0.6cm + 0.46771cm @@ -3235,7 +3236,7 @@ Lugar de expedición: 83220 Hermosillo - 0.54708cm + 0.4677cm @@ -3669,7 +3670,212 @@ Lugar de expedición: 83220 Hermosillo - 0.52062cm + 0.46771cm + + + + + true + true + + + + + Fecha ingreso + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!FechaIngreso.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.44124cm @@ -3718,7 +3924,7 @@ Lugar de expedición: 83220 Hermosillo - 0.54708cm + 0.44125cm @@ -4152,7 +4358,7 @@ Lugar de expedición: 83220 Hermosillo - 0.46771cm + 0.44125cm @@ -4381,7 +4587,7 @@ Lugar de expedición: 83220 Hermosillo - 0.52062cm + 0.49416cm @@ -4559,7 +4765,7 @@ Lugar de expedición: 83220 Hermosillo arial 7.5pt Normal - #,0.00;(#,0.00) + '$'#,0.00;('$'#,0.00) @@ -4577,6 +4783,7 @@ Lugar de expedición: 83220 Hermosillo 2pt 2pt 2pt + es-MX @@ -4613,6 +4820,7 @@ Lugar de expedición: 83220 Hermosillo 2pt 2pt 2pt + es-MX @@ -4646,13 +4854,14 @@ Lugar de expedición: 83220 Hermosillo + DsOC - 2.45745cm - 0.29576cm - 6.22103cm - 19.75428cm + 2.58974cm + 0.14687cm + 6.13311cm + 19.90317cm 5 - Textbox216 @@ -4812,7 +5023,9 @@ Lugar de expedición: 83220 Hermosillo - Textbox221 @@ -4883,7 +5096,9 @@ Lugar de expedición: 83220 Hermosillo - Textbox224 @@ -4987,10 +5202,10 @@ Lugar de expedición: 83220 Hermosillo DsOC - 0.12976cm - 13.50372cm + 0.05745cm + 12.97684cm 2.4cm - 6.55925cm + 7.0732cm 7 + + + + + 11.53918cm + + + 2.5cm + + + 5.85106cm + + + + + 0.6cm + + + + + true + true + + + + + Recibí de la empresa arriba mencionada, la cantidad neta a que este documento, se refiere, estando conforme con las Percepciones y deducciones que en el aparecen especificados. + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.52062cm + + + + + true + true + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!NombreCompleto.Value + + + + + + + Textbox17 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + DsOC + 19.20744cm + 0.14687cm + 1.12062cm + 19.89024cm + 8 + + + + - 19.28653cm + 20.50445cm + + + + + + + =Parameters!Beneficiario.Value + + + + + + + Textbox1 + 4.74296cm + 3.20146cm + 0.6cm + 12.70388cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + Concepto del pago: + + + + + + + + =Parameters!Observaciones.Value + + + + + + + Textbox1 + 7.94971cm + 1.11125cm + 1.65834cm + 14.23847cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + =Parameters!Folio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Importe.Value + + + + + + + Textbox1 + 4.76639cm + 17.62802cm + 0.49896cm + 2.49471cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =CDATE(Parameters!Fecha.Value).ToString("dd/MM/yyyy") + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ImporteLetra.Value + + + + + + + Textbox1 + 6.11879cm + 1.11125cm + 0.6cm + 14.79409cm + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + R.F.C. + + + + =Parameters!RFC.Value + + + + 0cm + 0cm + + + + + + + + + + 0cm + 0cm + + + + + + + + + + 0cm + 0cm + + + + Textbox2 + 2.52624cm + 3.35393cm + 2.12019cm + 13.5092cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + 4.72758cm + 15.14686cm + 0cm + 4.97587cm + 7 + + + + + + 5.2336cm + 1.11125cm + 0cm + 14.23847cm + 8 + + + + + + 6.64105cm + 1.11125cm + 0cm + 14.23847cm + 9 + + + + + + true + true + + + + + Importe: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + No. + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + $ + + + + + + + Textbox1 + 4.73315cm + 17.59627cm + 0.56395cm + 0.49037cm + 13 + + + 2pt + 2pt + 2pt + 2pt + + + + 4.60417in + + + + =Today + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 29.7cm + 21cm + 0cm + 0cm + 0cm + 0.13cm + + + + + + + + 2pt + + + + 2pt + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad + + + + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave Pr./Se + + + + + + + Textbox29 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave U. + + + + + + + Textbox2 + + + + + 2pt + + + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Nombre + + + + + + + Textbox17 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Precio + + + + + + + Textbox53 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tasa IVA + + + + + + + Textbox21 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Descto. + + + + + + + Textbox23 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SubTotal + + + + + + + Textbox1 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.14436in + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!UM.Value + + + + + + + UM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + + Codigo + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SATClaveProdServ.Value + + + + + + + SATClaveProdServ + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PS.Value & IIF(Fields!Obs.Value <> "",System.Environment.NewLine &"Observaciones: ","") & Fields!Obs.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PU.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Descuento + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Cantidad.Value * Fields!PU.Value + + + + + + + TiempoEntrega + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsOC + 2.25278in + 0.09836in + 0.34081in + 8.20966in + + + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + =Parameters!Observaciones.Value + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Expedido en Sucursal: 2 + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + COTIZACIÓN + + + + + + + Textbox8 + 0.31432cm + 18.23008cm + 0.6cm + 2.79101cm + 5 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =IIF(Parameters!Serie.Value.ToString="",Parameters!Folio.Value,Parameters!Serie.Value & "-" &Parameters!Folio.Value) + + + + + + + Textbox8 + 0.91432cm + 18.23008cm + 0.6cm + 2.79101cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora: + + + + + + + + + =Parameters!Fecha.Value + + + + + + + Textbox8 + 1.51432cm + 18.23008cm + 0.86903cm + 2.79101cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + Lugar, fecha y hora de emisión: + + + + =Parameters!Fecha.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + + + + + + =Parameters!ClienteColonia.Value + + + + + + + + =Parameters!ClienteCiudad.Value + + + + + + + + =Parameters!ClienteEstado.Value + + + + CP + + + + =Parameters!ClienteCP.Value + + + + + + + + =Parameters!ClientePais.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CondicionPago.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteRFC.Value + + + + + + + Textbox35 + 5.09559cm + 0.26772cm + 0.52062cm + 9.72441cm + 11 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =UCase(Parameters!ImporteLetra.Value) + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Este documento es una cotización sin efectos fiscales ni tampoco es un comprobante de pago + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.91432cm + 0.19008cm + 1.23542cm + 3.86912cm + 16 + + + + + + + + + 2.88535cm + + + + + 0.48004cm + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + =Fields!ImpuestoLocal.Value + + + + 2.82569cm + + + true + true + + + + + =IIF(Fields!ImpuestoLocal.Value = "Total",UCase(Fields!ImpuestoLocal.Value),Fields!ImpuestoLocal.Value) + + + + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + DataSet1 + 7.84713cm + 15.30755cm + 0.48004cm + 5.71104cm + 17 + + + + + + 10.69327cm + + + + + + + Textbox35 + 0.17639cm + 18.52109cm + 0.50624cm + 2.5cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + + =Now() + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 27.94cm + 21.59cm + 0cm + 0cm + 0.5cm + 0.5cm + 1.27cm + + + + + + + Textbox14 + + + + White + + 1pt + + + LightGrey + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Textbox9 + + + + White + + 1pt + + + LightGrey + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Cantidad + + + + + + + Textbox10 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox18 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + LightGrey + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.9175cm + + + + + true + true + + + + + Código + + + + + + + Textbox15 + + + + White + + 1pt + + + LightGrey + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Articulos + + + + + + + Textbox2 + + + + White + + 1pt + + + LightGrey + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Exist. Inicial + + + + + + + Textbox4 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Entradas + + + + + + + Textbox7 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Salidas + + + + + + + Textbox13 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Exist. + + + + + + + + + Final + + + + + + + Textbox16 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldo Inicial + + + + + + + Textbox19 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Entradas + + + + + + + Textbox22 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Salidas + + + + + + + Textbox25 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldo Final + + + + + + + Textbox28 + + + + White + + 1pt + + + White + + 1pt + + + White + + 1pt + + + LightGrey + + 1pt + + #d3d3d3 + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.40421cm + + + + + true + + + + + =Fields!Codigo.Value + + + + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + + + + + =Fields!PS.Value + + + + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SaldoIniCant.Value = "0", "-", Fields!SaldoIniCant.Value) + + + + + + + SaldoInitCant + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!EntradaCant.Value = "0", "-", Fields!EntradaCant.Value) + + + + + + + EntradaCant + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SalidaCant.Value = "0", "-", Fields!SalidaCant.Value) + + + + + + + SalidaCant + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SaldoFCant.Value = "0", "-", Fields!SaldoFCant.Value) + + + + + + + SaldoFCant + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SaldoIniImp.Value = "0", "-", Fields!SaldoIniImp.Value) + + + + + + + SaldoIniImp + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!EntradaImp.Value = "0", "-", Fields!EntradaImp.Value) + + + + + + + EntradaImp + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SalidaImp.Value = "0", "-", Fields!SalidaImp.Value) + + + + + + + SalidaImp + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =IIF(Fields!SaldoFImp.Value = "0", "-", Fields!SaldoFImp.Value) + + + + + + + SaldoFImp + + + + LightGrey + + + + LightGrey + + + =Iif(Fields!CvePS.Value=-1, "#67809F","White") + 2pt + 2pt + 1pt + + + + + + + + 0.6cm + + + + + true + true + + + + + + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SaldoInitCant.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!EntradaCant.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SalidaCant.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SaldoFCant.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SaldoIniImp.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!EntradaImp.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SalidaImp.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!SaldoFImp.Value, "DataSet1") + + + + + + =Iif(Fields!CvePS.Value=-1, "LightGrey","White") + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + + After + true + true + + + After + true + true + + + + + + + true + + Before + + + + DataSet1 + 0.20849cm + 0.00415cm + 2.52171cm + 20.90254cm + + + + + + 1.16692in + + + + + + + Textbox1 + 0.22049cm + 4.38539cm + 0.6cm + 11.45673cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + REPORTE DE ENTRADAS Y SALIDAS + + + + + + + + + + + + + + + + Textbox2 + 1.13799cm + 4.38539cm + 0.52945cm + 11.45673cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!AgrupadoPor.Value + HTML + + + 2pt + 2pt + 2pt + 2pt + + + + 4.4023cm + 0.01325cm + 0cm + 20.90669cm + 3 + + + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.22049cm + 0.08381cm + 1.60584cm + 4.19575cm + 4 + + + + + + + + + + + 0.727cm + true + true + + + true + true + + + + + ="Página: " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox3 + 0.28575cm + 15.06595cm + 0.44125cm + 5.51625cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario: + + + + + + + Textbox8 + 0.28575cm + 0.6059cm + 0.44125cm + 1.60042cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!UsuarioImprimio.Value + + + + + + + Textbox9 + 0.28575cm + 2.15023cm + 0.44125cm + 5.14936cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + Textbox10 + 0.28575cm + 7.47001cm + 0.44125cm + 2.92333cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + = Format(Now(),"dd-MM-yyyy HH:mm tt") + + + + + + + Textbox11 + 0.28575cm + 10.37923cm + 0.44125cm + 4.32745cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 0.127cm + 0cm + 20.90669cm + 5 + + + + + + + + + + 27.94cm + 21.59cm + 0.5cm + 0cm + 0.5cm + 1cm + 0.13cm + + + + + + true + true + true + + + + + Sello Digital del CFDI: + + + + + + + + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + 4.17868in + 0.06752in + 1.60919in + 8.23953in + + + + + + + + + 0.54014in + + + 0.59111in + + + 0.80359in + + + 0.66404in + + + 2.60074in + + + 0.83102in + + + 0.6403in + + + 0.69088in + + + 0.80447in + + + + + 0.19645in + + + + + true + true + + + + + # Cant. + + + + + + + + 2pt + + + + 2pt + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad + + + + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave Pr./Se + + + + + + + Textbox29 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave U. + + + + + + + Textbox2 + + + + + 2pt + + + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Nombre + + + + + + + Textbox17 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Precio + + + + + + + Textbox53 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tasa IVA + + + + + + + Textbox21 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Descto. + + + + + + + Textbox23 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SubTotal + + + + + + + Textbox1 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.16561in + + + + + true + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!UM.Value + + + + + + + UM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!SATClaveProdServ.Value + + + + + + + SATClaveProdServ + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!SATClaveUM.Value + + + + + + + SATClaveUM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PS.Value & IIF(Fields!Obs.Value <> "",System.Environment.NewLine &"Observaciones: ","") & Fields!Obs.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PU.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PorcentajeIVA.Value + + + + + + + PorcentajeIVA + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!Cantidad.Value * Fields!PU.Value + + + + + + + TiempoEntrega + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsOC + 1.92778in + 0.09836in + 0.36206in + 8.16629in + 1 + + + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Expedido en Sucursal: + + + + =Parameters!Sucursal.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =UCase(Parameters!TipoDocumento.Value) + + + + + + + Textbox8 + 18.23008cm + 0.96018cm + 2.79101cm + 6 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =IIF(Parameters!Serie.Value.ToString="",Parameters!Folio.Value,Parameters!Serie.Value & "-" &Parameters!Folio.Value) + + + + + + + Textbox8 + 0.97782cm + 18.23008cm + 0.6cm + 2.79101cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora: + + + + + + + + + =Parameters!Fecha.Value + + + + + + + Textbox8 + 1.57782cm + 18.23008cm + 0.86903cm + 2.79101cm + 8 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + Folio Fiscal: + + + + =Parameters!FolioFiscal.Value + + + + + + + + + Fecha y hora de certificacion: + + + + =Parameters!FechaCertificacion.Value + + + + + + + + + No. de Serie del Certificado del SAT: + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + + Textbox4 + 2.88607cm + 0.28014cm + 1.09007cm + 9.71199cm + 9 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + No. de Serie del Certificado del CSD: + + + + =Parameters!CertificadoContribuyente.Value + + + + + + + =Parameters!CiudadSucursal.Value + + + + + + + + =Parameters!Fecha.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + + + + + + =Parameters!ClienteColonia.Value + + + + + + + + =Parameters!ClienteCiudad.Value + + + + + + + + =Parameters!ClienteEstado.Value + + + + CP + + + + =Parameters!ClienteCP.Value + + + + + + + + =Parameters!ClientePais.Value + + + + + + + + + + + =Parameters!ClienteTelefono.Value + + + + + + + + =iif(Parameters!ClienteContactoMail.Value = "","","Correo: ") + + + + =Parameters!ClienteContactoMail.Value + + + + + + + =Parameters!ClienteRFC.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CondicionPago.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Ord. Compra: + + + + =Parameters!OrdenCompra.Value + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo de Comprobante:I + + + + =UCase(Parameters!TipoDocumento.Value) + + + + ,Moneda: + + + + =Parameters!MonedaAbreviatura.Value + + + + , Uso de CFDI: + + + + =Parameters!UsoCFDI.Value + + + + , Forma de Pago: + + + + =Parameters!FormaPago.Value + + + + , Método de Pago: + + + + =IIF(Parameters!MetodoPago.Value.ToString="","No Identificado",Parameters!MetodoPago.Value) + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.71282cm + 0.28014cm + 1.23542cm + 3.86912cm + 17 + + + + + + + + + 2.88535cm + + + + + 0.48004cm + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + =Fields!ImpuestoLocal.Value + + + + 2.82569cm + + + true + true + + + + + =IIF(Fields!ImpuestoLocal.Value = "Total",UCase(Fields!ImpuestoLocal.Value),Fields!ImpuestoLocal.Value) + + + + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + DataSet1 + 7.9071cm + 15.31342cm + 0.48004cm + 5.71104cm + 18 + + + + + + 14.91814cm + + + + + + + Textbox35 + 0.01763cm + 18.52109cm + 0.50624cm + 2.5cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + + =Now() + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario Imprimió: + + + + + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 27.94cm + 21.59cm + 0cm + 0cm + 0.5cm + 0.5cm + 1.27cm + + + + + + + Textbox3 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + U. M. + + + + + + + Textbox7 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Producto o Servicio + + + + + + + Textbox9 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Observaciones + + + + + + + Textbox68 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Sub Proyecto + + + + + + + Textbox71 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Activo Fijo + + + + + + + Textbox11 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + P. Unitario + + + + + + + Textbox13 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox5 + + + + Black + 3pt + + + Black + 3pt + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.473cm + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!UM.Value + + + + + + + UM + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!PS.Value + + + + + + + PS + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!Observacion.Value + + + + + + + Observacion + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!SubProyecto.Value + + + + + + + SubProyecto + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + + Codigo + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + true + true + + + + + =Fields!Total.Value + + + + + + + Total + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 1pt + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsOC + 4.45714cm + 0.37406cm + 0.96717cm + 20.25838cm + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + + + true + true + + + + + IVA + + + + + + + Textbox20 + 6.29242cm + 16.30259cm + 0.45183cm + 2.06968cm + 1 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Total " & Parameters!Moneda.Value + + + + + + + Textbox20 + 6.74425cm + 16.30259cm + 0.45183cm + 2.06968cm + 2 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Descuento + + + + + + + Textbox20 + 5.86881cm + 16.30259cm + 0.42361cm + 2.06968cm + 3 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!IVA.Value + + + + + + + Textbox20 + 6.29242cm + 18.37226cm + 0.45183cm + 2.26019cm + 4 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Total.Value + + + + + + + Textbox20 + 6.74425cm + 18.37225cm + 0.45183cm + 2.26019cm + 5 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Descuento.Value + + + + + + + Textbox20 + 5.86881cm + 18.37225cm + 0.42361cm + 2.26019cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!ImporteLetra.Value + + + + + + + Textbox46 + 6.74425cm + 0.37406cm + 0.45183cm + 15.92855cm + 7 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ORDEN DE COMPRA DE MATERIALES Y SERVICIOS + + + + + + + Textbox8 + 1.24262cm + 5.09642cm + 0.5365cm + 10.29733cm + 8 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoOC.Value + + + + + + + Textbox12 + 16.30259cm + 0.44478cm + 4.32987cm + 9 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Folio.Value + + + + + + + Textbox12 + 0.44478cm + 16.30259cm + 0.44478cm + 4.32987cm + 10 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresion + + + + + + + Textbox12 + 0.88956cm + 16.3026cm + 0.44478cm + 4.32987cm + 11 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Format(Globals!ExecutionTime,"dd/MM/yyyy") + + + + + + + Textbox12 + 1.33434cm + 16.30259cm + 0.44478cm + 4.32987cm + 12 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Proveedor + + + + + + + Textbox12 + 2.41498cm + 0.37406cm + 0.44478cm + 2.34596cm + 13 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Descripción + + + + + + + Textbox12 + 2.85976cm + 0.37406cm + 0.44478cm + 2.34596cm + 14 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Justificación + + + + + + + Textbox12 + 3.30454cm + 0.37406cm + 0.44478cm + 2.34596cm + 15 + + + Black + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Entrega + + + + + + + Textbox12 + 2.85976cm + 13.78003cm + 0.44478cm + 2.52258cm + 16 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Lugar de Entrega + + + + + + + Textbox12 + 3.30454cm + 13.78003cm + 0.44478cm + 2.52258cm + 17 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Estatus + + + + + + + Textbox12 + 2.41498cm + 13.78003cm + 0.44478cm + 2.52258cm + 18 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =iif(Parameters!FechaEntrega.Value="01/01/0001","",Parameters!FechaEntrega.Value) + + + + + + + Textbox12 + 2.85976cm + 16.30259cm + 0.44478cm + 4.32987cm + 19 + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ProveedorLugar.Value + + + + + + + Textbox12 + 3.30454cm + 16.30259cm + 0.44478cm + 4.32987cm + 20 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Estatus.Value + + + + + + + Textbox12 + 2.41498cm + 16.30259cm + 0.44478cm + 4.32987cm + 21 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Descripcion.Value + + + + + + + Textbox12 + 2.85976cm + 2.72002cm + 0.44478cm + 11.06001cm + 22 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Asunto.Value + + + + + + + Textbox12 + 3.30454cm + 2.72002cm + 0.44478cm + 11.06001cm + 23 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ProveedorNombre.Value + + + + + + + Textbox12 + 2.41498cm + 2.72002cm + 0.44478cm + 11.06001cm + 24 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + SERVICIOS ELECTRICOS Y CONTROL DE HERMOSILLO S.A. DE C.V. + + + + + + + Textbox8 + 0.48034cm + 5.09642cm + 0.76228cm + 10.29733cm + 25 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Solicitante + + + + + + + Textbox12 + 8.9744cm + 3.24661cm + 0.44478cm + 5.83844cm + 26 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + + + + Textbox12 + 9.41918cm + 3.24661cm + 0.4095cm + 5.83844cm + 27 + + + + Black + + 1pt + + Top + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!NombreSolicito.Value + + + + + + + Textbox12 + 9.86396cm + 3.24661cm + 0.44478cm + 5.83844cm + 28 + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Autorizó + + + + + + + Textbox12 + 8.9744cm + 11.64269cm + 0.44478cm + 5.83844cm + 29 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + + + + Textbox12 + 9.41918cm + 11.64269cm + 0.4095cm + 5.83844cm + 30 + + + + Black + + 1pt + + Top + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!NombreAutorizo.Value + + + + + + + Textbox12 + 9.86396cm + 11.64269cm + 0.44478cm + 5.83844cm + 31 + + + White + 2pt + 2pt + 2pt + 2pt + + + + External + =Parameters!FirmaAutorizo.Value + Fit + 7.40422cm + 12.66192cm + 3.5cm + 3.5cm + 32 + + =iif(Parameters!FirmaAutorizo.Value <> "", False, True) + + + + + + + External + =Parameters!FirmaSolicito.Value + Fit + 7.40422cm + 4.4049cm + 3.5cm + 3.5cm + 33 + + =iif(Parameters!FirmaSolicito.Value <> "", False, True) + + + + + + + true + true + + + + + Uso CFDI 3.3: + + + + + + + Textbox12 + 3.74932cm + 0.37406cm + 0.44478cm + 2.34596cm + 34 + + + Black + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!UsoCFDI.Value + + + + + + + Textbox12 + 3.74932cm + 2.72002cm + 0.44478cm + 11.06001cm + 35 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + White + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + SubTotal + + + + + + + Textbox20 + 5.43618cm + 16.3026cm + 0.42361cm + 2.0597cm + 36 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SubTotal.Value + + + + + + + Textbox20 + 5.43618cm + 18.36228cm + 0.42361cm + 2.26019cm + 37 + + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + + LightGrey + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.44478cm + 0.37406cm + 1.60584cm + 4.54597cm + 38 + + + + + + 4.55973in + + + + + + + + =Now() + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox35 + 0.07056cm + 18.12247cm + 0.50624cm + 2.5cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 27.94cm + 21.59cm + 0.5cm + 0cm + 1cm + 1cm + 0.13cm + + + + + + + Textbox28 + + + + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + 1.32814cm + + + 1.44393cm + + + 1.89656cm + + + 1.98182cm + + + 1.60777cm + + + 1.84281cm + + + 1.54614cm + + + 1.90101cm + + + + + 0.41479cm + + + + + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!UnidadMedida.Value + + + + + + + UnidadMedida + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!PUPromedio.Value + + + + + + + PUPromedio + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!SubTotal.Value + + + + + + + SubTotal + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento1 + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!VentaNeta.Value + + + + + + + VentaNeta + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!IVA.Value + + + + + + + IVA + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!Total.Value + + + + + + + Total + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + 0.49417cm + + + true + true + + + + + Cantidad + + + + + + + Textbox40 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + Unidad + + + + + + + Textbox5 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + P. Promedio + + + + + + + Textbox12 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + Venta Total + + + + + + + Textbox42 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + Descuento + + + + + + + Textbox17 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + Venta Neta + + + + + + + Textbox44 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + IVA + + + + + + + Textbox51 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.49417cm + + + true + true + + + + + Total + + + + + + + Textbox47 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + =Fields!GPO.Value + + + + 6.35646cm + + + true + + + + + =LEFT(Fields!GPO.Value,45) + + + + + + =Switch(Fields!Orden.Value = 4,"#9CACC1",Fields!Orden.Value = 3,"#B9B5B4",Fields!Orden.Value = 2,"#CCCCCC",Fields!Orden.Value = 1,"#DDDDDD",Fields!Orden.Value = 0,"Transparent") + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + DataSet1 + 0.90896cm + 19.90464cm + + + + + + 0.39952in + + + + + + + Textbox1 + 0.18521cm + 4.30829cm + 0.6cm + 11.35684cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + REPORTE DE VENTAS POR PRODUCTO + + + + + + + Textbox2 + 1.10271cm + 4.30829cm + 0.52945cm + 11.35684cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Inicio: + + + + + + + + + =IIF(Parameters!FechaInicio.Value = "-1","",Parameters!FechaInicio.Value) + + + + + + + + + + + + + + + Fecha Fin: + + + + + + + + + =IIF(Parameters!FechaFin.Value = "-1","",Parameters!FechaFin.Value) + + + + Textbox13 + 17.43784cm + 2.14051cm + 2.33715cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Parametros.Value + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.18521cm + 0.04198cm + 1.60584cm + 4.19575cm + 4 + + + + + + + + + + + 0.84667cm + true + true + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox3 + 0.08291cm + 17.70912cm + 0.68085cm + 2.06587cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Now() + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 29.7cm + 21cm + 0.5cm + 0.5cm + 1cm + 1cm + 0.13cm + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Código + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad Medida + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Descripción + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Costo + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Valor + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.30367cm + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + + Codigo + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!UnidadMedida.Value + + + + + + + UnidadMedida + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + true + + + + + =Fields!PS.Value + + + + + + + PS + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!PU.Value + + + + + + + PU + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!Total.Value + + + + + + + Total + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + 0.44125cm + + + + + true + true + + + + + =Sum(Fields!Cantidad.Value) + + + + + + + Textbox20 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + Total Productos + + + + + + + Textbox21 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + + + + + + + + Textbox23 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + + + + + + + + Textbox37 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + + + + + + + + Textbox41 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + + + + + + + + Textbox42 + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + + + Before + + + + DsInventarios + 0.07056cm + 0.00711cm + 1.17559cm + 19.56807cm + + + + + + 0.68252in + + + + + + + Textbox2 + 0.03803cm + 4.37423cm + 2.04667cm + 10.17859cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox4 + 4.48094cm + 17.3888cm + 0.6cm + 1.76305cm + 1 + + + 2pt + 2pt + + + + true + true + + + + + Fecha: + + + + + + + Textbox5 + 4.48092cm + 16.27404cm + 0.6cm + 1.11476cm + 2 + + + 2pt + 2pt + + + + true + true + + + + + =Parameters!Folio.Value + + + + + + 2pt + 2pt + + + + true + true + + + + + FOLIO: + + + + Textbox5 + 0.03803cm + 17.07518cm + 0.6cm + 1.18203cm + 4 + + + Bottom + 2pt + 2pt + + + + true + true + + + + + =iif(Parameters!CveConcepto.Value = 8, "AVISO", "RECEPCIÓN") & " DE TRASLADO" + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SubProyecto.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Origen: + + + + =Parameters!Origen.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Destino: + + + + =Parameters!Destino.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + LOGOSERVECENJPG + FitProportional + 0.03803cm + 0.07265cm + 1.60584cm + 4.19575cm + 9 + + + + + + + + + + + 6.45758cm + true + true + + + true + true + + + + + =Parameters!NombreEntrego.Value + + + + Textbox21 + 1.87056cm + 2.54cm + 0.63472cm + 5.79375cm + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!NombreAccion.Value + + + + Textbox21 + 1.87056cm + 11.25481cm + 0.63528cm + 5.78664cm + 1 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Firma + + + + Textbox21 + 3.82353cm + 2.54795cm + 1.2cm + 5.78664cm + 2 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Nombre y Firma + + + + Textbox21 + 3.82354cm + 11.26191cm + 1.2cm + 5.78664cm + 3 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + OBSERVACIONES: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + 1.37639cm + 0.00626cm + 0cm + 19.57518cm + 6 + + + + + + 0.17639cm + 0cm + 19.57518cm + 7 + + + + + + true + true + + + + + ENTREGA + + + + + + + Textbox22 + 1.41167cm + 2.54795cm + 0.6cm + 5.78664cm + 8 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Accion.Value + + + + + + + Textbox22 + 1.37639cm + 11.26191cm + 0.6cm + 5.78664cm + 9 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =IIF(Parameters!NombreAccion.Value=-1,"",Parameters!NombreAccion.Value) + + + + Textbox21 + 1.87cm + 6.89031cm + 0.63528cm + 5.78664cm + 10 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Nombre y Firma + + + + Textbox21 + 3.82298cm + 6.89741cm + 1.2cm + 5.78664cm + 11 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Accion.Value + + + + + + + Textbox22 + 1.37583cm + 6.89741cm + 0.6cm + 5.78664cm + 12 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario: + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + =Parameters!FechaImpresion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox35 + 5.90548cm + 17.07518cm + 0.41981cm + 2.5cm + 15 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.70264cm + 0.00313cm + 0cm + 19.57518cm + 16 + + + + + + + + + + 25cm + 21.59cm + 1cm + 0cm + 1cm + 1cm + 0.13cm + + + - - + + + Textbox1 + 0.70708in + 0.23958in + 2.72234in + + 2pt + 2pt + 2pt + 2pt - - - Textbox1 - 0.30208in - 0.43625in - 0.3125in - 7.52083in - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información de Distribuidor + + + true + true + + + + + Información de Distribuidor + + + - - + + + Textbox2 + 0.30083in + 0.43625in + 0.20139in + 3.41668in + 1 + + Silver + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 0.73833in - 0.43625in - 0.22917in - 7.52083in - 1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Nombre del distribuidor: + + + true + true + + + + + Nombre del distribuidor: + + + + =Parameters!NombreDistribuidor.Value + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Ciudad, Estado: + + + + =Parameters!CiudadEstado.Value + + + - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Ciudad, Estado: + + + Textbox3 + 0.64389in + 0.43625in + 0.13889in + 2.17709in + 3 + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tel. + + + + =Parameters!TelCliente.Value + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre del mayorista que lo atiende: + + + + =Parameters!NombreEmpresa.Value + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Tel. + + + Textbox3 + 0.78278in + 0.43623in + 0.13889in + 3.41668in + 5 + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Consecutivo acuse de acumuladores: + + + + =Parameters!Consec.Value + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Folio acuse: + + + + =Parameters!FolioAcuse.Value + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Nombre del mayorista que lo atiende: - - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Consecutivo acuse de acumuladores: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Folio acuse: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información de Garantía o Ajuste + + + Textbox3 + 0.92167in + 2.61332in + 0.13889in + 1.23959in + 7 + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Información de Garantía o Ajuste + + + - - + + + Textbox2 + 1.06055in + 0.43623in + 0.17014in + 3.41668in + 8 + + Silver + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 1.80082in - 0.43625in - 0.22917in - 7.52083in - 8 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha de instalación: + + + true + true + + + + + Fecha de instalación: + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Año: + + + Textbox3 + 1.23069in + 0.43625in + 0.13889in + 1.11807in + 9 + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Año: + + + + =Year(Parameters!FechaInst.Value) + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Día: + + + + =Day(Parameters!FechaInst.Value) + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Día: + + + Textbox3 + 1.23069in + 1.55432in + 0.13889in + 0.60068in + 11 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Mes: + + + + = MonthName(Month(Parameters!FechaInst.Value)) + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha de Reclamación: + + + - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Mes: + + + Textbox3 + 1.36958in + 0.43622in + 0.13889in + 1.1181in + 13 + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Año: + + + + = Year(Parameters!Fecha.Value) + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Día: + + + + =Day(Parameters!Fecha.Value) + + + - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha de Reclamación: + + + Textbox3 + 1.36958in + 1.55432in + 0.13889in + 0.60068in + 15 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Mes: + + + + = MonthName(Month(Parameters!Fecha.Value)) + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Año: + + + Textbox3 + 1.36958in + 2.155in + 0.13889in + 0.87498in + 16 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Defecto: + + + + =Parameters!Defecto.Value + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + %Ajuste: + + + + =Parameters!PorcentajeAjuste.Value + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Día: + + + Textbox3 + 1.50847in + 2.61332in + 0.13889in + 1.23959in + 18 + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Meses de uso: + + + + =Parameters!MesesUso.Value + + + - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Mes: - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Defecto: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - %Ajuste: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Meses de uso: - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información Acumulador + + + Textbox3 + 1.50847in + 1.55432in + 0.13889in + 1.059in + 19 + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Información Acumulador + + + - - + + + Textbox2 + 1.64736in + 0.43625in + 0.17014in + 3.4167in + 20 + + Silver + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 2.65498in - 0.43624in - 0.22917in - 7.52083in - 20 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Tipo: + + + true + true + + + + + Tipo: + + + + =Parameters!Tipo.Value + + + - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Etiqueta: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Marca: - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CodEnsamble.Value - + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.09248in - 0.43623in - 0.20833in - 2.17711in - 24 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CodInspeccion.Value + + + true + true + + + + + Etiqueta: + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.09248in - 5.06124in - 0.20833in - 2.89582in - 25 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CodLinea.Value + + + true + true + + + + + Marca: + + + + =Parameters!Marca.Value + + + + + + + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.09248in - 2.61334in - 0.20833in - 2.4479in - 26 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Ensamble (primeros 7 dígitos) + + + true + true + + + + + =Parameters!CodEnsamble.Value + + + - - + + + Textbox3 + 1.95639in + 0.43623in + 0.13889in + 1.00004in + 24 + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.30081in - 0.43623in - 0.20833in - 2.17711in - 27 - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Inspección (4 dígitos) + + + true + true + + + + + =Parameters!CodInspeccion.Value + + + - - + + + Textbox3 + 1.95639in + 2.61332in + 0.13889in + 1.23961in + 25 + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.30081in - 5.06124in - 0.20833in - 2.89582in - 28 - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Linea (4 dígitos) + + + true + true + + + + + =Parameters!CodLinea.Value + + + - - + + + Textbox3 + 1.95639in + 1.43627in + 0.125in + 1.17707in + 26 + + 2pt + 2pt + 2pt + 2pt - - - Textbox3 - 3.30081in - 2.61334in - 0.20833in - 2.4479in - 29 - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información del Consumidor + + + true + true + + + + + Ensamble (primeros 7 dígitos) + + + - - + + + Textbox3 + 2.09528in + 0.43623in + 0.125in + 1.39934in + 27 + + + + + + + + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 3.50914in - 0.43625in - 0.28125in - 7.52083in - 30 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información Vehículo + + + true + true + + + + + Inspección (4 dígitos) + + + - - + + + Textbox3 + 2.09528in + 2.81123in + 0.125in + 1.04174in + 28 + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 3.7904in - 0.43625in - 0.22917in - 7.52083in - 31 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Marca: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Tipo: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Año: - - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Información Consumidor + + + true + true + + + + + Linea (4 dígitos) + + + - - + + + Textbox3 + 2.09528in + 1.83557in + 0.125in + 0.97566in + 29 + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt - - - Textbox2 - 4.2279in - 0.43623in - 0.22917in - 7.52083in - 35 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Nombre del consumidor: - - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Dirección: - - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Ciudad, Estado: - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Tel. - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - - - - - - - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Por medio de la presente acepto de conformidad el ajuste o garantía según información arriba mencionada. + + + true + true + + + + + Información del Consumidor + + + - - - - - 2pt - 2pt - 2pt - 2pt - - - - 5.97792in - 0.70708in - 0in - 3.03125in - 42 - - - - - - 5.97792in - 4.44667in - 0in - 3.13542in - 43 - - - - - - true - true - - - - - Fecha - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Firma del Consumidor - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Fecha.Value - - - + + + Textbox2 + 2.22028in + 0.43627in + 0.17014in + 3.41668in + 30 + + 2pt + 2pt + 2pt + 2pt - - - Textbox46 - 5.70014in - 0.70708in - 0.25in - 3.03125in - 46 - - - 2pt - 2pt - 2pt - 2pt - - - - 6.57167in - - - - =Today - - - - - - - - + + + + + + Textbox2 + 2.39042in + 0.43627in + 0.17014in + 3.41668in + 31 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Marca: + + + + =Parameters!MarcaAuto.Value + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo: + + + + =Parameters!TipoAuto.Value + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Año: + + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Información Consumidor + + + + + + + Textbox2 + 2.69945in + 0.4362in + 0.17014in + 3.4167in + 35 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre del consumidor: + + + + =Parameters!NombreCliente.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Dirección: + + + + =Parameters!Direccion.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Ciudad, Estado: + + + + =Parameters!CiudadEstado.Value + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tel. + + + + =Parameters!TelCliente.Value + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Por medio de la presente acepto de conformidad el ajuste o garantía según información arriba mencionada. + + + + + + 2pt + 2pt + 2pt + 2pt + + + + 4.16824in + 0.70712in + 0in + 1.26042in + 42 + + + + + + 4.16824in + 2.29046in + 0in + 1.25567in + 43 + + + + + + true + true + + + + + Fecha + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Firma del Consumidor + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox46 + 3.98421in + 0.70712in + 0.15625in + 1.26042in + 46 + + + 2pt + 2pt + 2pt + 2pt + + + + 4.48893in + + + + =FormatDateTime(Today, DateFormat.ShortDate) + + + + + + + + + + - 2pt - 2pt - 2pt - 2pt - - - - - - - 1pt - 1pt - 1pt - 1pt - - + Gray 2pt 2pt @@ -122,25 +120,28 @@ - 5.26966cm + 4.91744cm - 3.98929cm + 4.73895cm 2.5cm - 3.6966cm + 3.44027cm - 2.91394cm + 2.14434cm + + + 1.01833cm 1.25645cm - 2.23542cm + 1.70625cm @@ -158,7 +159,7 @@ =Fields!RazonSocial.Value @@ -192,7 +193,7 @@ =Fields!Descripcion.Value @@ -225,7 +226,7 @@ =Fields!SubProyecto.Value @@ -258,7 +259,7 @@ =Fields!Nombre.Value @@ -292,7 +293,7 @@ =Fields!ImporteSol.Value @@ -316,6 +317,39 @@ + + + + true + true + + + + + =Fields!Abreviatura.Value + + + + + + + Abreviatura + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -327,7 +361,7 @@ =Fields!FolioMov.Value @@ -360,7 +394,7 @@ =Fields!Importe.Value @@ -439,7 +473,7 @@ - Descripcion + Descripción + + + + + + Textbox20 + + + Gray + 2pt + 2pt + 2pt + 2pt + + + + + 0.46771cm @@ -686,7 +759,7 @@ =Fields!Folio.Value @@ -717,7 +790,7 @@ 0.82931cm 0.06614cm 0.93542cm - 23.28539cm + 23.14606cm @@ -764,7 +837,7 @@ 0.79506in + + + + + + +
  • + Imprimir +
  • +
    + + + + + + +
    +
    +
    +
    + +
    + +
    + + +
    + + + +
    + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    + +
    +
    + + + + + + + + +
    +
    +
    + + Acumulados nómina +
    + +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + + + + + + + + + Nombre + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + + + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + + + diff --git a/Nomina/ReportedeAcumulados.aspx.cs b/Nomina/ReportedeAcumulados.aspx.cs new file mode 100644 index 000000000..e38e94e74 --- /dev/null +++ b/Nomina/ReportedeAcumulados.aspx.cs @@ -0,0 +1,730 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; + +public partial class Nomina_ReportedeAcumulados : ClsPaginas +{ + #region Propiedades + private int FilaConceptos + { + get { return 5; } + } + + private DataTable dtConceptos + { + get + { + if (ViewState["dtConceptos"] == null) { return null; } + else { return (DataTable)ViewState["dtConceptos"]; } + } + + set { ViewState["dtConceptos"] = value; } + } + + private DataTable dtempleados + { + get + { + if (ViewState["dtempleados"] == null) { return null; } + else { return (DataTable)ViewState["dtempleados"]; } + } + + set { ViewState["dtempleados"] = value; } + } + + protected int FiltCveProyecto + { + get + { + if (ViewState["FiltCveProyecto"] == null) { return 0; } + else { return ViewState["FiltCveProyecto"].ToString().ToEntero(); } + } + + set { ViewState["FiltCveProyecto"] = value; } + } + protected int FiltCveSubProyecto + { + get + { + if (ViewState["FiltCveSubProyecto"] == null) { return 0; } + else { return ViewState["FiltCveSubProyecto"].ToString().ToEntero(); } + } + + set { ViewState["FiltCveSubProyecto"] = value; } + } + protected int FiltCveTurno + { + get + { + if (ViewState["FiltCveTurno"] == null) { return 0; } + else { return ViewState["FiltCveTurno"].ToString().ToEntero(); } + } + + set { ViewState["FiltCveTurno"] = value; } + } + protected int FiltCvePeriodoI + { + get + { + if (ViewState["FiltCvePeriodoI"] == null) { return 0; } + else { return ViewState["FiltCvePeriodoI"].ToString().ToEntero(); } + } + + set { ViewState["FiltCvePeriodoI"] = value; } + } + protected int FiltCvePeriodoF + { + get + { + if (ViewState["FiltCvePeriodoF"] == null) { return 0; } + else { return ViewState["FiltCvePeriodoF"].ToString().ToEntero(); } + } + + set { ViewState["FiltCvePeriodoF"] = value; } + } + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + cargaEjercicios(); + CargaTiposPeriodo(); + CargarCentrosDeCosto(DdlProyecto,null,LblProyecto,LblSubProyeccto,"");//DdlSubProyecto + divddlproyeto.Visible = DdlProyecto.Visible; + //CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing) + } + } + + protected void LnkConsultar_Click(object sender, EventArgs e) + { + FiltCveProyecto = DdlProyecto.SelectedValue.ToEntero(); + FiltCveSubProyecto = -1; + FiltCveTurno = DdlTurno.SelectedValue.ToEntero(); + FiltCvePeriodoI = TxtPeriodoInicio.Text.ToEntero(); + FiltCvePeriodoF = TxtPeriodoFin.Text.ToEntero(); + cargaDatos(); + } + + private void cargaEjercicios() + { + int EjercicioActual = UsuarioActual.Empresa.EjercicioActual; + if (EjercicioActual == 0) + { + EjercicioActual = DateTime.Now.Year; + } + DataTable dtejercicio = null; + using (ClsNominas objnom = new ClsNominas()) + { + if (objnom.GetEjercicios(UsuarioActual.CveEmpresa)) + { + dtejercicio = objnom.DtResultados; + } + } + DdlEjercicios.DataSource = dtejercicio; + DdlEjercicios.DataBind(); + ListItem litem = null; + if ((dtejercicio != null) && dtejercicio.Rows.Count > 0) + { + if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", EjercicioActual)) == 0) + { + litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString()); + DdlEjercicios.Items.Insert(0, litem); + } + if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", (EjercicioActual - 1))) == 0) + { + litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString()); + DdlEjercicios.Items.Insert(1, litem); + } + } + else + { + litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString()); + DdlEjercicios.Items.Insert(0, litem); + litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString()); + DdlEjercicios.Items.Insert(0, litem); + + } + if (DdlEjercicios.Items.Count > 0) + { + DdlEjercicios.SelectedIndex = 0; + } + DdlEjercicios.SelectedValueExist(DateTime.Now.Year.ToString()); + } + private void CargaTiposPeriodo() + { + DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo.FiltraParametros("Estatus = 'Activo'"); + DdlTipoPeriodo.DataBind(); + DdlTipoPeriodo.Items.Insert(0, new ListItem("Seleccione", "-1")); + if (DdlTipoPeriodo.Items.Count > 0) + { + DdlTipoPeriodo.SelectedIndex = 0; + } + } + + + + public void cargaDatos() + { + int CveEmpresa = UsuarioActual.CveEmpresa; + int Ejercicio = DdlEjercicios.SelectedValue.ToEntero(); + bool continuar = false; + dtempleados = null; + dtConceptos = null; + DataTable dtPeriodo = new DataTable(); + DataTable dtasistencia = new DataTable(); + + + using (ClsNominas objnom = new ClsNominas()) + { + if (objnom.GetNominaAcumulado(Ejercicio, FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodoI, FiltCvePeriodoF, CveEmpresa, DdlRegimenContratacion.SelectedValue.ToEntero()) && objnom.DTSetResultados.Tables.Count > 1) + { + dtempleados = objnom.DTSetResultados.Tables[1]; + dtConceptos = objnom.DTSetResultados.Tables[0]; + continuar = true; + } + + } + + #region CargaGrid + if (continuar) + { + + string ctipo = "P"; + + int CurrentColumn = 2; + BoundField bf; + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ").Rows) + { + int CveConcepto = row["CveConcepto"].ToString().ToEntero(); + int SoloVisible = row["SoloVisible"].ToString().ToEntero(); + string Concepto = row["Concepto"].ToString(); + GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + if (SoloVisible == 1) + { + + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible "; + } + GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0); + bf = (BoundField)GvNominas.Columns[CurrentColumn]; + bf.DataField = string.Format("V_{0}", CveConcepto); + bf.HeaderText = Concepto; + if (GvNominas.Columns[CurrentColumn].Visible) + { + CurrentColumn++; + } + } + if (true) + { + BoundField field = (BoundField)GvNominas.Columns[CurrentColumn]; + + field.HeaderText = "Percepciones"; + field.DataField = "SumaPercepciones"; + field.ItemStyle.BackColor = System.Drawing.Color.LightGray; + GvNominas.Columns[CurrentColumn].Visible = true; + CurrentColumn++; + } + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ").Rows) + { + int CveConcepto = row["CveConcepto"].ToString().ToEntero(); + int SoloVisible = row["SoloVisible"].ToString().ToEntero(); + string Concepto = row["Concepto"].ToString(); + GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + if (SoloVisible == 1) + { + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible "; + } + GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0); + bf = (BoundField)GvNominas.Columns[CurrentColumn]; + bf.DataField = string.Format("V_{0}", CveConcepto); + bf.HeaderText = Concepto; + if (GvNominas.Columns[CurrentColumn].Visible) + { + CurrentColumn++; + } + } + + if (true) + { + BoundField field = (BoundField)GvNominas.Columns[CurrentColumn]; + field.HeaderText = "Deducciones"; + field.DataField = "SumaDeducciones"; + field.ItemStyle.BackColor = System.Drawing.Color.LightGray; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].Visible = true; + CurrentColumn++; + + field = (BoundField)GvNominas.Columns[CurrentColumn]; + field.HeaderText = "Total"; + field.DataField = "Total"; + field.ItemStyle.BackColor = System.Drawing.Color.DarkGray; + field.ItemStyle.CssClass = "TotalWhite"; + field.HeaderStyle.CssClass = "TotalWhite"; + + GvNominas.Columns[CurrentColumn].Visible = true; + CurrentColumn++; + } + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ").Rows) + { + int CveConcepto = row["CveConcepto"].ToString().ToEntero(); + int SoloVisible = row["SoloVisible"].ToString().ToEntero(); + string Concepto = row["Concepto"].ToString(); + GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + if (SoloVisible == 1) + { + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible "; + } + GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0); + bf = (BoundField)GvNominas.Columns[CurrentColumn]; + bf.DataField = string.Format("V_{0}", CveConcepto); + bf.HeaderText = Concepto; + + if (GvNominas.Columns[CurrentColumn].Visible) + { + CurrentColumn++; + } + } + if (true) + { + BoundField field = (BoundField)GvNominas.Columns[CurrentColumn]; + field.HeaderText = "Obligaciones"; + field.DataField = "SumaObligaciones"; + field.ItemStyle.BackColor = System.Drawing.Color.LightGray; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].Visible = true; + CurrentColumn++; + } + for (int i = CurrentColumn; i < 102; i++) + { + bf = (BoundField)GvNominas.Columns[i]; + bf.DataField = ""; + bf.HeaderText = ""; + GvNominas.Columns[i].ItemStyle.BackColor = System.Drawing.Color.Transparent; + GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " "; + GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " "; + GvNominas.Columns[i].Visible = false; + + } + bool tr = false; + setGVNominas(); + } + else + { + + GvNominas.DataSource = null; + GvNominas.DataBind(); + } + #endregion + UpDatos.Update(); + } + + private void setGVNominas() + { + string filtrogrupo = ""; + DataTable dt = dtempleados.Copy(); + if (DdlAgrupadorB.SelectedValue == "1") + { + foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveSubProyecto", "SubProyecto" }).Rows) + { + DataRow dr = dt.NewRow(); + filtrogrupo = (drow["CveSubProyecto"] == DBNull.Value ? "CveSubProyecto IS NULL AND CvePersonal>0 " : string.Format("CveSubProyecto = {0} AND CvePersonal>0", drow["CveSubProyecto"])); + foreach (DataRow row in dtConceptos.FiltraParametros("EsPadre = 1 ").Rows) + { + int CveConcepto = row["CveConcepto"].ToString().ToEntero(); + dr[string.Format("V_{0}", CveConcepto)] = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), filtrogrupo); + } + dr["CveSubProyecto"] = drow["CveSubProyecto"]; + dr["SubProyecto"] = drow["SubProyecto"]; + dr["SumaPercepciones"] = dtempleados.SUM("SumaPercepciones", filtrogrupo); + dr["SumaDeducciones"] = dtempleados.SUM("SumaDeducciones", filtrogrupo); + dr["Total"] = dtempleados.SUM("Total", filtrogrupo); + dr["SumaObligaciones"] = dtempleados.SUM("SumaObligaciones", filtrogrupo); + + dt.Rows.Add(dr); + } + dt.AcceptChanges(); + dt = dt.FiltraParametros("", "CveSubProyecto,SubProyecto,Codigo,Nombre"); + } + if (DdlAgrupadorB.SelectedValue == "2") + { + + foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveDepartamento", "Departamento" }).Rows) + { + DataRow dr = dt.NewRow(); + filtrogrupo = (drow["CveDepartamento"] == DBNull.Value ? "CveDepartamento IS NULL AND CvePersonal>0 " : string.Format("CveDepartamento = {0} AND CvePersonal>0", drow["CveDepartamento"])); + foreach (DataRow row in dtConceptos.FiltraParametros("EsPadre = 1 ").Rows) + { + int CveConcepto = row["CveConcepto"].ToString().ToEntero(); + dr[string.Format("V_{0}", CveConcepto)] = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), filtrogrupo); + } + dr["CveDepartamento"] = drow["CveDepartamento"]; + dr["Departamento"] = drow["Departamento"]; + dr["SumaPercepciones"] = dtempleados.SUM("SumaPercepciones", filtrogrupo); + dr["SumaDeducciones"] = dtempleados.SUM("SumaDeducciones", filtrogrupo); + dr["Total"] = dtempleados.SUM("Total", filtrogrupo); + dr["SumaObligaciones"] = dtempleados.SUM("SumaObligaciones", filtrogrupo); + + dt.Rows.Add(dr); + } + dt.AcceptChanges(); + dt = dt.FiltraParametros("", "CveDepartamento,Departamento,Codigo,Nombre"); + } + GvNominas.DataSource = dt; + GvNominas.DataBind(); + } + + + protected void LnkFormatoTabular_Click(object sender, EventArgs e) + { + FiltCveProyecto = DdlProyecto.SelectedValue.ToEntero(); + FiltCveSubProyecto = -1; + FiltCveTurno = DdlTurno.SelectedValue.ToEntero(); + FiltCvePeriodoI = TxtPeriodoInicio.Text.ToEntero(); + FiltCvePeriodoF = TxtPeriodoFin.Text.ToEntero(); + cargaDatos(); + if (dtempleados.Rows.Count > 0) + { + + try + { + ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); + var libro = wb.AddWorksheet("Nomina"); + int column = 1; + libro.Cell(1, column).Value = " "; + libro.Cell(2, column).Value = "Codigo"; + libro.Cell(3, column).Value = " "; + column++; + libro.Cell(1, column).Value = " "; + libro.Cell(2, column).Value = "Empleado"; + libro.Cell(3, column).Value = " "; + libro.Column(column).Width = 35; + + int iniciotipe = column; + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo ='P' AND EsPadre = 1 ").Rows) + { + + column++; + libro.Cell(2, column).Value = row["Concepto"].ToString(); + libro.Cell(3, column).Value = row["Codigo"].ToString(); + libro.Column(column).Width = 15; + if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0)) + { + libro.Column(column).Hide(); + } + + } + column++; + libro.Range(2, column, 3, column).Merge().Value = "Percepciones"; + libro.Column(column).Width = 15; + if (iniciotipe < column) + { + libro.Range(1, iniciotipe + 1, 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center; + libro.Range(1, iniciotipe + 1, 1, column).Merge().Value = "Percepciones"; + } + iniciotipe = column; + + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows) + { + column++; + libro.Cell(2, column).Value = row["Concepto"].ToString(); + libro.Cell(3, column).Value = row["Codigo"].ToString(); + libro.Column(column).Width = 15; + if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0)) + { + libro.Column(column).Hide(); + } + + } + + column++; + libro.Range(2, column, 3, column).Merge().Value = "Deducciones"; + libro.Column(column).Width = 15; + + if (iniciotipe < column) + { + libro.Range(1, iniciotipe + 1, 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center; + libro.Range(1, iniciotipe + 1, 1, column).Merge().Value = "Deducciones"; + } + + column++; + libro.Cell(1, column).Value = " "; + libro.Range(2, column, 3, column).Merge().Value = "Total"; + libro.Column(column).Width = 15; + iniciotipe = column; + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows) + { + column++; + libro.Cell(2, column).Value = row["Concepto"].ToString(); + libro.Cell(3, column).Value = row["Codigo"].ToString(); + libro.Column(column).Width = 15; + if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0)) + { + libro.Column(column).Hide(); + } + + } + column++; + libro.Range(2, column, 3, column).Merge().Value = "Obligaciones"; + libro.Column(column).Width = 15; + + + if (iniciotipe < column) + { + libro.Range(1, iniciotipe + 1, 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center; + libro.Range(1, iniciotipe + 1, 1, column).Merge().Value = "Obligaciones"; + } + + libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + libro.Row(2).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + libro.Row(3).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(177, 160, 199)); + libro.Row(2).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + libro.Row(3).Cell(1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + libro.Row(3).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + + int Fila = 3; + int cveSupProyecto = -5; + string subproyecto = ""; + string subproyectoold = ""; + int oldcveSupProyecto = -5; + bool newsubproyecto = false; + bool newsubproyectoTitulo = false; + foreach (DataRow erow in dtempleados.FiltraParametros("", "CveSubProyecto").Rows) + { + Fila++; + newsubproyecto = false; newsubproyectoTitulo = false; + if (cveSupProyecto != erow["CveSubProyecto"].ToString().ToEntero()) + { + + if (oldcveSupProyecto != -5) { Fila += 2; newsubproyecto = true; } + oldcveSupProyecto = cveSupProyecto; + cveSupProyecto = erow["CveSubProyecto"].ToString().ToEntero(); + subproyecto = erow["SubProyecto"].ToString(); + if (cveSupProyecto != -5 && oldcveSupProyecto != -5) { Fila++; newsubproyectoTitulo = true; } + } + column = 1; + libro.Cell(Fila, column).Value = string.Format("'{0}",erow["Codigo"]); + column++; + if (newsubproyecto) { libro.Cell(Fila - 3, column).Value = string.Format("Total {0}", subproyectoold); } + if (newsubproyectoTitulo) { libro.Cell(Fila - 1, column).Value = subproyecto; subproyectoold = subproyecto; } + libro.Cell(Fila, column).Value = erow["Nombre"]; + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ").Rows) + { + column++; + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + libro.Cell(Fila, column).Value = erow[Concepto]; + + + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + } + + column++; + libro.Cell(Fila, column).Value = erow["SumaPercepciones"]; + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaPercepciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows) + { + column++; + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + libro.Cell(Fila, column).Value = erow[Concepto]; + + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + } + + column++; + libro.Cell(Fila, column).Value = erow["SumaDeducciones"]; + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaDeducciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + column++; + libro.Cell(Fila, column).Value = erow["Total"]; + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("Total", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows) + { + column++; + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + libro.Cell(Fila, column).Value = erow[Concepto]; + + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + } + + column++; + libro.Cell(Fila, column).Value = erow["SumaObligaciones"]; + if (newsubproyecto) + { + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaObligaciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + if (newsubproyectoTitulo) { libro.Range(Fila - 1, 1, Fila - 1, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228)); } + if (newsubproyecto) + { + libro.Range(Fila - 3, 1, Fila - 3, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228)); + libro.Range(Fila - 3, 3, Fila - 3, column).Style.NumberFormat.Format = "$###,###,##0.00"; + libro.Range(Fila - 3, 3, Fila - 3, column).DataType = ClosedXML.Excel.XLDataType.Number; + } + libro.Range(Fila , 3, Fila , column).Style.NumberFormat.Format = "$###,###,##0.00"; + libro.Range(Fila, 3, Fila, column).DataType = ClosedXML.Excel.XLDataType.Number; + + } + + if (true) + { + + Fila++; + oldcveSupProyecto = cveSupProyecto; newsubproyecto = true; + column = 1; + column++; + libro.Cell(Fila - 3, column).Value = string.Format("Total {0}", subproyectoold); + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ").Rows) + { + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + + } + + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaPercepciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows) + { + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaDeducciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("Total", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + + foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows) + { + string Concepto = string.Format("V_{0}", row["CveConcepto"]); + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + } + + column++; + libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaObligaciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto)); + + libro.Range(Fila - 3, 1, Fila - 3, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228)); + libro.Range(Fila - 3, 3, Fila - 3, column).Style.NumberFormat.Format = "$###,###,##0.00"; + libro.Range(Fila - 3, 3, Fila - 3, column).DataType = ClosedXML.Excel.XLDataType.Number; + + libro.Range(Fila, 3, Fila, column).Style.NumberFormat.Format = "$###,###,##0.00"; + libro.Range(Fila, 3, Fila, column).DataType = ClosedXML.Excel.XLDataType.Number; + } + libro.Range(4, 1, 4, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + + + System.IO.Stream fs = new System.IO.MemoryStream(); + wb.SaveAs(fs); + fs.Position = 0; + System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); + using (System.IO.Stream input = fs) + + { + input.CopyTo(memoryStream); + } + memoryStream.Position = 0; + + Response.Clear(); + Response.Buffer = true; + + Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "Acumulados nomina")); + Response.BinaryWrite(memoryStream.ToArray()); + Response.End(); + } + catch (Exception ex) + { + Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString()); + } + } + else + { + Alert("No se encontraron resultados con los filtros seleccionaddos"); + } + } + + protected void GvNominas_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + Literal LtlNombre = e.Row.FCLiteral("LtlNombre"); + int cvePersonal = e.Row.DataKey("CvePersonal").ToEntero(); + string Nombre = e.Row.DataKey("Nombre").ToString(); + string Codigo = e.Row.DataKey("Codigo").ToString(); + string Turno = e.Row.DataKey("Turno").ToString(); + string Departamento = e.Row.DataKey("Departamento").ToString(); + string SubProyecto = e.Row.DataKey("SubProyecto").ToString(); + if (cvePersonal > 0) + { + LtlNombre.Text = String.Format("{2} {1}", cvePersonal, Nombre, Codigo); + + } + else + { + LtlNombre.Text = "Total General"; + if (Turno.Length == 0 && SubProyecto.Length > 0) + { + LtlNombre.Text = String.Format("Centro de costos: {0}", SubProyecto); + } + else if (Turno.Length > 0) + { + LtlNombre.Text = String.Format("Turno: {0}", SubProyecto); + } + else if (Departamento.Length > 0) + { + LtlNombre.Text = String.Format("Departamento: {0}", Departamento); + } + else + { + + e.Row.CssClass = "SubTotales"; + } + + } + + } + + } +} \ No newline at end of file diff --git a/RH/ActualizacionMasiva.aspx.vb b/RH/ActualizacionMasiva.aspx.vb index 31b2083e0..800133704 100644 --- a/RH/ActualizacionMasiva.aspx.vb +++ b/RH/ActualizacionMasiva.aspx.vb @@ -387,9344 +387,3 @@ Partial Class RH_ActualizacionMasiva End If End Sub End Class - - - - - - - - - - - - - - - -Public Class TimbradoB - - - - Public Function TimbrarFactura(UsuarioActual As Usuario, Ventas As Modelos.Factura, Optional CvePACEspecial As Integer = -1) As Boolean - - Dim Retorno As Boolean = False - Dim tCvePAC As Integer = UsuarioActual.Empresa.CvePAC - If CvePACEspecial <> -1 Then tCvePAC = CvePACEspecial - Dim objs As ADSTimbrado.TimbradoEmpresa - Dim result = ADSTimbrado.Timbrado.TimbrarFactura(Ventas, objs, ADSTimbrado.PacTimbrado.PADEv) - Retorno = result.isOK - If result.isOK Then - Else - - End If - - - Return Retorno - End Function -End Class - -'Public Class TimbradoEmpresa -' Inherits ADSTimbradoLibrary.TimbradoEmpresa - -' Public Overrides Function UpdateEstatusFactura(FolioFiscal As String, ObjCFDITimbre As ADSTimbradoLibrary.CFDITimbre, facturaCFDI As ADSTimbradoLibrary.Factura, CvePAC As Integer) As String -' Throw New NotImplementedException() -' End Function - -' Public Overrides Function Timbre() As String -' Throw New NotImplementedException() -' End Function -'End Class - - -Namespace Modelos - - Public Class Facturaz - Implements ADSTimbrado.Factura - - End Class - Public Enum TipoMensajeRespuesta - TextoLimpio = 0 - HTML = 1 - End Enum - - Public Class Factura - Inherits Modelos.EntityModel - Implements IDisposable, ADSTimbrado.Factura - Public ReadOnly Property UrlSitio As String - Get - If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UrlSitio")) Then - Return "" - Else - Return System.Configuration.ConfigurationManager.AppSettings("UrlSitio").ToString() - End If - End Get - End Property - Public Property UsuarioActual As Usuario - Public Property ListaMensajes As List(Of String) - Public Property TipoMensajeRespuesta As TipoMensajeRespuesta = TipoMensajeRespuesta.HTML - Public Sub New() - Timbre = New CFDITimbre - IniciaValores() - End Sub - - Public Sub New(ObjsClsPaginas As ClsPaginas, Optional Row As Data.DataRow = Nothing) - If Row IsNot Nothing Then - setValues(Row) - Else - IniciaValores() - End If - SetMetodoPago(ObjsClsPaginas) - Timbre = New CFDITimbre - DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas - End Sub - - Public Sub New(ObjsClsPaginas As ClsPaginas, CveVenta As Integer, CveEmpresa As Integer) - Me.CveEmpresa = CveEmpresa - Dim ObjVentas As New ClsVentas() - If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then - If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - setValues(ObjVentas.DtResultados.Rows(0)) - SetMetodoPago(ObjsClsPaginas) - SetMoneda(ObjsClsPaginas) - End If - End If - ObjVentas.Dispose() - DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas - End Sub - Public Sub New(ObjsClsPaginas As ClsPaginas, UsuarioActual As Usuario, Optional Row As Data.DataRow = Nothing) - Me.UsuarioActual = UsuarioActual - Me.ErrorList = New List(Of String) - Me.RemisionesLista = New List(Of Integer) - Me.ListaMensajes = New List(Of String) - If Row IsNot Nothing Then - setValues(Row) - Else - IniciaValores() - End If - SetMetodoPago(ObjsClsPaginas) - SetMoneda(ObjsClsPaginas) - SetSubProyecto(ObjsClsPaginas) - SetSubProyectoMatriz(ObjsClsPaginas) - Timbre = New CFDITimbre - DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas - End Sub - Public Sub New(UsuarioActual As Usuario, Optional Row As Data.DataRow = Nothing) - Me.UsuarioActual = UsuarioActual - Me.ErrorList = New List(Of String) - Me.RemisionesLista = New List(Of Integer) - Me.ListaMensajes = New List(Of String) - If Row IsNot Nothing Then - setValues(Row) - Else - IniciaValores() - End If - Timbre = New CFDITimbre - End Sub - Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False) - Me.UsuarioActual = UsuarioActual - Me.CveVenta = CveVenta - Me.CveEmpresa = CveEmpresa - Me.ErrorList = New List(Of String) - Me.RemisionesLista = New List(Of Integer) - Me.ListaMensajes = New List(Of String) - Me.FolioFiscal = "" - Me.GenerarPDFFactura = False - IniciaValores() - Dim ObjVentas As New ClsVentas() - If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then - If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - setValues(ObjVentas.DtResultados.Rows(0)) - SetMetodoPago() - SetMoneda() - SetSubProyecto() - SetSubProyectoMatriz() - SetCliente() - End If - End If - If ObjVentas.GetVentaDetalle(CveVenta) Then - Me.DtDetalle = ObjVentas.DtResultados.Copy() - End If - ObjVentas.Dispose() - IniciaValoresVentas(EsCancelacion) - If String.IsNullOrEmpty(DirectorioServidor) Then - DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas - End If - Me.DirectorioServidor = DirectorioServidor - Timbre = New CFDITimbre - End Sub - Private Sub IniciaValores() - Me.FolioFiscal = "" - Me.CveContratoSecciones = "" - Me.Version = "3.3" - If UsuarioActual IsNot Nothing Then - Me.CveUsuario = UsuarioActual.CveUsuario - Me.CveEmpresa = UsuarioActual.CveEmpresa - Me.UsuarioCreo = UsuarioActual.Usuario - End If - Me.TipoCambio = 0 - Me.ConvertirPesos = False - Me.CveMoneda = 1 - Me.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda} ") - Me.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda} ") - Me.RefDocto = "" - Me.CveMesa = -1 - Me.Fecha = Now - Me.CvePrePoliza = -1 - Me.FechaPago = Now - Me.MotivoDescuento = "" - Me.Observaciones = "" - Me.FechaEjecucion = Now - Me.CveCondicionEntrega = -1 - Me.CondicionEntrega = "" - Me.NumeroCuenta = "" - Me.CondicionesPago = 0 - Me.FormaPago = 0 - Me.PedidoContrato = "" - Me.NumeroContrato = "" - Me.DescripcionContrato = "" - Me.CveCorte = -1 - Me.Alfa1 = "" - Me.Alfa2 = "" - Me.Alfa3 = "" - Me.Descuento = 0 - Me.Amortizacion = 0 - Me.CveContrato = 0 - Me.SubTotal = 0 - Me.Descuento = 0 - Me.Amortizacion = 0 - Me.IVA = IVA - Me.RetIVA = 0 - Me.RetISR = 0 - Me.IEPS = 0 - Me.CveAlmacenTraspasoOrigen = 0 - End Sub - Private Sub IniciaValoresVentas(Optional EsCancelacion As Boolean = False) - If CveVenta > 0 AndAlso CveEmpresa > 0 Then - Me.DtAnticipos = New DataTable() - Me.DtPagos = New DataTable() - Me.DtRemisiones = New DataTable() - Me.DtInventario = New DataTable() - Me.DtRemisionesPS = New DataTable() - Me.DtPedidos2 = New DataTable() - Me.DtPedidos2PS = New DataTable() - Me.DTOrdenesCompraPS = New DataTable() - Me.DtCotizacionesPS = New DataTable() - Me.DtDocumentacionCliente = New DataTable() - Me.DtContratosSerieDetalle = New DataTable() - Me.DtRemConceptosSurtidos = New DataTable() - Me.DtImpuestosLocales = New DataTable() - Me.DtOtrosConceptos = New DataTable() - Me.CveContratoSecciones = "" - - Dim ObjVentas As New ClsVentas - 'CARGA PROMOCIONES - If ObjVentas.GetPromocionesPS(-1, Me.Fecha, Me.CveSubProyecto, CveCliente, Me.CveVendedor, Me.CveEmpresa) Then - Me.DtPromociones = ObjVentas.DtResultados.Copy() - End If - - 'CARGA FIRMAS - If ObjVentas.GetVentasFirmas(CveVenta) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - Me.DtFirmas = ObjVentas.DtResultados.Copy() - End If - End If - - 'CARGA ANTICIPOS - If Not (CveRemision > 0 Or CveCotizacion > 0) Then - If TipoDocto.Contiene("Ing", "Ant", "Rem") Then - 'carga as notas de credito vinculadas - If ObjVentas.GetVentasAntNC(CveVenta, -1) Then - Me.DtAnticipos = ObjVentas.DtResultados.Copy() - End If - End If - - If TipoDocto.Contiene("Egs", "Dev", "Ant") Then - If ObjVentas.GetVentasAntNC(-1, CveVenta) Then - Me.DtNCVinculadas = ObjVentas.DtResultados.Copy() - End If - - If TipoDocto.Contiene("Ant") AndAlso EsCancelacion Then - Me.EsNCAmortizacion = True - End If - - If ObjVentas.GetVentasAntNC(-1, CveVenta, AplicaAmortizacion:=EsNCAmortizacion) Then - Me.DtAnticipos = ObjVentas.DtResultados.Copy() - End If - - If (DtAnticipos Is Nothing OrElse DtAnticipos.Rows.Count = 0) Then - 'SI ES EGRESO Y TIENE ANTICIPOS VINCULADOS - If TipoDocto.Contiene("Egs") AndAlso EsNCAmortizacion AndAlso EsCancelacion Then - If ObjVentas.GetVentasAntNC(CveVenta, -1, AplicaAmortizacion:=EsNCAmortizacion) Then - Me.DtAnticipos = ObjVentas.DtResultados.Copy() - End If - End If - End If - End If - - End If - - If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then - Me.DtOtrosConceptos = ObjVentas.DtResultados.Copy() - End If - - 'CARGA REMISIONES RELACIONADAS - If ObjVentas.GetRemisionesRelacionadas(CveVenta, TipoDocto) Then - Me.DtRemisionesDocumentosRelacionados = ObjVentas.DtResultados.Copy() - End If - - ObjVentas.Dispose() - - If Me.RealizarDevolucionAlmacen Then - Me.CveAlmacenDevolucion = Me.CveAlmacenDevolucionVenta - End If - - End If - End Sub - Public Class MMensajeFactura - Sub New() - CveVenta = -1 - LigaCliente = "" - LigaPV = "" - LigaVenta = "" - LigaPDF = "" - SerieFolio = "" - Mensajes = New List(Of String) - TieneError = True - End Sub - Public Property Mensajes As New List(Of String) - Public Property TieneError As Boolean - Public Property CveVenta As Integer - Public Property LigaCliente As String - Public Property LigaPV As String - Public Property LigaVenta As String - Public Property LigaCRM As String - Public Property LigaPDF As String - Public Property SerieFolio As String - Public Property SeTimbro As Boolean - Public Property SeTimbroNotaCredito As Boolean - Public Property CveEstatus As Integer - Public Property CveMovimientoUsado As Integer - Public Property FolioUsado As String - - End Class - Public Function RegenerarPrePolizas(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional ObjACTransac As ClsContPAQi = Nothing) As Boolean - Dim ErrorPrePolizas As Boolean = False - - Dim ObjVentas As ClsVentas = Nothing - If TransaccionCompartida IsNot Nothing Then - ObjVentas = New ClsVentas(TransaccionCompartida) - Else - ObjVentas = New ClsVentas() - ObjVentas.IniciaTransacSQL() - End If - - Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) - Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) - Dim ObjAC As ClsContPAQi = Nothing - - If ObjACTransac Is Nothing Then - If UsuarioActual.Empresa.UsaAC Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - End If - Else - ObjAC = ObjACTransac - End If - - ErrorPrePolizas = Not RegeneracionPolizas(Me, ObjVentas, ObjAC, ObjConta, ObjBancos, ObjEventos) - - If TransaccionCompartida Is Nothing Then - ObjVentas.Commit() - ObjVentas.Dispose() - ObjBancos.Dispose() - ObjEventos.Dispose() - End If - - If ObjACTransac Is Nothing Then - If ObjAC IsNot Nothing Then - ObjAC.Commit() - ObjAC.Dispose() - End If - End If - - Return Not ErrorPrePolizas - End Function - Private Function RegeneracionPolizas(ObjFactura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos, ObjEventos As ClsOIEventos) As Boolean - Dim ErrorPrePolizas As Boolean = False - - 'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA - ErrorPrePolizas = Not ObjConta.RemovePrePolizasDetalle(ObjFactura.CvePrePoliza, -1, ObjFactura.CveVenta, 2) - - 'VUELVE A GENERAR LAS PREPOLIZAS - If Not ErrorPrePolizas Then - ErrorPrePolizas = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, ValorMultiplicador:=1, ObjBancos:=ObjBancos, ObjVentas:=ObjVentas, ObjEventos:=ObjEventos, DtRemisionesRelacionadas:=New DataTable, SeCancelaRemisionProceso:=False, - CancelarRemisiones:=False, ListaRemisionesCancelar:=New List(Of Integer)) - End If - - If Not ErrorPrePolizas Then ErrorPrePolizas = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, 1) - - Return Not ErrorPrePolizas - End Function - Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura - Dim Retorno As New MMensajeFactura() - - If Me.Version = "3.3" AndAlso Not Me.TipoDocto.Contiene("Ped", "PeC") Then - Dim dttsat As DataTable = DtDetalle.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ") - If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then - Dim str As New StringBuilder - str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT

    ") - For Each drt As DataRow In dttsat.Rows - str.AppendFormat("{0}
    ", drt("CodigoPS")) - Next - ErrorList.Add(str.ToString) - dttsat.Dispose() - Retorno.Mensajes = ErrorList - Return Retorno - End If - dttsat.Dispose() - End If - - If Not Me.TipoDocto.Contiene("Ped", "Ant", "DPe") Then - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - If Me.SubTotal <= 0 Then - ErrorList.Add("Es necesario especificar el importe en los conceptos. Por favor rectifique y vuelva a intentar.") - Retorno.Mensajes = ErrorList - Return Retorno - End If - End If - End If - - 'VALIDA CUENTAS CONTABLES DE AC - If UsuarioActual.Empresa.UsaAC Then - If Me.Cliente.IdCtaContClientes <= 0 Then - ErrorList.Add("El Cliente no tiene registrado la cuenta contable") - Retorno.Mensajes = ErrorList - Return Retorno - End If - - If Me.SubTotal <= 0 Then - ErrorList.Add("Es necesario especificar el importe en los conceptos. Por favor rectifique y vuelva a intentar.") - Retorno.Mensajes = ErrorList - Return Retorno - End If - End If - - If Me.CveCliente > 0 Or Me.CveEmpresaCRM > 0 Then - If DtDetalle.Rows.Count > 0 Then - - Dim ObjVentas As ClsVentas = Nothing - If Transac IsNot Nothing Then - ObjVentas = New ClsVentas(Transac) - Else - ObjVentas = New ClsVentas() - ObjVentas.IniciaTransacSQL() - End If - - Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL()) - Dim ObjContr As New ClsContratos(ObjVentas.IniciaTransacSQL()) - Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL()) - Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) - Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL()) - Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) - Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) - Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL()) - Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) - Dim ObjContPaq As ClsContPAQi = Nothing - Dim MensajeAlert = New StringBuilder - - Try - 'CONTABILIDAD AUTOMATICA Y AC - If ObjContPaqTransac IsNot Nothing Then - ObjContPaq = ObjContPaqTransac - Else - If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) - End If - End If - - - 'GUARDA VENTA - Dim TieneAnticipo As Boolean = False - Dim CveAnticipoPadre As Integer = 0 ' vinculación con anticipo - Dim FolioFiscalRelacionado As String = "" - If DtAnticipos IsNot Nothing AndAlso DtAnticipos.Rows.Count > 0 Then - Dim actualindex As Integer = 0 - For Each row2 As DataRow In DtAnticipos.Rows - TieneAnticipo = True - CveAnticipoPadre = row2("CveVenta").ToString().ToEntero() - Me.CveVentaRelacion = CveAnticipoPadre 'relaciona al anticipo - Me.ImporteRelacion = row2("Importe").ToString().ToDecimal() - FolioFiscalRelacionado = row2("FolioFiscal").ToString() - Me.CveVentaPadre = row2("CveVenta").ToString().ToEntero() - actualindex = actualindex + 1 - Next - End If - - GuardarVenta(Me, ObjVentas, ObjConta, ObjInventario, ObjContr, DtDetalle, Me.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, ObjAcum:=ObjAcum, Resp:=Retorno) - - 'SI ES REFACTURACION - Dim ObjNC As List(Of Object) = Nothing - If ErrorList.Count = 0 Then - If NuevaFactura = 1 AndAlso FacturaDevolucion IsNot Nothing Then - - ObjNC = GeneraNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, FacturaDevolucion, ObjBancos, ObjEventos) - - If ObjNC Is Nothing Then - ErrorList.Add("No se pudo Cancelar la Factura") - End If - - 'Esquema viejo, evitamos que aparezca por surtir - If ErrorList.Count = 0 Then - If Not ObjInventario.ActualizarEsDevolucionVenta(CveVenta, 2) Then - ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") - End If - End If - - End If - End If - - 'SI ES amortizacion 3.3 - Dim Obj2 As New List(Of Object) - - If ErrorList.Count = 0 Then - ' cambiar la condicion para saber si hay seleccionado - If TieneAnticipo AndAlso Me.CveTipoAmortizacionAnticipo = 2 Then - - If TieneAnticipo Then - Try - 'DESCOMENTAR - If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, FacturaDevolucion, ObjBancos, Nothing, Nothing) Then - Obj2.Add(FacturaDevolucion) - End If - Catch ex As Exception - ErrorList.Add("No se pudo generarse la nota de crédito de amortización") - End Try - - - End If - - If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then - ErrorList.Add("No se pudo generarse la nota de crédito de amortización") - End If - End If - End If - - 'MARCA PARA NO SURTIR VENTA DE COTNRATO DE CONSIGNACION DE VENTA | [IPP] : PARCHE - If ErrorList.Count = 0 Then - If Me.CveVenta > 0 And Me.CveAlmacenExistenciasContrato > 0 And Me.TipoDocto = "Ing" Then - If Not ObjInventario.ActualizarEsDevolucionVenta(Me.CveVenta, 2) Then - ErrorList.Add("No se pudo cancelar el movimiento de almacen de la Factura de consignación") - End If - End If - End If - - If ErrorList.Count = 0 Then - If Me.CveVenta > 0 And CveAlmacenExistenciasContrato > 0 And Me.TipoDocto = "Ing" Then - If Not RegistraAlmacenConsignacionVenta(ObjInventario) Then - ErrorList.Add("Ocurrió un error al registrar los movimientos de almacén del contrato de consignación") - End If - End If - End If - - If Me.CveVenta > 0 AndAlso ErrorList.Count = 0 Then - 'ACTUALIZA VENTA COTIZACIÓN - If EraCotizacion = 1 Then - If Not ObjVentas.UpdateVentaCotizacion(Me.CveVenta, Me.CveCotizacion) Then - ErrorList.Add("Ocurrió un error al actualizar la cotización") - End If - End If - - 'ACTUALIZA VENTAPADRE PEDIDO - If DevPed > 0 AndAlso ErrorList.Count = 0 Then - If Not ObjVentas.UpdateVentaCotizacion(DevPed, Me.CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar la devolución de pedido") - End If - End If - - 'ACTUALIZA LA COLUMNA CveVentaFacturada - If (CveRemision > 0) AndAlso ErrorList.Count = 0 Then - If Not ObjVentas.UpdateVentaRemision(CveRemision, Me.CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar la remision") - End If - End If - - 'Agregamos las OCs a la tabla - If DTOrdenesCompraPS IsNot Nothing AndAlso DTOrdenesCompraPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - Dim CveVentaDetalle As Integer = 0 - Dim CveOrdenCompraDetalle As Integer = 0 - Dim Cantidad As Decimal = 0 - - - For Each row As DataRow In DtDetalle.Rows - Cantidad = row("Cantidad").ToString.ToDecimal - CveVentaDetalle = row("CveVentaDetalle").ToString.ToEntero - CveOrdenCompraDetalle = row("CveOrdenCompraDetalle").ToString.ToEntero - If Not ObjVentas.AgregarVentaOCDetalle(CveVentaDetalle, CveOrdenCompraDetalle, Cantidad) Then - ErrorList.Add("Ocurrió un Error al agregar el detalle de la Remision") - End If - Next - - End If - - 'Agregamos las Cotizaciones a la tabla - If DtCotizacionesPS IsNot Nothing AndAlso DtCotizacionesPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - Dim CveVentaDetalle As Integer = 0 - Dim CveVentaDetallePadre As Integer = 0 - Dim Cantidad As Decimal = 0 - Dim CvePS As Integer = 0 - Dim PU As Decimal = 0 - - For Each row As DataRow In DtCotizacionesPS.Rows - Cantidad = DtDetalle.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToDecimal - CvePS = DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero - PU = DtDetalle.FiltroPrimeroValor("PU", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToDecimal - CveVentaDetalle = DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero - - If Not ObjVentas.AgregaCotizacionDetalle(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then - ErrorList.Add("Ocurrió un Error al agregar el detalle de la Cotización.") - End If - Next - End If - - - 'Marcamos las ventas anteriores a febrero como surtidas - Ajuste Compu - If ErrorList.Count = 0 Then - If Not ObjVentas.MarcarRemisionesSinSurtir(Me.CveVenta) Then - ErrorList.Add("Ocurrió un Error al marcar la factura") - End If - End If - - If Me.CveOS > 0 And FacturaMateriales = 1 AndAlso ErrorList.Count = 0 Then - If SalidaAlmacenMateriales(ObjInventario, CveOS, ObjConta, True, 3) Then - ErrorList.Add("Ocurrió un Error al dar salida de materiales de almacen") - End If - End If - - If Me.CveFactura > 0 AndAlso ErrorList.Count = 0 Then - If Not ObjVentas.UpdateVentaFacturas(Me.CveFactura, ObjVentas.CveVenta, UsuarioActual.CveEmpresa) Then - ErrorList.Add("No se pudo actualizar la Factura") - End If - End If - - If CveCicloComercial > 0 AndAlso ErrorList.Count = 0 Then - If Not ObjContr.CicloComercialUpdate(Me.CveCicloComercial, True, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then - ErrorList.Add("No se pudo actualizar ") - End If - End If - - If ErrorList.Count = 0 AndAlso Me.CveVenta > 0 AndAlso DtDocumentacionCliente IsNot Nothing Then - ' si se cargó algun documento - If DtDocumentacionCliente.FiltraParametros("RutaArchivo <> ''").Rows.Count > 0 Then - GuardaVentaDocumentosCliente(Me.CveVenta, ObjDocCliente) - End If - End If - - If Me.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or Me.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then - - If Transac Is Nothing Then - ObjVentas.Commit() - End If - If ObjContPaqTransac Is Nothing Then - If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() - End If - - Try - If Not String.IsNullOrEmpty(DirectorioServidor) Then - Dim DirectorioArchivoXML As String = System.IO.Path.Combine(UsuarioActual.Empresa.Ruta, "XML", Me.TipoDocto) - If Not Directory.Exists(DirectorioArchivoXML) Then - Directory.CreateDirectory(DirectorioArchivoXML) - End If - End If - - Dim SeTimbro As Boolean = False - Dim SeTimbroNC As Boolean = False - Dim EstatusSMS = 0 - - 'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO - If (TipoDoctoDevolucion = "" OrElse Not TipoDoctoDevolucion.Contiene("Rem", "Cot", "Ped", "DPe", "PA", "Pd2")) Then - - Dim DebeTimbrar As Boolean = Timbrar - If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then - 'si tiene anticipos seleccionados y el total es cero, que no se timbre(previo empresa72) - If Me.Amortizacion > 0 And Me.Total <= 0 Then - DebeTimbrar = False - End If - End If - - If Me.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then - If UsuarioActual.Empresa.TipoFacturacion = "CFDi" Then - - If Me.FemsaFactura IsNot Nothing Then - - 'FACTURA INGRESO/EGRESO - Dim ObjTimbrado As New Timbrado - 'DOCUMENTO ACTUAL - If DebeTimbrar Then - SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, Me) - - 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION - If Not IsNothing(Obj2) AndAlso Obj2.Count > 0 Then - Dim ofa As Modelos.Factura = CType(Obj2(0), Modelos.Factura) - 'asigna el foliofiscal del ingreso que se acaba de timbrar, cuando es amortización de anticipo con NC - If TieneAnticipo AndAlso CveTipoAmortizacionAnticipo = 2 Then - ofa.Timbre.CFDIRelacionados.UUID.Clear() - ofa.Timbre.CFDIRelacionados.UUID.Add(ObjTimbrado.UUID) - End If - ObjTimbrado.TimbrarFactura(UsuarioActual, ofa) - End If - - If SeTimbro AndAlso Me.TipoDocto.Contiene("Ing") Then - EstatusSMS = EnviarSMSTimbrado(ObjEventos) - End If - - If Not SeTimbro Then - ErrorList.Add(ObjTimbrado.MensajeErrorCFDI) - End If - - End If - - 'NOTA DE CREDITO DE REFACTURACION - If RefacturacionGeneroNC Then - If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 Then - Dim ofa As Modelos.Factura = CType(ObjNC(0), Modelos.Factura) - SeTimbroNC = ObjTimbrado.TimbrarFactura(UsuarioActual, ofa) - End If - End If - End If - End If - End If - End If - - 'VERIFICAR 100% AVANCE A IMPORTE Y CANTIDAD - If Me.TipoDocto.Contiene("Ing", "Ant") AndAlso CveContrato > 0 Then - If ObjContr.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then - - If ObjContr.DtResultados.Rows.Count > 0 Then - ' si es flexible que notifique el monto maximo, si no lo es que notifique el porcentaje alcanzado... flexible = 2, no flexible = 1 - Dim PorcentajeAvance As Double = ObjContr.DtResultados.Rows(0)("ContratoAvance").ToString.ToDouble - - If ObjContr.DtResultados.Rows(0)("ModalidadDetalle").ToString() = "1" Then - - If PorcentajeAvance >= 100 Then - EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString()) - End If - Else - Dim MontoMaximo As Double = ObjContr.DtResultados.Rows(0)("ImporteMax").ToString.ToDouble - - If PorcentajeAvance >= 100 And MontoMaximo > 0 Then - EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString(), MontoMaximo) - End If - End If - - End If - End If - End If - - 'MENSAJE PRINCIPAL - MensajeAlert.AppendFormat(String.Format("
    La {0}: {1} se generó correctamente.

    ", Me.TipoDocumento, Me.SerieFolio)) - - - ' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA - If SeTimbro Then - Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, Me.TipoDocto, Me.SerieFolio) - If File.Exists(ArchivoXML) Then - MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", Me.SerieFolio, Me.TipoDocto))) - End If - - End If - - 'DESCARGA PDF - If Me.TipoDocto.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Pd2") Then - 'If Not ImprimeAlert Then - - If Me.GenerarPDFFactura Then - DescargarFactura(CveVenta, CveEmpresa, False) - - Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta)) - Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta)) - Dim ArchivoRem As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta)) - Dim ArchivoEgs As New System.IO.FileInfo(String.Format("{0}Formatos/NotaCredito.rdlc", UsuarioActual.Empresa.Ruta)) - - If ArchivoIng.Exists Or ArchivoRem.Exists Or ArchivoIngPyMe.Exists Or ArchivoEgs.Exists Then - MensajeAlert.AppendFormat("
    ", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))) - Else - MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") - End If - End If - - End If - - 'ERROR DE NO TIMBRADO - If Not SeTimbro And (Me.TipoDocto = "Ing" Or Me.TipoDocto.Contiene("Egs", "Dev") Or Me.TipoDocto = "Ant") Then - MensajeAlert.AppendFormat("La factura no se pudo timbrar.
    Por favor intentelo de nuevo a traves del boton Emitir.") - End If - - 'ERROR DE NO TIMBRADO NC - If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 AndAlso Not SeTimbroNC Then - MensajeAlert.AppendFormat("
    La NC #{0} no se pudo timbrar.
    Por favor intentelo de nuevo a traves del boton Emitir.", CType(ObjNC(0), Modelos.Factura).SerieFolio) - End If - - 'NOTIFICACION DE SMS - Select Case EstatusSMS - Case 1 - MensajeAlert.AppendFormat("
    Notificación SMS: enviado con éxito al cliente al celular: {0}", Me.Cliente.CobranzaTelefono) - Case 2 - MensajeAlert.AppendFormat("
    Notificación SMS: sin enviar. Ocurrió un error en el envío, por favor verifique la información del cliente.") - Case 3 - MensajeAlert.AppendFormat("
    Notificación SMS: sin enviar. No se pudo cargar el celular del cliente, por favor verifique la información del cliente.") - End Select - - Retorno.LigaPDF = $"{UrlSitio}Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}" - - If Me.TipoDocto = "Cot" Then - - If Not CveEmpresaCRM > 0 Then - If Me.CveVenta > 0 Then MensajeAlert = New StringBuilder - Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta)) - - If ArchivoCotizacion.Exists Then - MensajeAlert.AppendFormat("
    ", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta))) - Else - MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") - End If - End If - - End If - - 'MOVIMIENTO DE ALMACEN - If Me.Inv_CveMovimiento > 0 Then - MensajeAlert.AppendFormat("

    Movimiento de Almacén
    ", Me.Inv_CveMovimiento) - End If - - If TieneAnticipo AndAlso CveTipoAmortizacionAnticipo = 2 Then - MensajeAlert.AppendFormat("

    Se generó una Nota de crédito Folio: {0} amortizando el anticipo
    ", FacturaDevolucion.Folio) - End If - - If TipoMensajeRespuesta = TipoMensajeRespuesta.HTML Then - ListaMensajes.Add(MensajeAlert.ToString) - Retorno.LigaCliente = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={Me.CveCliente}&Opt=3"";" - Retorno.LigaVenta = "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";" - Retorno.LigaPV = "document.location.href=""/Ventas/PV.aspx"";" - Retorno.LigaCRM = $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={Me.CveEmpresaCRM}"";" - ElseIf TipoMensajeRespuesta = TipoMensajeRespuesta.TextoLimpio Then - ListaMensajes.Add(String.Format("El {0} se generó correctamente", Me.TipoDocumento)) - Retorno.LigaCliente = $"{UrlSitio}Ventas/Clientes.aspx?CveCliente={Me.CveCliente}&Opt=3" - Retorno.LigaVenta = $"{UrlSitio}Ventas/Ventas.aspx?CveVenta={Me.CveVenta}" - Retorno.LigaCRM = $"{UrlSitio}CRM/EmpresaCRM.aspx?CveEmpresaCRM={Me.CveEmpresaCRM}" - End If - - Retorno.CveVenta = Me.CveVenta - Retorno.SerieFolio = Me.SerieFolio - Retorno.SeTimbro = SeTimbro - Retorno.SeTimbroNotaCredito = SeTimbroNC - Retorno.Mensajes = ListaMensajes - Retorno.TieneError = False - Catch ex As Exception - ListaMensajes.Add(ex.ToString()) - Retorno.Mensajes = ListaMensajes - End Try - Else - If Transac Is Nothing Then - ObjVentas.RollBack() - End If - If ObjContPaqTransac Is Nothing Then - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - End If - Retorno.Mensajes = ErrorList - Retorno.TieneError = True - End If - - Else - If Transac Is Nothing Then - ObjVentas.RollBack() - End If - - If ObjContPaqTransac Is Nothing Then - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - End If - - ErrorList.Add("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.") - Retorno.Mensajes = ErrorList - Retorno.TieneError = True - End If - Catch ex As Exception - Me.ErrorList.Add(ex.ToString()) - - If Transac Is Nothing Then - ObjVentas.RollBack() - End If - If ObjContPaqTransac Is Nothing Then - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - End If - - Retorno.Mensajes = ErrorList - Retorno.TieneError = True - Finally - If Transac Is Nothing Then - ObjVentas.Dispose() - ObjConta.Dispose() - ObjInventario.Dispose() - ObjCGame.Dispose() - ObjContr.Dispose() - ObjDocCliente.Dispose() - ObjClientes.Dispose() - ObjAcum.Dispose() - End If - If ObjContPaqTransac Is Nothing Then - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - End If - End Try - Else - Retorno.Mensajes.Add("No se han agregado productos/servicios") - End If - End If - - Return Retorno - End Function - - Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() - Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) - Dim File As Byte() = Nothing - Try - 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))) - Dim response = httpClient.SendAsync(request).Result - If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then - File = response.Content.ReadAsByteArrayAsync().Result - End If - End Using - End Using - Catch ex As Exception - File = Nothing - OnError("Ocurrió un error al descargar la factura", ex) - End Try - - Return File - End Function - -#Region " GUARDAR - VENTA, PREPOLIZAS, INV, NC , ESTIMACIONES, AC, NOTA DE CRÉDITO " - Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean - Dim ProcesoCorrecto As Boolean = True - - 'Generamos el nuevo folio - Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) - - If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then - Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", Me.CveSubProyecto)) - If DT.Rows.Count > 0 Then - factura.Folio = DT.Rows(0)("FActual").ToString.ToEntero - Else - ProcesoCorrecto = False - End If - DT.Dispose() - End If - - '** genero los datos de la NC - Dim tmpcon As DataTable = DtDetalle.Clone - tmpcon.Clear() - - Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("SATClavePS = '84111506'") - - If drpss IsNot Nothing Then - Dim ii As Integer = 1 - Dim CveVentaP As Integer = 0 - For Each gvrt As DataRow In DtAnticipos.Rows - Dim CveSub As Integer = DtDetalle.FiltroPrimeroValor("CveSubProyecto").ToEntero - Dim dr As DataRow = tmpcon.NewRow - Dim Cantidad As Decimal = 1 - Dim PU As Decimal = gvrt("Importe").ToString().ToDecimal() - Dim TotalCalculableImpuestos As Decimal = (Cantidad * (PU)) - dr("CvePS") = drpss("CvePS") - dr("PS") = drpss("PS") - dr("OBS") = drpss("PS") - dr("PU") = PU - dr("Cantidad") = Cantidad - dr("CveUM") = drpss("CveUnidadMedida") - dr("SATClaveProdServ") = "84111506" - dr("SATClaveUM") = "ACT" - dr("Consec") = ii - - If drpss("IVA").ToString = "-1" Then - dr("PorcentajeIVA") = SubProyectoPorcentajeIVA ' GlobalDTSubProyectos(-1,cves DrPS("IVA") - Else - dr("PorcentajeIVA") = drpss("IVA") - End If - - dr("IVA") = dr("PorcentajeIVA") - dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, 2) - - dr("ImporteRetIVA") = Math.Round(Me.Cliente.RetIVA * TotalCalculableImpuestos, 2) - dr("ImporteRetISR") = Math.Round(Me.Cliente.RetIVA * TotalCalculableImpuestos, 2) - dr("PorcentajeRetIVA") = Me.Cliente.RetIVA - dr("PorcentajeRetISR") = Me.Cliente.RetISR - dr("PorcentajeIEPS") = 0 ' DrPS("IEPSPorcentaje") - dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - dr("IEPS") = dr("ImporteIEPS") - dr("Descuento") = Math.Round(0, 2) - dr("TipoDescuento") = TipoDescuento - dr("Total") = (Cantidad * PU) - dr("CveClasificacion") = drpss("CveClasificacion") - dr("CveSubProyecto") = CveSub - dr("TotalImporte") = Math.Round(Cantidad * PU, 2) - CveVentaP = gvrt("CveVenta").ToString().ToEntero() - tmpcon.Rows.Add(dr) - ii += 1 - - Next - - '**** impuestos locales - - - factura.DtDetalle = tmpcon - Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal - Dim TotalDescuentos As Decimal = tmpcon.SUM("Descuento").ToDecimal - - Dim TotalIVA As Decimal = tmpcon.SUM("ImporteIVA").ToDecimal - Dim TotalIEPS As Decimal = tmpcon.SUM("ImporteIEPS").ToDecimal - Dim TotalRetIVA As Decimal = tmpcon.SUM("ImporteRetIVA").ToDecimal - Dim TotalRetISR As Decimal = tmpcon.SUM("ImporteRetISR").ToDecimal - Dim Total As Decimal = 0 - Dim TotalImpuestosLocales As Decimal = 0 - Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales) - - factura.SubTotal = TotalSubTotal - factura.Descuento = 0 - factura.IVA = TotalIVA - factura.IEPS = TotalIEPS - factura.RetIVA = TotalRetIVA - factura.RetISR = TotalRetISR - factura.Total = Total - factura.CveVentaPadre = CveVentaP - - 'Registramos la venta - GuardarVenta(factura, ObjVentas, ObjConta, ObjInventario, ObjContr, tmpcon, -1, ObjContPaq, ObjBancos) - - ''Timbramos - Else - ErrorList.Add("No se encontró un producto para generar la nota de crédito") - End If - - - Return ProcesoCorrecto - End Function - Private Sub EnviarNotificacionAvance(NumeroContrato As String, DescripcionContrato As String, ContratoTipo As String, Cliente As String, CorreoVendedor As String, Optional MontoMaximo As Double = 0) - - Dim ObjMail As New ClsSisMail() - - Dim CorreoLicitacion As String = "" - - Dim Para As String = String.Format("{0};{1}", CorreoVendedor, CorreoLicitacion) - Dim Asunto As String = "NOTIFICACION DE 100% DE AVANCE DE CONTRATO" - Dim Cuerpo As String = "" - - If MontoMaximo > 0 Then - Cuerpo = String.Format("El Contrato {0} - {1} ({2}) con cliente {4} ha alcanzado el monto máximo de {3}.", NumeroContrato, DescripcionContrato, ContratoTipo, MontoMaximo.ToString("C2"), Cliente) - Else - Cuerpo = String.Format("El Contrato {0} - {1} ({2}) con cliente {3} ha llegado al 100% de Avance.", NumeroContrato, DescripcionContrato, ContratoTipo, Cliente) - End If - - ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Cuerpo) - - End Sub - Private Function EnviarSMSTimbrado(ByRef ObjEventos As ClsOIEventos) As Integer - Dim Mensaje = UsuarioActual.Empresa.Funcionalidad(152) - If Mensaje = "" Then Return 0 - - Dim Celular = Me.Cliente.CobranzaTelefono - If Celular.Length <> 10 Then Return 3 - - 'ARMA MENSAJE - '4: VSH Monitoreo aviso de: Factura pendiente {SerieFolio} del {Fecha} por ${Importe} fecha limite de pago {FechaPago} Bancomer 0171426931-{ClienteNombreCorto} - Mensaje = Mensaje.Replace("{SerieFolio}", Me.SerieFolio) - Mensaje = Mensaje.Replace("{Fecha}", Me.Fecha.ToString("dd-MMM-yyyy").Replace(".", "")) - Mensaje = Mensaje.Replace("{Importe}", Me.Total.FormatoNumero) - Mensaje = Mensaje.Replace("{FechaPago}", Me.FechaPago.ToString("dd-MMM-yyyy").Replace(".", "")) - Mensaje = Mensaje.Replace("{ClienteNombreCorto}", Me.Cliente.NombreCorto) - If Mensaje = "" Then Return 2 - - Dim ObjMensaje As New ClsTecnoMovil - If ObjMensaje.EnviarMensajeWS(Celular, Mensaje) Then - If ObjEventos.AddEventoBitacora($"Notificación al cliente via SMS. Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=Me.CveCliente, CveVenta:=Me.CveVenta) Then - End If - Return 1 - Else - Return 2 - End If - End Function - Private Sub GuardaVentaDocumentosCliente(tCveVenta As Integer, ByRef objDocumentacion As ClsEdocumentacion) - If tCveVenta > 0 Then - - For Each DRow As DataRow In DtDocumentacionCliente.FiltraParametros("RutaArchivo <> '' ").Rows - Dim CveDocumentacion As Integer = DRow("CveDocumentacion").ToString.ToEntero - Dim Estatus As Integer = DRow("Estatus").ToString.ToEntero - Dim Adjunto As String = DRow("Adjunto").ToString - Dim NombreArchivo As String = "" - Dim ArchivoRuta As String = DRow("RutaArchivo").ToString - If ArchivoRuta.Length > 0 Then Adjunto = ArchivoRuta - Dim Extension As String = Path.GetExtension(Adjunto) - - Dim CveDocumentacionElectronica As Integer = objDocumentacion.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, DRow("Observacion").ToString, Extension, UsuarioActual.CveUsuario, New Date(1900, 1, 1), CveVenta:=tCveVenta) - - If CveDocumentacionElectronica <= 0 Then ErrorList.Add("No se pudo registrar el documento ") - NombreArchivo = $"{CveDocumentacionElectronica}{Extension}" - - If ArchivoRuta.Length > 0 And NombreArchivo.Length > 0 Then - If Not Directory.Exists($"{UsuarioActual.Empresa.Ruta}Documentacion\Ventas\") Then - Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}Documentacion\Ventas\") - End If - - Dim ArchivoExistenteRuta As String = $"{UsuarioActual.Empresa.Ruta}Documentacion\Ventas\{NombreArchivo}" - - If File.Exists(ArchivoExistenteRuta) Then File.Delete(ArchivoExistenteRuta) - - Try - - File.Move(ArchivoRuta, ArchivoExistenteRuta) - Catch ex As Exception - ErrorList.Add("No se pudo guardar el documento de la venta") - Exit For - End Try - - End If - Next - - End If - - End Sub - Public Sub GuardarVenta(ByRef factura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef 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 EsNotaCredito As Boolean = False, Optional ObjAcum As ClsAcumuladores = Nothing, ByRef Optional Resp As MMensajeFactura = Nothing) - Dim Msgok As New StringBuilder - - factura.CvePrePoliza = ObjConta.AddPrePolizas("Modelos/GuardarVentaM", factura.CvePlantillaPoliza, factura.TotalTC, factura.TotalTC, factura.CveMoneda, factura.Fecha, If(factura.CveEmpresaCRM > 0, factura.EmpresaCRM, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa) - - If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC, - factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC, - factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, - factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, - factura.Alfa1, factura.Alfa2, factura.Alfa3, factura.Num1, factura.Num2, factura.Num3, - factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, - AtencionA:=factura.AtencionA, TelefonoGenerico:=factura.TelefonoGenerico, CveContrato:=factura.CveContrato, - CveVentaPadre:=If(AplicaDevolucion, CveVentaDevolucion, factura.CveVentaPadre), Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, - Entrega:=factura.Entrega, Vigencia:=If(factura.TipoDocto = "Cot", FechaVencimiento, MinFecha), - CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, - CveDireccionEnvio:=factura.CveDireccionEnvio, CveOC:=factura.CveOC, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=factura.CveCondicionEntrega, - PedidoContrato:=factura.PedidoContrato, ObservacionesAlmacen:=factura.ObservacionesAlmacen, CveSubProyecto:=factura.CveSubProyecto, CveSubProyectoCobranza:=factura.CveSubProyectoCobranza, CveSubProyectoEjecucion:=factura.CveSubProyectoEjecucion, CveFormaPago33:=factura.CveFormaPago33, - CveMetodoPago33:=factura.CveMetodoPago33, CveUsoCFDI:=factura.CveUsoCFDI, OrdenCompra:=factura.OrdenCompra, CveCuentaTerminal:=factura.CveCuentaTerminal, CveTipoRelacion:=factura.CveTipoRelacion, ImpuestoLocal:=TotalImpuestoLocal, - CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)), - CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno) Then - - ErrorList.Add("Ocurrió un error al Generar la Venta.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - - End If - - - If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then - - factura.CveVenta = ObjVentas.CveVenta - factura.Serie = ObjVentas.Serie - factura.Folio = ObjVentas.Folio - factura.Timbre.Comprobante.Serie = ObjVentas.Serie - factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString - - If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then - If DtVentasNC Is Nothing Then - InicializaDTVentasNC() - End If - CargaNCDT(factura.CveVentaPadre, factura.Total, NuevaFactura:=NuevaFactura, ObjVentas:=ObjVentas) - End If - - 'Se agregan los PS - For Each Row As DataRow In TmpDTDetalle.Rows - If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - Row("PU").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), - Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, - TiempoEntrega:=Row("TiempoEntrega").ToString, CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, - CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1), - IEPS:=Row("ImporteIEPS").ToString.ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero, - ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, - PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString, - PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal) Then - ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la factura.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - Exit For - Else - Row("CveVenta") = factura.CveVenta - Row("CveVentaDetalle") = ObjVentas.CveVentaDetalle - - If DtInventario IsNot Nothing Then - If DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then - Dim rowInv As DataRow = DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) - rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle - End If - End If - - If DtRecepcionUsados IsNot Nothing Then - If DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then - Dim rowInv As DataRow = DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) - rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle - End If - End If - - If DtPolizasVirtuales IsNot Nothing Then - If DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then - Dim RowPoliza As DataRow = DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) - RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle - End If - End If - - 'Agregamos el gasto de contrato - If factura.CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then - Dim ObjContrato As New ClsContratos - If Not ObjContrato.AddContratoGasto(factura.CveContrato, Row("PS").ToString, Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, factura.Fecha, UsuarioActual.CveUsuario, CveVenta:=ObjVentas.CveVenta) Then - ErrorList.Add("Ocurrió un error al agregar el gasto de la factura.") - Exit For - End If - ObjContrato.Dispose() - End If - - 'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion - If AplicaDevolucion Then - If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString.ToEntero, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString.ToDouble()) Then - ErrorList.Add("Ocurrió un error al agregar la venta detalle devolucion.") - End If - End If - - If DtAjustes IsNot Nothing AndAlso DtAjustes.Rows.Count > 0 Then - If DtAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}").Length > 0 Then - Dim DrAju As DataRow = DtAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}")(0) - DrAju("CveVentaDetalle") = ObjVentas.CveVentaDetalle - End If - End If - - End If - Next - - 'GUARDAR USADOS - If Not GuardarUsados(ObjAcum, ObjVentas, ObjInventario, factura, Resp) Then - ErrorList.Add("Error al guardar usados") - End If - - 'BONIFICACION USADOS - If UsadosBonificacion IsNot Nothing AndAlso UsadosBonificacion.Count > 0 AndAlso TipoBonificacion > 0 Then - For Each CveMovto In UsadosBonificacion - If Not ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, TipoBonificacion, CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar el distribuidor.") - End If - Next - End If - - 'AJUSTES' - If DtAjustes IsNot Nothing AndAlso DtAjustes.Rows.Count > 0 Then - For Each Dr As DataRow In DtAjustes.Rows - If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero, - Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero, - Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal()) Then - ErrorList.Add("Ocurrió un error al agregar la garantia detalle.") - End If - Next - End If - - 'POLIZA VIRTUAL - If factura.DtPolizasVirtuales IsNot Nothing AndAlso factura.DtPolizasVirtuales.Rows.Count > 0 Then - If Not GuardarPolizasVirtuales(ObjVentas.IniciaTransacSQL(), ObjFactura:=factura) Then - ErrorList.Add("Ocurrió un error al actualizar el distribuidor.") - End If - End If - - 'ORDEN PRODUCCION' - If UsuarioActual.CveEmpresa.Contiene(126) Then - If ObjVentas.CveVenta > 0 And factura.CveOrdenProduccion > 0 Then - If Not ObjCGame.UpdateOrdenProduccionVenta(factura.CveOrdenProduccion, ObjVentas.CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar la orden de producción") - End If - End If - End If - - 'PedidoA' - If ObjVentas.CveVenta > 0 And factura.CvePedidoA > 0 And factura.TipoDocto.Contiene("Rem") Then - If Not ObjCliente.UpdateEstatusPedido(factura.CvePedidoA, 18, -1, UsuarioActual.CveUsuario) Then - ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA") - End If - End If - - 'Pedido2' - If ObjVentas.CveVenta > 0 And factura.CvePedido2 > 0 And factura.TipoDocto.Contiene("Rem", "PA") Then - If Not ObjCliente.UpdateEstatusPedido(factura.CvePedido2, 21, -1, UsuarioActual.CveUsuario) Then - ErrorList.Add("Ocurrió un error al actualizar el estatus del pedido2") - End If - End If - - 'Si viene de OS, Se guarda CveVenta en OS - If CveOS > 0 Then - If Not ObjOS.UpdateVentaOS(factura.CveVenta, CveOS) Then - ErrorList.Add("Ocurrió un error al guardar la venta en Ordenes de Servicio") - End If - End If - - 'Contratos - If factura.CveContrato > 0 AndAlso factura.TipoDocto.Contiene("Ing") Then - GuardarContratoAvanceEstimaciones(factura, ObjContr, ErrorList, 1) - 'CUANDO ES NOTA DE CRÉDITO, NO DEBE DE CONSIDERAR AVANCE, CUANDO ES NOTA DE CRÉDITO POR AMORTIZACIÓN - ElseIf factura.CveContrato > 0 AndAlso factura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not factura.EsNCAmortizacion Then - GuardarContratoAvanceEstimaciones(factura, ObjContr, ErrorList, -1) - End If - - 'Impuestos Locales - If DtImpuestosLocales IsNot Nothing Then - For Each gvr As DataRow In DtImpuestosLocales.Rows - If Not ObjVentas.AddVentaImpuestoLocales(factura.CveVenta, gvr("CveImpuestoLocal").ToString.ToEntero(), gvr("Importe").ToString().ToDouble()) Then - ErrorList.Add("Ocurrió un error al Guardar Impuestos Locales") - End If - Next - End If - - - If DtFirmas IsNot Nothing AndAlso DtFirmas.Rows.Count > 0 Then - For Each Row As DataRow In DtFirmas.Rows - If Not ObjVentas.AddVentasFirmas(factura.CveVenta, Row("Titulo").ToString, Row("Nombre").ToString, Row("Puesto").ToString, Row("Lado").ToString.ToEntero) Then - ErrorList.Add("Ocurrio un error al Guardar Firmas") - End If - Next - End If - - 'registro los metodos de pago, cuando hay corte. - If factura.CveCorte > 0 Then - 'cuando es contado - If Pago = 2 AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then - For Each DrPago As DataRow In DtPagos.Rows - If Not ObjVentas.AddVta_VentaPago(factura.CveVenta, DrPago("CveMetodoPago").ToString.ToEntero, DrPago("Importe").ToString.ToDouble) Then - ErrorList.Add("Ocurrio un error al guardar los metodos de pago") - End If - Next - Else - 'cuando es crédito o terminal - If Not ObjVentas.AddVta_VentaPago(factura.CveVenta, 7, factura.Total) Then - ErrorList.Add("Ocurrio un error al guardar los metodos de pago") - End If - End If - - End If - - 'INE COMPLEMENTOS - If factura.ComplementoINE IsNot Nothing Then - If Not ObjVentas.UpdateVentasComplementos(factura.CveVenta, factura.ComplementoINE.INETipoProceso, factura.ComplementoINE.INETipoComite, factura.ComplementoINE.INEIdContabilidad.ToString) Then - ErrorList.Add("Ocurrio un error al guardar los complementos") - End If - End If - - If ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then - 'Agregamos las remisiones a la tabla - If factura.DtRemisionesPS IsNot Nothing AndAlso factura.DtRemisionesPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - Dim CveVentaDetalle As Integer = 0 - Dim CveVentaDetallePadre As Integer = 0 - Dim Cantidad As Decimal = 0 - - - For Each row As DataRow In factura.DtRemisionesPS.Rows - Cantidad = factura.DtDetalle.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToDecimal() - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero - CveVentaDetalle = factura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleRemision={CveVentaDetallePadre}").ToEntero - - - If Not ObjVentas.AgregarRemisionDetalle(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then - ErrorList.Add("Ocurrió un error al agregar el detalle de la Remision") - End If - Next - - End If - - If factura.DtRemisiones IsNot Nothing AndAlso factura.DtRemisiones.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - For Each row As DataRow In factura.DtRemisiones.Rows - If Not ObjVentas.UpdateVentaRemision(row("CveVenta").ToString.ToEntero, factura.CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar la remisión") - End If - Next - End If - End If - - If ErrorList.Count = 0 Then - 'Agregamos los pedidos2 a la tabla - If DtPedidos2PS IsNot Nothing AndAlso DtPedidos2PS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - Dim CveVentaDetalle As Integer = 0 - Dim CveVentaDetallePadre As Integer = 0 - Dim Cantidad As Decimal = 0 - Dim CvePS As Integer = 0 - Dim PU As Decimal = 0 - - For Each row As DataRow In DtDetalle.Rows - Cantidad = DtDetalle.FiltroPrimeroValor("Cantidad", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToDecimal - CvePS = DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero - PU = DtDetalle.FiltroPrimeroValor("PU", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToDecimal - CveVentaDetalle = DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero - - If Not ObjVentas.AddVentaDetallePedido2(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then - ErrorList.Add("Ocurrió un error al agregar el detalle del Pedido2") - End If - Next - End If - - If DtPedidos2 IsNot Nothing AndAlso DtPedidos2.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then - Dim dt As DataTable = DtPedidos2.FiltraParametros("Aplicado = True") - If dt.Rows.Count > 0 Then - For Each row As DataRow In dt.Rows - If Not ObjVentas.UpdateVentaPedido2(row("CveVenta").ToString.ToEntero, factura.CveVenta) Then - ErrorList.Add("Ocurrió un error al actualizar el Pedido2") - End If - Next - End If - End If - End If - - - If ErrorList.Count = 0 Then - 'prepoliza - GuardarVentaPrePolizas(factura, ObjConta, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, ObjInventario:=ObjInventario) - If ErrorList.Count = 0 Then - 'inventarios - GuardarVentaInventarios(factura, ObjInventario, ObjConta, ObjVentas, ObjAcum) - - 'GuardaRecepcionUsados(factura, ObjInventario, ObjConta) - - If ErrorList.Count = 0 Then - 'estimaciones - GuardarVentaEstimaciones(factura, ObjContr) - If ErrorList.Count = 0 Then - 'armonizaccionContable - GuardarVentaAC(factura, ObjVentas, Msgok, objContPaqi) - If ErrorList.Count = 0 Then - 'Impuestos Locales - If GuardarVentaImpuestosLocales(factura, ObjVentas, ObjConta) Then - ErrorList.Add("Ocurrio un error al Guardar Impuestos Locales") - End If - End If - End If - End If - End If - End If - - End If - End Sub - Private Function SalidaAlmacenMateriales(ByRef ObjInventario As ClsInventarios, CveOS As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean - Dim TieneError As Boolean = False - Dim CveMovimientoSalida = 0 - Dim CveMovimientoEntrada = 0 - - Dim CveMovimientoSalida2 = 0 - Dim CveMovimientoEntrada2 = 0 - - Dim CveMovimientoSalida3 = 0 - Dim CveMovimientoEntrada3 = 0 - - Dim AlmacenEntrada = -1 - Dim FolioSalida = 0 - Dim FolioEntrada = 0 - - Dim TextoError = "" - Dim TextoExistencia As StringBuilder = New StringBuilder - - 'Obtenemos los movimientos detalle - If ObjInventario.GetMovimientosOS(9, CveOS, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count > 0 Then - Dim CveMovimiento As Integer = ObjInventario.DtResultados(0)("CveMovimiento").ToString.ToEntero - Dim CveAlmacenOrigen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero - Dim CveAlmacenDestino As Integer = ObjInventario.DtResultados(0)("AlmacenDestino2").ToString.ToEntero - Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero - Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados(0)("CveTipoAlmacen").ToString.ToEntero - - 'AGREGAMOS LA ENTRADA Movto 1 - If Not TieneError Then - AlmacenEntrada = CveAlmacenOrigen - - CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, 8, 1, Me.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - CveAlmacenDestino:=-1, CveMovimientoRelacionado:=CveMovimientoSalida, CveOS:=CveOS, Modulo:="Mod/OS") - FolioEntrada = ObjInventario.Folio - - If CveMovimientoEntrada <= 0 Then - TextoError = "No se pudo generar el movimiento de entrada correctamente" - TieneError = True - Else - - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then - TieneError = True - TextoError = "Ocurrió un Error al guardar los movimientos de entrada" - Exit For - End If - Next - - End If - - End If - End If - - 'AGREGAMOS LA ENTRADA Movto 2 - If Not TieneError Then - AlmacenEntrada = CveAlmacenDestino - - CveMovimientoEntrada2 = ObjInventario.AddMovimiento(AlmacenEntrada, 9, 1, Me.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=-1, - CveMovimientoRelacionado:=CveMovimientoSalida2, CveOS:=CveOS, Modulo:="Mod/OS") - FolioEntrada = ObjInventario.Folio - - If CveMovimientoEntrada2 <= 0 Then - TextoError = "No se pudo generar el movimiento de entrada correctamente" - TieneError = True - Else - - If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada2, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then - TieneError = True - TextoError = "Ocurrió un Error al guardar los movimientos de entrada" - Exit For - End If - Next - - End If - - End If - End If - - 'AGREGAMOS LA ENTRADA Movto 3 - If Not TieneError Then - AlmacenEntrada = CveAlmacenDestino - - CveMovimientoEntrada3 = ObjInventario.AddMovimiento(AlmacenEntrada, 3, 1, Me.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=-1, - CveMovimientoRelacionado:=CveMovimientoSalida3, CveOS:=CveOS, Modulo:="Mod/OS") - FolioEntrada = ObjInventario.Folio - - If CveMovimientoEntrada3 <= 0 Then - TextoError = "No se pudo generar el movimiento de entrada correctamente" - TieneError = True - Else - - If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada2, UsuarioActual.CveEmpresa) Then - - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada3, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then - TieneError = True - TextoError = "Ocurrió un Error al guardar los movimientos de entrada" - Exit For - End If - Next - - End If - - End If - End If - - End If - End If - - Return TieneError - End Function - Function RegistraAlmacenConsignacionVenta(ByRef ObjInventario As ClsInventarios) As Boolean - If Not (UsuarioActual.Empresa.UsaInventarios AndAlso CveAlmacenExistenciasContrato > 0) Then - Return True - End If - - Dim CveMovimientoSalidaConsignacion = -1 - Dim CveMovimientoEntradaGeneral = -1 - Dim CveMovimientoSalidaGeneral = -1 - - - 'MOVIMIENTO DE SALIDA POR TRASPASO DEL ALMACEN DE CONSIGNACION - CveMovimientoSalidaConsignacion = ObjInventario.AddMovimiento(CveAlmacenExistenciasContrato, 8, 1, Me.Fecha, -1, Me.CveUsuario, Me.CveEmpresa, -1, Me.CveVenta, -1, -1, Modulo:="Mod/E") - If CveMovimientoSalidaConsignacion > 0 Then - Dim CveProducto As Integer - Dim CveUnidad As Integer - Dim Cantidad As Double - Dim Existencia As Double - For Each Dr As DataRow In DtDetalle.Rows - CveProducto = Dr("CvePS").ToString.ToEntero - CveUnidad = Dr("CveUM").ToString.ToEntero - Cantidad = Dr("Cantidad").ToString.ToDouble - - If Not CveProducto > 0 Then - Return False - End If - - If Dr("CveTipoInvPS").ToString.ToEntero = 5 Then - For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, Me.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=Me.CveSubProyecto, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) - If Existencia < 1 Then - Return False - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - Return False - End If - Next - Else - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, Me.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=Me.CveSubProyecto, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) - If Existencia < Cantidad Then - Return False - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, Cantidad, CveUnidad, CveProducto, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - Return False - End If - End If - Next - Else - Return False - End If - - - 'ENTRADA POR TRASPASO A GENERAL - CveMovimientoEntradaGeneral = ObjInventario.AddMovimiento(Me.CveAlmacenOrigenContrato, 9, 1, Me.Fecha, -1, Me.CveUsuario, Me.CveEmpresa, -1, Me.CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalidaConsignacion, Modulo:="Mod/E") - If CveMovimientoEntradaGeneral > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - Return False - End If - Next - End If - Else - Return False - End If - - 'SALIDA GENERAL - CveMovimientoEntradaGeneral = ObjInventario.AddMovimiento(Me.CveAlmacenOrigenContrato, 3, 1, Me.Fecha, -1, Me.CveUsuario, Me.CveEmpresa, -1, Me.CveVenta, -1, -1, Modulo:="Mod/E") - If CveMovimientoEntradaGeneral > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - Return False - End If - Next - End If - Else - Return False - End If - - - Return True - End Function - Private Sub GuardarContratoAvanceEstimaciones(ObjFactura As Modelos.Factura, ObjContrato As ClsContratos, ErrorList As List(Of String), Multiplicador As Integer, Optional CrearAvance As Boolean = False) - - If ObjFactura.CveContrato > 0 Then - - Dim CveEstimacion As Integer = -1 - - If ObjContrato.AddEstimaciones(ObjFactura.CveContrato, ObjFactura.Fecha, -1, ObjFactura.CveVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - CveEstimacion = ObjContrato.DtResultados(0)("CveEstimacion").ToString.ToEntero - - For Each row As DataRow In ObjFactura.DtDetalle.Rows - If row("CveContratoDetalle").ToString.ToEntero > 0 Then - If Not ObjContrato.AddContratosAvance(row("CveContratoDetalle").ToString.ToEntero, row("Cantidad").ToString.ToEntero * Multiplicador, ObjFactura.Fecha, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then - ErrorList.Add("Ocurrió un error al agregar los avances") - End If - End If - Next - - Else - ErrorList.Add("Ocurrió un error al agregar las estimaciones") - End If - End If - - End Sub - Private Sub InicializaDTVentasNC() - DtVentasNC = New DataTable - DtVentasNC.Columns.Add("CveVenta", GetType(Integer)) - DtVentasNC.Columns.Add("Importe", GetType(Decimal)) - DtVentasNC.Columns.Add("FolioFiscal", GetType(String)) - End Sub - Private Sub CargaNCDT(pCveVenta As Integer, Importe As Decimal, Optional FolioFiscal As String = "", Optional NuevaFactura As Integer = -1, Optional ByRef ObjVentas As ClsVentas = Nothing) - If (pCveVenta > 0 AndAlso Me.TipoDocto.Contiene("Egs")) OrElse (pCveVenta > 0 AndAlso NuevaFactura = 1) Then - If FolioFiscal = "" Then - - Dim ObjVentasAplicar As ClsVentas - If ObjVentas IsNot Nothing Then - ObjVentasAplicar = ObjVentas - Else - ObjVentasAplicar = New ClsVentas - End If - - If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then - FolioFiscal = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("FolioFiscal").ToString - End If - - If ObjVentas Is Nothing Then - ObjVentasAplicar.Dispose() - End If - - End If - - Dim Dr = DtVentasNC.NewRow - Dr("CveVenta") = pCveVenta - Dr("Importe") = Importe - Dr("FolioFiscal") = FolioFiscal - DtVentasNC.Rows.Add(Dr) - End If - End Sub - Private Function CancelarMovimientosUsados(factura As Modelos.Factura, UsuarioActual As Usuario, ByRef ObjAcum As ClsAcumuladores) As Boolean - Dim Retorno As Boolean = True - If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=2) Then - Dim CveConceptoSalida As Integer = 2 - - Dim DtSalidas As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") - If DtSalidas IsNot Nothing AndAlso DtSalidas.Rows.Count > 0 Then - For Each RowSalida As DataRow In DtSalidas.Rows - Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1 - - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConceptoSalida, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then - Retorno = False - Exit For - End If - Next - DtSalidas.Dispose() - End If - - End If - Return Retorno - End Function - Private Function GuardarUsados(ByRef ObjAcum As ClsAcumuladores, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, factura As Modelos.Factura, ByRef Optional Resp As MMensajeFactura = Nothing) As Boolean - Dim Resultado As Boolean = True - - If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then - - If factura.TipoDocto = "Ing" AndAlso factura.Cliente.EsDistribuidor Then - Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero - - For Each drow As DataRow In factura.DtDetalle.Rows - If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0D, "") Then - Resultado = False - Exit For - End If - End If - Next - - End If - - If factura.TipoDocto.Contiene("Rem") Then - If factura.DtRecepcionUsados IsNot Nothing Then - For Each drow As DataRow In factura.DtRecepcionUsados.Rows - If Not ObjVentas.AddVentaUsado(factura.CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then - Resultado = False - Exit For - End If - Next - End If - End If - End If - - 'SI ES UNA RNC DE CARGO GENERA EL MOVIMIENTO DE ALMACEN AQUI - If factura.TipoDocto = "RNC" AndAlso factura.Num1 = 1 AndAlso factura.DtMovimientosUsados IsNot Nothing AndAlso ObjAcum IsNot Nothing Then - 'Dim Mensaje As String = "" - Dim CveMovimiento = ObjInventario.AddMovimiento(factura.CveAlmacen, factura.CveConceptoMovimiento, 1, factura.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, factura.CveVenta, - CveSubProyecto, CveActivoFijo:=-1, Guia:="", Observaciones:=factura.ObservacionesMovimiento, CvePersonal:=-1, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, Modulo:="RU/G") - If CveMovimiento <= 0 Then - 'Mensaje = "Error al guardar los movimientos" - Resultado = False - Else - - - For Each Dr As DataRow In factura.DtMovimientosUsados.Rows - - Dim ImporteConcepto As Decimal = 0 - If factura.CveConceptoMovimiento = 42 AndAlso factura.CveMoneda = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(factura.Fecha).ToDecimal - Else - ImporteConcepto = Dr("PU").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - 'Mensaje = "Error al guardar los movimientos" - Resultado = False - Exit For - End If - - If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then - 'Mensaje = "Error al actualizar el recibo de los usados" - Resultado = False - Exit For - End If - - 'si es selectedvalue = 42, es entrada ,3 -salida - Dim CveConceptoUsados As Integer = If(factura.CveConceptoMovimiento = 42, 1, 2) - - If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then - ' Mensaje = "Error al guardar Movimientos de distribuidor" - Resultado = False - Exit For - End If - - End If - Next - End If - - Resp.CveMovimientoUsado = CveMovimiento - - If CveMovimiento > 0 Then - If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) Then - Resp.FolioUsado = ObjInventario.DtResultados.FiltroPrimeroValor("Folio") - End If - End If - - End If - - Return Resultado - - End Function - Private Function GuardarPolizasVirtuales(SqlTransaccion As SqlClient.SqlTransaction, ObjFactura As Modelos.Factura) As Boolean - Dim Resultado As Boolean = True - - If UsuarioActual.Empresa.Funcionalidad(531).ToEntero > 0 AndAlso ObjFactura.TipoDocto.Contiene("Rem") Then - - Dim ObjAcum As New ClsAcumuladores(SqlTransaccion) - - For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows - If ObjAcum.AddPolizaVirtual(ObjFactura.CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal, - drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString), - drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then - Else - Resultado = False - Exit For - End If - Next - End If - - Return Resultado - - End Function - Private Sub GuardarVentaPrePolizas(ByRef factura As Modelos.Factura, ByRef ObjConta As ClsContabilidad, 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, ByRef Optional ObjInventario As ClsInventarios = Nothing) - - Dim CveIE As Integer = -1 - Dim DT As DataTable = Nothing - - - Dim CveConceptoAfectacion As Integer = 1 'Cliente - Dim CveConceptoAntCli As Integer = 3 'Anticipo Cliente - Dim CveConceptoVenta As Integer = 4 'Venta - Dim CveConceptoCanAnt As Integer = 11 'Cancelacion Anticipos - Dim CveConceptoDSV As Integer = 12 ' DSV - Dim CveConceptoIVA As Integer = 13 'IVA Trasladado - Dim CveConceptoRetIVA As Integer = 8 'Ret IVA - Dim CveConceptoRetISR As Integer = 9 'Ret ISR - - 'P R E P O L I Z A S - If Me.TipoDocto <> "Cot" Then - If Me.CvePrePoliza > 0 Then - If ProcesoPrepolizas(factura, ObjConta, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, ObjInventario:=ObjInventario) Then - ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - End If - Else - ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - End If - End If - End Sub - Private Function ProcesoPrepolizas(ObjFactura As Factura, ByRef ObjConta As ClsContabilidad, 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 ByRef DtRemisionesRelacionadas As DataTable = Nothing, Optional SeCancelaRemisionProceso As Boolean = False, Optional CancelarRemisiones As Boolean = False, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, - Optional CveEstatusRefacturacion As Integer = 0, Optional ByRef ObjInventario As ClsInventarios = Nothing) As Boolean - Dim ErrorPrepoliza As Boolean = False - Try - Dim DT As DataTable - Dim CvePlantilaPoliza As Integer - Dim PorcentajeAmortizacion As Decimal = 0 - Dim sumaAmorticaciones As Decimal = 0 - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " - Dim idCuentaContabilizacion As Integer = 1 - Dim CveCuentaContabilizacion As Integer = 1 - Dim tipoCambio As Decimal - Dim CuentasContablesInvalidas As New StringBuilder - Dim CuentasContablesInvalidasSIG As New StringBuilder - - If ObjFactura.TipoDocto = "Ing" Or ObjFactura.TipoDocto = "Ant" Or ObjFactura.TipoDocto = "Com" Then - CvePlantilaPoliza = 4 - ElseIf ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - CvePlantilaPoliza = 7 - ElseIf ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then - CvePlantilaPoliza = 4 - End If - - If ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio > 0 Then - tipoCambio = ObjFactura.TipoCambio - ElseIf ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio <= 1 Then - tipoCambio = GlobalTipoCambio(ObjFactura.Fecha).ToString.ToDecimal - Else - tipoCambio = 1 - End If - - Dim ConceptoContable As Integer - Dim TipoMovimiento As Boolean - Dim importeMovimiento As Decimal - Dim FechaMovimiento As Date = ObjFactura.Fecha - Dim IdCtaContable As Integer - Dim CveCuenta As Integer - Dim IdCtaContableCliente As Integer - Dim CveCuentaCliente As Integer - Dim Concepto As String = ObjFactura.SerieFolio - Dim Referencia As String = ObjFactura.SerieFolio - Dim Fecha = ObjFactura.Fecha - - Dim importeMX As Decimal - Dim Multiplicador As Integer - Dim CveIEPago As Integer - Dim FolioIE As Long - Dim CveIEAnticipo As Integer - Dim CveSubProyectoVenta = ObjFactura.CveSubProyecto - Dim CveSubProyectoContabilizar As Integer - Dim IdCtaIVAXTrasladar As Integer = 0 - Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 - Dim SeContabiliza As Boolean = True - - If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Then - SeContabiliza = False - End If - - If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=ObjFactura.DtDetalle.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=DtDetalle.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=DtDetalle.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVAXTrasladar").ToString.ToEntero - IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=DtDetalle.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=DtDetalle.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVATrasladado").ToString.ToEntero - End If - - Dim UsaComplementariaClientes As Boolean = False - If UsuarioActual.CveEmpresa.Contiene(1, 119) Then UsaComplementariaClientes = True - - If ObjConta.GetPlantillaConceptos(ObjFactura.CveEmpresa, CvePlantilaPoliza) Then - Dim dtt As DataTable = ObjConta.DtResultados - If ValorMultiplicador = -1 Then dtt = ObjConta.DtResultados.FiltraParametros("", "Orden DESC") ' se ordena contrario al registro para llevar los saldos correctos - For Each Row As DataRow In dtt.Rows - - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) - importeMovimiento = 0 - IdCtaContable = 0 - CveCuenta = 0 - CveSubProyectoContabilizar = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "") - Dim PorcentajeImpuesto As Decimal = 0 - - - Select Case ConceptoContable - Case 1 'Cliente - If Not ObjFactura.TipoDocto.Contiene("Egs", "Rem", "RNC") Then - importeMovimiento = (ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - 'If ObjFactura.TipoDocto.Contiene("Ant") Then - ' TipoMovimiento = Not TipoMovimiento 'lo contrario a ingreso, en este caso es anticipo - 'End If - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes - Else - IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria - CveCuenta = 0 - - If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementariaClientes) Then - importeMX = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If - End If - - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera - End If - IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta - End If - - Case 3 'Cliente - - If ObjFactura.TipoDocto = "Ant" Then - ConceptoContable = If(UsuarioActual.CveEmpresa.Contiene(1, 119), 95, ConceptoContable) - importeMovimiento = ObjFactura.SubTotal * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - End If - - Case 190 'Remisión del cliente - - If ObjFactura.TipoDocto = "Rem" Then - importeMovimiento = (ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes - Else - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera - End If - IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta - - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 190, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 193, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - Else - ErrorPrepoliza = True - End If - - importeMovimiento = 0 - ObjFactura.SeGuardoPrePoliza = True - End If - Case 277 'Remisión del cliente - - If ObjFactura.TipoDocto = "RNC" Then - importeMovimiento = (ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes - Else - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera - End If - IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta - - Dim CveMovimiento As Integer = -1 - Dim CveAlmacen As Integer = -1 - - If ObjInventario IsNot Nothing AndAlso ObjInventario.GetInv_Mov(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then - CveMovimiento = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() - CveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero() - End If - - 'VERIFICA SI TIENE MOVIMIENTO DE ENTRADA DE USADO - If CveMovimiento > 0 AndAlso CveAlmacen > 0 Then - - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - Dim Importe68 As Decimal = ObjInventario.DtResultados.SUMD("Total").RoundSQL - - Dim IdCtaContable68 = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=Importe68, Contabilizable:=False) Then - ErrorPrepoliza = True - End If - - Dim Importe318 As Decimal = importeMovimiento - Importe68 - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - - Else - ErrorPrepoliza = True - End If - - Else - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - Else - ErrorPrepoliza = True - End If - End If - - importeMovimiento = 0 - ObjFactura.SeGuardoPrePoliza = True - End If - - - Case 12 'Nota de Credito - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - importeMovimiento = ObjFactura.Total * ValorMultiplicador - importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL - FechaMovimiento = ObjFactura.FechaPago - Dim ImporteConcepto12 As Decimal = 0 - Dim ImporteAcumulado91 As Decimal = 0 - Dim CveUltimaVenta As Integer = 0 - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - IdCtaContable = 0 - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes - ElseIf UsaComplementariaClientes Then - - IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria - CveCuenta = 0 - - If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementariaClientes) Then - importeMX = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - End If - - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - 'CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera - End If - CveSubProyectoContabilizar = CveSubProyectoVenta - ImporteConcepto12 = importeMX.RoundSQL - If importeMovimiento <> 0 Then - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - idCuentaContabilizacion = 0 - End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - ' CveCuentaContabilizacion = 0 - 'End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - importeMovimiento = 0 - - If ValorMultiplicador = 1 Then - Dim IdCtaContableClienteComplementaria As Integer = ObjFactura.Cliente.IdCtaContComplementaria - Dim TipoCambioNC As Decimal = 1 - If tipoCambio > 1 Then - TipoCambioNC = tipoCambio - Else - TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha).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 - Dim Importe91 As Decimal = 0 - Dim ImporteMN91 As Decimal = 0 - Dim Importe251 As Decimal = 0 - - If ObjFactura.CveMoneda = 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 ObjFactura.CveMoneda = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal * TipoCambioNC - Importe91 = Dr("Importe").ToString.ToDecimal - ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC - ElseIf ObjFactura.CveMoneda = 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 ObjFactura.CveMoneda = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal / TipoCambioNC - Importe91 = Dr("Importe").ToString.ToDecimal - ImporteMN91 = 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 - 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 - 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:=Importe251, 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. - - Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal - If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then - TCFluctuacion = GlobalTipoCambio(ObjFactura.Fecha).ToDecimal - End If - 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) * ValorMultiplicador - - 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 - 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") - - 'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA - 'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then - ' Dim DtTest = ObjConta.DtResultados - 'End If - End If - End If - - - If ErrorPrepoliza Then - Exit For - End If - End If - - 'APLICA DEVOLUCION SALDOS DIRECTOS - If ObjFactura.AplicaDevolucion Then - Dim TipoCambioFactura = ObjFactura.TipoCambio - Dim importeMovimientoDev = ObjFactura.Total - importeMovimientoDev = If(ObjFactura.SaldoVentaDevolucion < importeMovimientoDev, ObjFactura.SaldoVentaDevolucion, importeMovimientoDev) - If importeMovimientoDev > 0 Then - Dim importeMXDev = importeMovimientoDev * tipoCambio * Multiplicador - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimientoDev.FormatoNumero(2)}" - - If UsaComplementariaClientes AndAlso tipoCambio > 1 Then - importeMXDev = importeMovimientoDev - Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * tipoCambio) - importeMovimientoDev).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then - ErrorPrepoliza = True - Exit For - End If - End If - - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - End If - - If UsaComplementariaClientes AndAlso TipoCambioFactura > 1 Then - importeMXDev = importeMovimientoDev - Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * TipoCambioFactura) - importeMovimientoDev).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementaria, ImporteME:=If(TipoCambioFactura = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=TipoCambioFactura) Then - ErrorPrepoliza = True - Exit For - End If - End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - End If - - If tipoCambio <> TipoCambioFactura Then - Dim difFluctuacion As Decimal = tipoCambio - TipoCambioFactura - 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((importeMovimientoDev * difFluctuacion).RoundSQL) * ValorMultiplicador - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura, CveCuenta:=CveCuenta) Then - ErrorPrepoliza = True - Exit For - 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") - End If - End If - - End If - End If - End If - - End If - - Case 136 'Otros Conceptos Dinamicos - If ObjFactura.DtOtrosConceptos IsNot Nothing Then - For Each row2 As DataRow In ObjFactura.DtOtrosConceptos.Rows - If row2("Importe").ToString().ToDecimal > 0 Then - - importeMovimiento = (row2("Importe").ToString().ToDecimal * ValorMultiplicador) - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If row2("IdCtaContable").ToString().ToEntero > 0 Then - IdCtaContable = row2("IdCtaContable").ToString().ToEntero - Else - If ObjConta.GetRetCuenta(row2("CveConceptoContable").ToString().ToEntero, ObjFactura.CveCliente) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContFondoGarantia").ToString.ToEntero - End If - End If - End If - - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, If(row2("TipoMovto").ToString = "True", True, False), importeMovimiento, Referencia, row2("CveConceptoContable").ToString().ToEntero, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - End If - - End If - Next - End If - - importeMovimiento = 0 - - Case 11 'Anticipo - - '[IPP] SI ES REFACTURACION LOS ANTICIPOS NO LOS DEBE APLICAR EN EL INGRESO REFACTURADO (VIEJO) - If NuevaFactura = 1 And ObjFactura.CveVenta = CveDevolucion Then - Exit Select - End If - - If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso ValorMultiplicador = -1 Then - For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows - If row2("CveConceptoContable").ToString().ToEntero = 11 Then - importeMovimiento = row2("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - CveIEAnticipo = -1 - IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos - CveSubProyectoContabilizar = CveSubProyectoVenta - - Dim CveVenta As Integer = ObjFactura.CveVenta - Dim CveVentaAmortizacion As Integer = row2("CveVenta").ToString().ToEntero - - 'SI ES FACTURA EN 0 Y TIENE ANTICIPOS - If (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing")) AndAlso row2("TipoDocto").ToString() = "Ant" Then - CveVenta = row2("CveVenta").ToString().ToEntero - CveVentaAmortizacion = ObjFactura.CveVenta - End If - - 'SI ES EGRESO Y TIENE ANTICIPOS VINCULADOS - If (ObjFactura.TipoDocto.Contiene("Egs") AndAlso row2("TipoDocto").ToString() = "Ant" AndAlso EsNCAmortizacion) Then - CveVenta = row2("CveVenta").ToString().ToEntero - CveVentaAmortizacion = ObjFactura.CveVenta - End If - - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, - CveVenta:=CveVenta, CveVentaAmortizacion:=CveVentaAmortizacion, CveCliente:=ObjFactura.CveCliente, - CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, - CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - Exit For - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - - End If - Next - End If - - If ValorMultiplicador = 1 Then - 'cuando es anticipo - ' cuando es amortización de nota de crédito, y es la nc - ' cuando es amortización por descuento, y es el ingreso - ' cuando es amortización en cero - If (ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse - ObjFactura.CveTipoAmortizacionAnticipo = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse - ObjFactura.CveTipoAmortizacionAnticipo = 3) Then - For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows - If row2("CveConceptoContable").ToString().ToEntero = 11 Then - CveIEAnticipo = -1 - importeMovimiento = row2("Importe").ToString().ToDecimal() - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos - CveSubProyectoContabilizar = CveSubProyectoVenta - - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, - CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, - ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, - CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - End If - Next - End If - End If - - 'Cuando la funcionalidad de amortizacion en PS esta activa - If Not ErrorPrepoliza Then - DT = TmpDTDetalle.FiltraParametros($"CvePS = {ObjFactura.CvePSAmortizacion}") - If DT.Rows.Count > 0 Then - For Each Row2 As DataRow In DT.Rows - importeMovimiento = Math.Abs(Row2("PU").ToString.ToDecimal) - IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, - ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, - CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, - CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, - ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, - CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - Next - End If - End If - - 'PorcentajeAmortizacion = sumaAmorticaciones / TxtTotal.Text.ToDecimal - importeMovimiento = 0 - - Case 91 'Amortizacion Nota de Credito - Dim Contabilizable = If(UsuarioActual.CveEmpresa = 119, False, True) - - If ValorMultiplicador = -1 Then - 'cuando es cancelación - If ObjFactura.DtNCVinculadas IsNot Nothing Then - For Each row2 As DataRow In ObjFactura.DtNCVinculadas.Rows - - If row2("CveConceptoContable").ToString().ToEntero = 91 Then - - importeMovimiento = (row2("Importe").ToString().ToDecimal * ValorMultiplicador) - sumaAmorticaciones += importeMovimiento - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - 'CTACONTABLE - 'IdCtaContable = IdCtaContAnticipos - 'CveCuenta = CveCuentaAnticipos - - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - Else - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - End If - - CveSubProyectoContabilizar = CveSubProyectoVenta - - If importeMovimiento <> 0 Then - - Dim Importe91 As Decimal = 0 - Dim ImporteMN91 As Decimal = 0 - Dim Importe251 As Decimal = 0 - Dim ImporteMN251 As Decimal = 0 - - If ObjFactura.CveMoneda = 1 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = row2("Importe").ToString.ToDecimal - Importe91 = row2("Importe").ToString.ToDecimal - ImporteMN91 = row2("Importe").ToString.ToDecimal - tipoCambio = 1 - ElseIf ObjFactura.CveMoneda = 2 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = row2("Importe").ToString.ToDecimal - Importe91 = row2("Importe").ToString.ToDecimal - ImporteMN91 = row2("Importe").ToString.ToDecimal * tipoCambio - ElseIf ObjFactura.CveMoneda = 2 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = row2("Importe").ToString.ToDecimal - Importe91 = row2("Importe").ToString.ToDecimal - ImporteMN91 = row2("Importe").ToString.ToDecimal * tipoCambio - ElseIf ObjFactura.CveMoneda = 1 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - - Importe91 = row2("Importe").ToString.ToDecimal / tipoCambio - ImporteMN91 = row2("Importe").ToString.ToDecimal - End If - - Dim TCFluctuacion As Decimal = row2("TCCambioValuacion").ToString.ToDecimal - - If TCFluctuacion = 1 AndAlso tipoCambio > 1 Then - TCFluctuacion = GlobalTipoCambio(ObjFactura.Fecha).ToDecimal - End If - - If ObjFactura.CveMoneda = 2 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - ImporteMN251 = row2("Importe").ToString.ToDecimal * TCFluctuacion - ElseIf ObjFactura.CveMoneda = 2 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - ImporteMN251 = row2("Importe").ToString.ToDecimal * TCFluctuacion - ElseIf ObjFactura.CveMoneda = 1 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = row2("Importe").ToString.ToDecimal / TCFluctuacion - ImporteMN251 = row2("Importe").ToString.ToDecimal - Else - ImporteMN251 = row2("Importe").ToString.ToDecimal - End If - - Importe251 = (Importe251 * Multiplicador * ValorMultiplicador).RoundSQL - ImporteMN251 = ImporteMN251 * ValorMultiplicador - Importe91 = (Importe91 * ValorMultiplicador).RoundSQL - ImporteMN91 = (ImporteMN91 * Multiplicador * ValorMultiplicador).RoundSQL - - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}" - - Dim CveUltimaVenta = row2("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, ObjFactura.Cliente.IdCtaContComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=row2("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:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then - ErrorPrepoliza = True - Exit For - End If - - - If UsaComplementariaClientes = True AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then - ImporteMN251 = Importe251 - Dim ImporteComplementarioNC As Decimal = ((Importe251 * row2("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContComplementaria, -1, CveVenta:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(row2("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=row2("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:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(row2("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=row2("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then - ErrorPrepoliza = True - Exit For - End If - - 'CONSIDERO FLUCTUACIÓN. - If tipoCambio <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso tipoCambio > 1 Then - Dim difFluctuacion As Decimal = tipoCambio - 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) * ValorMultiplicador - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=row2("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then - ErrorPrepoliza = True - Exit For - End If - End If - - End If - End If - Next - End If - Else - If ObjFactura.DtAnticipos IsNot Nothing Then - For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows - - If row2("CveConceptoContable").ToString().ToEntero = 12 Then - importeMovimiento = row2("Importe").ToString().ToDecimal() - sumaAmorticaciones += importeMovimiento - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos - CveSubProyectoContabilizar = CveSubProyectoVenta - - If importeMovimiento <> 0 Then - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, - ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, - CveVenta:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, - CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, - ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, - CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then - ErrorPrepoliza = True - End If - End If - - End If - - Next - End If - If sumaAmorticaciones <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, - ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - - End If - importeMovimiento = 0 - - Case 4 'Venta Clasificacion - If Not ObjFactura.TipoDocto.Contiene("Rem", "Ant", "Egs", "Dev", "RNC") Then - - Dim ConceptoContableAplicar = 4 - Dim CveVentaAplicar = ObjFactura.CveVenta - Dim CveVentaAmortizacionAplicar = -1 - - If ObjFactura.TipoDocto.Contiene("Egs") And ObjFactura.TipoDocto = "Ant" And CveDevolucion > 0 And NuevaFactura = 1 Then - ConceptoContableAplicar = 11 - CveVentaAplicar = CveDevolucion - CveVentaAmortizacionAplicar = ObjFactura.CveVenta - End If - - 'código fijo en base el porcentaje iva, que se afecten las clasificaciones - For i = 0 To TmpDTDetalle.Rows.Count - 1 - - 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso - If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933") Then - - 'reclasifica la clasificación del producto, por la del ingreso correspondiente a su iva - If ObjFactura.GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = ObjFactura.GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal).Rows(0)("CveClasificacion").ToString - End If - - End If - - Next - - DT = TmpDTDetalle.FiltraParametros($"CvePS <> {ObjFactura.CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"}) - - If DT.Rows.Count > 0 Then - 'Se agrega movimiento separado por la cuenta de ventas (ER) - For Each Row2 As DataRow In DT.Rows - importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas - If ObjFactura.TipoDocto.Contiene("Egs") Then - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - End If - - - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - - If importeMovimiento <> 0 Then - - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - idCuentaContabilizacion = 0 - End If - - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - Next - End If - End If - - importeMovimiento = 0 - Case 150 'Descuento sobre ventas - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then - - Dim ConceptoContableAplicar = 150 - Dim CveVentaAplicar = ObjFactura.CveVenta - Dim CveVentaAmortizacionAplicar = -1 - - If ObjFactura.TipoDocto.Contiene("Egs") And ObjFactura.CveAnticipo > 0 Then - ConceptoContableAplicar = 11 - CveVentaAplicar = ObjFactura.CveAnticipo - CveVentaAmortizacionAplicar = ObjFactura.CveVenta - End If - - If UsuarioActual.CveEmpresa = 119 Then - - 'código fijo en base el porcentaje iva, que se afecten las clasificaciones - For i = 0 To TmpDTDetalle.Rows.Count - 1 - - 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso - If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "20242") Then - - If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString - End If - - End If - - Next - - End If - - DT = TmpDTDetalle.FiltraParametros($"CvePS <> {ObjFactura.CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"}) - - If DT.Rows.Count > 0 Then - 'Se agrega movimiento separado por la cuenta de ventas (ER) - For Each Row2 As DataRow In DT.Rows - importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) - - 'If ObjFactura.TipoDocto = "Egs" Then - ' importeMovimiento += (TmpDTDetalle.SUM("ImporteIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador - ' importeMovimiento += (TmpDTDetalle.SUM("ImporteIEPS", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador - ' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador - ' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetISR", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador - 'End If - - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - End If - - If UsuarioActual.CveEmpresa = 119 Then - If Row2("CveClasificacion").ToString = "19930" Then IdCtaContable = 1141 - If Row2("CveClasificacion").ToString = "19929" Then IdCtaContable = 1142 - End If - - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - - If importeMovimiento <> 0 Then - - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - idCuentaContabilizacion = 0 - End If - - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - Next - End If - End If - - importeMovimiento = 0 - Case 103 'Descuento - If ObjFactura.Descuento <> 0 AndAlso Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoAmortizacionAnticipo = -1 Then - - importeMovimiento = ObjFactura.Descuento * ValorMultiplicador - importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - - If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() - 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() - End If - End If - - DT = TmpDTDetalle.FiltraParametros("", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"}) - - If DT.Rows.Count > 0 Then - 'Se agrega movimiento separado por la cuenta de ventas (ER) - For Each Row2 As DataRow In DT.Rows - importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}" - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas - If ObjFactura.TipoDocto.Contiene("Egs") Then - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() - Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() - End If - - If importeMovimiento <> 0 Then - - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) - idCuentaContabilizacion = 0 - End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 103, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=Row2("CveSubProyecto").ToString().ToEntero(), ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - End If - Next - End If - - End If - importeMovimiento = 0 - - 'Case 103 'Descuento - ' 'si se amortiza anticipo por concepto de descuento, no debe de registrar esta partida. - ' If ObjFactura.CveTipoAmortizacionAnticipo <> 1 Then - ' importeMovimiento = (ObjFactura.Descuento * ValorMultiplicador) - ' importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador - ' FechaMovimiento = ObjFactura.FechaPago - ' If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - ' IdCtaContable = 0 - ' End If - - Case 8 'Ret IVA por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion <> 4 Then 'SI NO ES RETENCION DE IVA DE SERVICIOS - importeMovimiento = (ObjFactura.RetIVA * ValorMultiplicador) - importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If ValorMultiplicador = -1 AndAlso ObjFactura.Alfa3 = "DEV" AndAlso ObjFactura.TipoDocto = "Dev" Then - TipoMovimiento = Not TipoMovimiento - ConceptoContable = 62 - importeMovimiento = importeMovimiento * -1 - importeMX = importeMX * -1 - End If - - 'Contabilidad ContPAQ - If ObjFactura.Cliente.IdCtaContRetIVA > 0 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContRetIVA - Else - If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero - End If - End If - End If - - 'Contabilidad SIG - If ObjFactura.Cliente.CveCuentaRetIVA > 0 Then - CveCuenta = ObjFactura.Cliente.CveCuentaRetIVA - Else - If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - End If - - Case 313 'Ret Iva Servicios - If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion = 4 Then 'SI TIENE RETENCION DE IVA DE SERVICIOS - importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador - importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If ValorMultiplicador = -1 AndAlso ObjFactura.Alfa3 = "DEV" AndAlso ObjFactura.TipoDocto = "Dev" Then - TipoMovimiento = Not TipoMovimiento - ConceptoContable = 314 - importeMovimiento = importeMovimiento * -1 - importeMX = importeMX * -1 - End If - - 'OBTENER CUENTAS - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - 'Conta ContPAQ - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero - End If - End If - - End If - - Case 9 'Ret ISR por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then - importeMovimiento = (ObjFactura.RetISR * ValorMultiplicador) - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If ValorMultiplicador = -1 AndAlso ObjFactura.Alfa3 = "DEV" AndAlso ObjFactura.TipoDocto = "Dev" Then - TipoMovimiento = Not TipoMovimiento - ConceptoContable = 63 - importeMovimiento = importeMovimiento * -1 - importeMX = importeMX * -1 - End If - - 'Contabilidad ContPAQ - If ObjFactura.Cliente.IdCtaContRetISR > 0 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContRetISR - Else - If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero - End If - End If - End If - - 'Contabilidad SIG - If ObjFactura.Cliente.CveCuentaRetISR > 0 Then - CveCuenta = ObjFactura.Cliente.CveCuentaRetISR - Else - If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - End If - Case 13 'Iva por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then - importeMovimiento = (ObjFactura.IVA * ValorMultiplicador) - importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) - FechaMovimiento = ObjFactura.FechaPago - PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIVA").ToDecimal - - If ValorMultiplicador = -1 AndAlso ObjFactura.Alfa3 = "DEV" AndAlso ObjFactura.TipoDocto = "Dev" Then - TipoMovimiento = Not TipoMovimiento - ConceptoContable = 61 - importeMovimiento = importeMovimiento * -1 - importeMX = importeMX * -1 - - IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - Else - IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - End If - - CveSubProyectoContabilizar = CveSubProyectoVenta - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - End If - - 'If ObjFactura.TipoDocto = "Egs" Then - - ' importeMovimiento = ObjFactura.IVA * ValorMultiplicador - ' importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) - ' FechaMovimiento = ObjFactura.FechaPago - ' PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIVA").ToDecimal - - ' If importeMovimiento <> 0 Then - ' 'IVA X TRASLADAR - ' IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - ' CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - - ' 'IVA PAGADO - ' IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - ' CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - ' End If - - - ' importeMovimiento = 0 - ' importeMX = 0 - 'End If - - - Case 38 'IEPS por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then - importeMovimiento = (ObjFactura.IEPS * ValorMultiplicador) - importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) - FechaMovimiento = ObjFactura.Fecha - CveSubProyectoContabilizar = CveSubProyectoVenta - - If ValorMultiplicador = -1 AndAlso ObjFactura.Alfa3 = "DEV" AndAlso ObjFactura.TipoDocto = "Dev" Then - TipoMovimiento = Not TipoMovimiento - ConceptoContable = 39 - importeMovimiento = importeMovimiento * -1 - importeMX = importeMX * -1 - - If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString().ToEntero() - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString().ToEntero() - End If - End If - Else - If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString().ToEntero() - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString().ToEntero() - End If - End If - End If - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - 'If importeMovimiento <> 0 AndAlso ObjFactura.TipoDocto = "Egs" Then - ' 'IEPS X TRASLADAR - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - - ' 'IEPS PAGADO - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - - ' importeMovimiento = 0 - ' importeMX = 0 - 'End If - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - End If - - - Case 30 'PAGO - BANCOS - If ObjFactura.DtPagos IsNot Nothing AndAlso ObjFactura.DtPagos.Rows.Count > 0 Then - - For Each DrPago As DataRow In ObjFactura.DtPagos.Rows - CveIEPago = -1 - - FolioIE = -1 - FolioIE = ObjBancos.GetNextFolio(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero) - If Not FolioIE > 0 Then - ErrorPrepoliza = True - Exit For - End If - - CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero, Fecha, FolioIE.ToString, String.Format("PAGO: {0}", ObjFactura.Folio), DrPago("Importe").ToString.ToDouble, ObjFactura.CveMoneda, tipoCambio, DrPago("Observaciones").ToString, "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte) - - If CveIEPago > 0 Then - - importeMovimiento = DrPago("Importe").ToString.ToDecimal * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - IdCtaContable = 0 - CveCuenta = 0 - CveSubProyectoContabilizar = CveSubProyectoVenta - Dim PorcentajeImpuestoPago As Decimal = TmpDTDetalle.MAX("PorcentajeIVA").ToDecimal - - - If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count = 1 Then - IdCtaContable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("IdCtaContable").ToString.ToEntero - ' CveCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("IdCtaContableSIG").ToString.ToEntero - End If - - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("NumCuentaMoneda").ToString.ToEntero) - idCuentaContabilizacion = 0 - End If - - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("NumCuentaMoneda").ToString.ToEntero) - ' CveCuentaContabilizacion = 0 - 'End If - - 'BANCOS - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then - ErrorPrepoliza = True - Exit For - End If - - 'CLIENTES - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - End If - - 'IVA X TRASLADAR - IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then - ErrorPrepoliza = True - Exit For - End If - - 'IVA PAGADO - IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then - ErrorPrepoliza = True - Exit For - End If - - 'IEPS X TRASLADAR - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - End If - - 'IEPS PAGADO - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSTrasladado, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - Exit For - End If - - Else - ErrorPrepoliza = True - Exit For - End If - - Next - - importeMovimiento = 0 - End If - - End Select - - If importeMovimiento <> 0 And Not ErrorPrepoliza Then - - If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - idCuentaContabilizacion = 0 - End If - - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=tipoCambio, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - Else - ObjFactura.SeGuardoPrePoliza = True - End If - - End If - - If ErrorPrepoliza Then - Exit For - End If - - Next - - End If - - If ObjFactura.RemisionesLista.Count = 0 AndAlso (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) Then - For Each Row As DataRow In DtRemisionesRelacionadas.Rows - ObjFactura.RemisionesLista.Add(Row("CveVenta").ToString().ToEntero()) - Next - End If - - 'SI ES FACTURACION DE UNA REMISION CANCELAMOS, TRASPASAMOS SALDOS Y AGREGAMOS EVENTO A LA BITACORA - 'NO DEBE ENTRAR SI SE ESTA CANCELANDO UNA FACTURA - If ValorMultiplicador <> -1 AndAlso ((DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0) Then - - If Not ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then - ErrorPrepoliza = True - ErrorList.Add("No se pueden facturar las remisiones, con ese tipo de comprobante seleccionado") - Else - If ObjFactura.RemisionesLista.Count > 0 Then - For Each CveRemision As Integer In RemisionesLista - If Not ObjConta.TraspasarSaldosRemision(CveRemision, ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then - ErrorPrepoliza = True - End If - - 'Factura - If Not ObjEventos.AddEventoBitacora($"Remisión facturada: Folio Factura", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then - ErrorPrepoliza = True - End If - - 'Remision - If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then - ErrorPrepoliza = True - End If - - If ErrorPrepoliza Then - Exit For - End If - Next - End If - End If - End If - - If DtRemisionesRelacionadas Is Nothing Then - If ObjVentas.GetRemisionesRelacionadas(ObjFactura.CveVenta, ObjFactura.TipoDocto) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - DtRemisionesRelacionadas = ObjVentas.DtResultados.Copy() - End If - End If - - 'REGRESA SALDO A LAS REMISIONES QUE SE FACTURARON EN EL INGRESO QUE SE ESTA CANCELANDO - 'SE DEBE DE EXCLUIR CUANDO ES REFACTURACIÓN - If ObjFactura.TipoDocto = "Ing" And ValorMultiplicador = -1 AndAlso CveEstatusRefacturacion = 0 AndAlso Not SeCancelaRemisionProceso AndAlso DtRemisionesRelacionadas IsNot Nothing Then ' se debe de excluir cuando es refacturación - For Each Dr As DataRow In DtRemisionesRelacionadas.Rows - - Dim DebeCancelar As Boolean = CancelarRemisiones AndAlso ListaRemisionesCancelar.Any(Function(CveRemision) CveRemision = Dr("CveVenta").ToString.ToEntero()) - - If Not DebeCancelar Then - If Not ObjConta.TraspasarSaldosRemision(Dr("CveVenta").ToString.ToEntero, ObjFactura.CvePrePoliza, ObjFactura.CveVenta, 1) Then - ErrorPrepoliza = True - End If - If Not ObjEventos.AddEventoBitacora($"Facturación cancelada en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Dr("CveVenta").ToString.ToEntero) Then - ErrorPrepoliza = True - End If - End If - Next - End If - - - If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - If ObjConta.ValorPolizaDescuadre = 2 Then - ErrorList.Add(ObjConta.MensajePolizaDescuadre) - ErrorPrepoliza = True - GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas") - End If - End If - End If - - 'Simplificacion de PrePolizas - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - If Not ObjConta.PrePolizaSimplificacion(ObjFactura.CvePrePoliza, UsuarioActual.CveEmpresa) Then - ErrorList.Add("No se pudo simplificar los movimientos") - ErrorPrepoliza = True - End If - End If - - 'ContPAQ El movimiento 1 es el de Venta - Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" - - If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "NC") Then - AutoConta = False - End If - - If AutoConta Then - If idCuentaContabilizacion > 0 Then - If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=objContPaqi) Then - ErrorList.Add("Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico") - 'ErrorPrepoliza = True - End If - Else - ErrorList.Add(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas)) - 'ErrorPrepoliza = True - End If - End If - - Catch ex As Exception - GuardaLog("Model.Proceso.PreP-" & ex.ToString()) - ErrorPrepoliza = True - End Try - Return ErrorPrepoliza - End Function - - Private Function GuardaRecepcionUsados(ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad) As Boolean - Dim OcurrioError As Boolean = False - If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") AndAlso (DtRecepcionUsados IsNot Nothing Or DtAjustes IsNot Nothing) Then - If factura.CveAlmacenRecepcionUsados > 0 Then - Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(factura.CveAlmacenRecepcionUsados, 2, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Mod/E") - - Dim DtTemporal As DataTable = Nothing - Dim DtTemporalMovimientosDetalle As DataTable = Nothing - Dim EsUsado As Boolean = False - If DtRecepcionUsados IsNot Nothing AndAlso DtRecepcionUsados.Rows.Count > 0 Then - DtTemporal = DtRecepcionUsados.Copy - EsUsado = True - ElseIf DtAjustes IsNot Nothing AndAlso DtAjustes.Rows.Count > 0 Then - DtTemporal = DtAjustes.Copy - If factura.Inv_CveMovimiento > 0 Then - If ObjInventario.GetMovimientosDetalle(factura.Inv_CveMovimiento, UsuarioActual.CveEmpresa) Then - DtTemporalMovimientosDetalle = ObjInventario.DtResultados - End If - End If - End If - - If DtTemporal IsNot Nothing Then - For Each Dr As DataRow In DtTemporal.Rows - Dim CveProducto As Integer = Dr("CvePS").ToString.ToEntero - Dim CveUnidad As Integer = Dr("CveUM").ToString.ToEntero - Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble - Dim PU As Decimal = 0 - If CveProducto > 0 Then - - If EsUsado Then - PU = Dr("PU").ToString.ToDecimal - Else - If DtTemporalMovimientosDetalle IsNot Nothing AndAlso DtTemporalMovimientosDetalle.FiltraParametros($"CvePS = {CveProducto}").Rows.Count > 0 Then - PU = DtTemporalMovimientosDetalle.FiltraParametros($"CvePS = {CveProducto}").Rows(0)("PU").ToString.ToDecimal - End If - End If - - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - OcurrioError = True - ErrorList.Add("Ocurrió un error al agregar los Movimientos de entrada al Inventario.
    ") - Exit For - End If - Else - OcurrioError = True - ErrorList.Add("Ocurrió un error al agregar los Movimientos de entrada al Inventario.
    ") - Exit For - End If - - Next - End If - End If - End If - Return OcurrioError - End Function - - Private Function GuardarVentaInventarios(ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean - Dim OcurrioError As Boolean = False - - If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then - If factura.CveAlmacen > 0 AndAlso DtInventario.Rows.Count > 0 Then - Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(factura.CveAlmacen, 3, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Mod/E") - - If CveMovimientoInventario <= 0 Then - OcurrioError = True - ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - Else - Dim Mensaje As String = "" - Dim i As Integer = 0 - Dim Cantidad As Double - Dim CveUnidad As Integer - Dim CveProducto As Integer - Dim Existencia As Double - 'Dim Pu As Double - 'DtInv.Clone() - - Dim DtEquivalencias As DataTable - For Each Dr As DataRow In DtInventario.Rows - CveProducto = Dr("CvePS").ToString.ToEntero - CveUnidad = Dr("CveUM").ToString.ToEntero - Cantidad = Dr("Cantidad").ToString.ToDouble - - If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("Serie").ToString = "" Then - OcurrioError = True - ErrorList.Add("Se deben especificar las Series de los productos de almacén") - Exit For - End If - - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso factura.TipoDocto.Contiene("Rem", "Ing") Then - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=factura.CveSubProyecto, CveVendedor:=factura.CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) - If Existencia < Cantidad Then - OcurrioError = True - ErrorList.Add($"No cuenta con la cantidad suficiente en inventario del producto {Dr("CodigoPS")} .Cuenta con {Existencia.FormatoNumero(2)}.") - Exit For - End If - End If - - If UsuarioActual.CveEmpresa = 1 Then - DtEquivalencias = New DataTable - DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) - Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero - Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'") - - 'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE) - If CveUnidadBase <> CveUnidad Then - ' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA - Cantidad = Dr("Cantidad").ToString.ToDouble * drUMBase("Cantidad").ToString.ToDouble / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDouble - CveUnidad = CveUnidadBase - End If - End If - - If CveProducto > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, 0, -1, Serie:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - OcurrioError = True - ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
    ") - Exit For - End If - Else - OcurrioError = True - ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
    ") - Exit For - End If - - - i = i + 1 - Next - - 'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN - If Not OcurrioError Then - Dim DtCostos As DataTable = Nothing - Dim ValorInventario As Decimal = 0 - Dim TotalCosto As Decimal = 0 - If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then - DtCostos = ObjInventario.DtResultados - TotalCosto = DtCostos.SUMD("Total").RoundSQL() - Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) - Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 - If tmpCostos.Rows.Count > 0 Then - Dim TotalCostoAcumulado As Decimal = 0 - Dim cont As Integer = 1 - 'Se agrega movimiento separado por la cuenta de ventas (ER) - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL() - TotalCostoAcumulado += ValorInventario - - 'cuando es el último movimiento y hay diferencias en los importes - If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then - ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado) - End If - - 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString, Row2("SubProyecto").ToString) - IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - If ValorInventario <> 0 Then - - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then - OcurrioError = True - End If - End If - cont += 1 - Next - End If - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero - - If TotalCosto <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, True, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then - OcurrioError = True - End If - End If - - factura.Inv_CveMovimiento = CveMovimientoInventario - factura.Inv_ValorInventario = ValorInventario - - End If - End If - - - End If - - If RemisionesLista.Count > 0 Then - For Each CveRemision As Integer In RemisionesLista - 'El almacen general es el Primer Almacen de Material en la Sucursal - If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then - OcurrioError = True - Exit For - End If - Next - End If - End If - - End If - - Return OcurrioError - End Function - Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable - Dim MovDTCuadrados As New DataTable - MovDTCuadrados = MovDetalle.Clone - MovDTCuadrados.Clear() - - 'Llenamos el DT solo si es primera llamada - If DtRemConceptosSurtidos Is Nothing Then - DtRemConceptosSurtidos = New DataTable - DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer)) - DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal)) - DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal)) - - For Each dr As DataRow In DtRemisiones.Rows - Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow - dtr("CveVentaDetalle") = dr("CveVentaDetalle") - dtr("Cantidad") = dr("Cantidad") - dtr("Surtido") = 0 - DtRemConceptosSurtidos.Rows.Add(dtr) - Next - End If - - For Each dr As DataRow In MovDetalle.Rows - Dim rowSurtidos As DataRow = DtRemConceptosSurtidos.FiltroPrimero($"CveVentaDetalle={dr("CveVentaDetalle")}") - Dim rowSurtidosP As DataRow = DtRemConceptosSurtidos.Select($"CveVentaDetalle={dr("CveVentaDetalle")}").FirstOrDefault() - Dim Indice As Integer = DtRemConceptosSurtidos.Rows.IndexOf(rowSurtidosP) - - 'Si no se ha terminado de surtir agregamos el movimiento - If Indice >= 0 Then - ' rowSurtidos("Surtido").ToString.ToDouble < rowSurtidos("Cantidad").ToString.ToDouble AndAlso (dr("CantidadDisponible").ToString.ToDouble - rowSurtidos("Surtido").ToString.ToDouble > 0 Or dr("Serie").ToString <> "") - If rowSurtidos("Surtido").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDecimal Then - Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDouble, dr("CantidadDisponible").ToString.ToDecimal, rowSurtidos("Cantidad").ToString.ToDecimal) - MovDTCuadrados.ImportRow(dr) - MovDTCuadrados(MovDTCuadrados.Rows.Count - 1)("Cantidad") = CantidadSurtida - DtRemConceptosSurtidos(Indice)("Surtido") = rowSurtidos("Surtido").ToString.ToDecimal + CantidadSurtida - End If - Else - ErrorList.Add("Ocurrió un error al traspasar el inventario de la remisión") - Exit For - End If - Next - - Return MovDTCuadrados - End Function - Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean - Dim OcurrioError As Boolean = False - Dim DtMovimientos As DataTable - Dim DtMovimientosDetalles As DataTable - DtRemConceptosSurtidos = Nothing - - 'Obtenemos los movimientos detalle - If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then - - If ObjInventario.DtResultados.Rows.Count > 0 Then - - DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"}) - - 'Si estamos facturando remisiones ajustamos por ventadetalle - If RemisionesLista.Count > 0 Then - Dim resultados = From DtRemisiones In DtRemisiones - Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero - Select DtMovDet - Try - DtMovimientosDetalles = resultados.CopyToDataTable - Catch ex As Exception - GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisiones.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count}") - DtMovimientosDetalles = New DataTable - End Try - Else - DtMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0") - End If - - For Each dr As DataRow In DtMovimientos.Rows - 'Obtenemos los Movimientos de salida - If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then - - If ObjInventario.DtResultados.Rows.Count > 0 AndAlso DtMovimientosDetalles.Rows.Count > 0 Then - - Dim CveAlmacenSalida As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero - Dim CveAlmacenEntrada As Integer = ObjInventario.DtResultados(0)("CveAlmacenRelacionado").ToString.ToEntero - Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero - Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados(0)("CveTipoAlmacen").ToString.ToEntero - - If (CveAlmacenEntrada > 0 AndAlso CveTipoAlmacen <> 1) Or RemisionesLista.Count = 0 Then 'Con remisiones parciales ignoramos las surtidas ya realizadas - - Dim MovDetalle As New DataTable - If RemisionesLista.Count > 0 Then - MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND TieneSalidaxFactura IS NULL")) - Else - MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}") - End If - - If ErrorList.Count = 0 Then - If MovDetalle.Rows.Count > 0 Then - Dim CveMovimientoSalidaPorTraspaso = -1 - - 'Le damos salida de apartado por traspaso - CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision) - If Not CveMovimientoSalidaPorTraspaso > 0 Then - OcurrioError = True - Exit For - End If - - 'Le damos entrada al general por traspaso - If Not OcurrioError Then - If Not GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso) > 0 Then - OcurrioError = True - Exit For - End If - End If - - If Not OcurrioError Then - If ConSalida Then - 'Le damos salida normal - If Not GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 3, CveMoneda, Me.CveVenta, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0 Then - OcurrioError = True - Exit For - End If - End If - End If - End If - Else - OcurrioError = True - End If - - MovDetalle.Dispose() - End If - - End If - - ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then - - 'Esquema viejo, evitamos que aparezca por surtir - If Not ObjInventario.ActualizarEsDevolucionVenta(Me.CveVenta, 2) Then - OcurrioError = True - Exit For - End If - - End If - Next - - End If - - End If - - Return Not OcurrioError - End Function - Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = False, Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1) As Integer - Dim OcurrioError As Boolean = False - Dim ContadorMovtosDetalles = 0 - - 'Creamos el movimiento - Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, ConceptoEntrada, CveMoneda, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoRelacionado) - - If CveMovimientoInventario > 0 Then - - 'Agregamos los detalles - For Each MovDet As DataRow In DtMovDetalle.Rows - - Dim Cantidad = 0.0 - Dim CantidadRemision = DtRemisiones.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleRemision={MovDet("CveVentaDetalle").ToString}").ToDouble - Dim CantidadInventario = MovDet("Cantidad").ToString.ToDecimal - - If RemisionesLista.Count > 0 AndAlso CantidadInventario >= CantidadRemision Then - Cantidad = CantidadRemision - Else - Cantidad = CantidadInventario - End If - - Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero - Dim PU As Decimal = MovDet("PU").ToString.ToDecimal - Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim Serie As String = MovDet("Serie").ToString - Dim Consec As Integer = DtRemisiones.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString}").ToEntero - - 'COMIENZA: VENTADETALLE - 'CUANDO SEA SALIDA VA POR LA VENTA DETALLE DE LA FACTURA DE LA REMISION - OJO!! SOLO FUNCIONA HASTA ORITA QUE SE HACE SALIDA SOLO CUANDO SE FACTURA LA REMISION - Dim CveVentaDetalle = If(ConceptoEntrada.Contiene(3, 40), DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero, MovDet("CveVentaDetalle").ToString.ToEntero) - 'CUANDO LA VENTADETALLE NO TENGA VALOR DEBE MARCAR ERROR, NUEVA RESTRICCION DE ALMACEN - If CveVentaDetalle < 0 Then - OcurrioError = True - Exit For - End If - 'TERMINA: VENTADETALLE - - If Cantidad < 0 Then - ErrorList.Add("Ocurrió un Error al generar los movimientos de almacén. Por favor comuniquese con atención SIG.") - OcurrioError = True - Exit For - End If - - If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then - ContadorMovtosDetalles += 1 - Else - OcurrioError = True - Exit For - End If - Next - - 'Agregamos las PrePolizas - If Not OcurrioError Then - If MovimientoPrePoliza AndAlso CveMovimientoInventario > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - Dim DtCostos = ObjInventario.DtResultados.Copy - Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}) - Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 - Dim ValorInventario As Decimal - - For Each RowInv As DataRow In DtCostosDistinct.Rows - ValorInventario = DtCostos.SUM("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).ToString.ToDecimal - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - Try - If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(Me.CvePrePoliza, False, ValorInventario, Me.SerieFolio, 69, Me.SerieFolio, Me.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=Me.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=Me.CveSubProyecto) Then - OcurrioError = True - Exit For - End If - End If - Catch ex As Exception - OcurrioError = True - End Try - Next - - If Not OcurrioError Then - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero - ValorInventario = Math.Round(DtCostos.SUM("Total", "").ToDecimal, 2, MidpointRounding.AwayFromZero) - If Not ObjConta.AddPrePolizasDetalle(Me.CvePrePoliza, True, ValorInventario, Me.SerieFolio, 68, Me.SerieFolio, Me.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=Me.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=Me.CveSubProyecto) Then - OcurrioError = True - End If - End If - Else - OcurrioError = True - End If - End If - End If - - - 'VALIDA QUE SE HALLAN AGREGADO DETALLES AL MOVIMIENTO - If ContadorMovtosDetalles = 0 Then - OcurrioError = True - End If - - Else - OcurrioError = True - End If - - - - If OcurrioError Then - Return -1 - Else - Return CveMovimientoInventario - End If - 'Return Not OcurrioError - - End Function - Private Sub GuardarVentaEstimaciones(ByRef factura As Modelos.Factura, ObjContr As ClsContratos) - 'debe de ser por contrato el movimiento - If factura.CveContratoSecciones.Length > 0 Then - If Not ObjContr.AddEstimaciones(CveContrato, factura.Fecha, -1, factura.CveVenta, CveContratoSecciones, factura.CveUsuario, factura.CveEmpresa) Then - ErrorList.Add("Ocurrió un error al agregar la estimación a la Factura.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - End If - End If - End Sub - Private Sub GuardarVentaAC(ByRef factura As Modelos.Factura, ObjVentas As ClsVentas, Msgok As StringBuilder, ObjAC As ClsContPAQi) - If UsuarioActual.Empresa.UsaAC Then - - If factura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then - - 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(factura, ObjAC) - - If IDPoliza.IdPoliza > 0 Then - - If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, factura.CvePrePoliza, factura.CveVenta, factura.CveEmpresa) Then - - 'Si se facturó la cotización hay que vincular la venta - Msgok.AppendFormat("Abono Registrado Correctamente.

    Ver Poliza", IDPoliza) - End If - Else - ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - End If - - Else - Msgok.Append("Movimiento Registrado Correctamente.

    ") - End If - - End If - End Sub - Private Function GuardarVentaImpuestosLocales(factura As Modelos.Factura, ObjVentas As ClsVentas, ObjConta As ClsContabilidad, Optional ValorMultiplicador As Integer = 1) As Boolean - Dim ErrorPrepoliza As Boolean = False - - If factura.DtImpuestosLocales IsNot Nothing AndAlso factura.CvePrePoliza > 0 AndAlso Not factura.TipoDocto.Contiene("Cot", "Rem") Then - - Dim Importe As Decimal - Dim IdCtaContable, CveCuenta As Integer - Dim Concepto As String - Dim tipoCambio As Decimal - Dim CveSubProyectoContabilizar As Integer = factura.CveSubProyecto - - For Each RowIL As DataRow In factura.DtImpuestosLocales.Rows - If RowIL("TipoImpuesto").ToString.ToEntero > 0 Then - - Importe = RowIL("Importe").ToString.ToDecimal * ValorMultiplicador - IdCtaContable = RowIL("IdCtaContable").ToString.ToEntero - CveCuenta = RowIL("IdCtaContable").ToString.ToEntero - Concepto = factura.SerieFolio - - If factura.CveMoneda = 2 AndAlso factura.TipoCambio > 0 Then - tipoCambio = factura.TipoCambio - ElseIf factura.CveMoneda = 2 AndAlso factura.TipoCambio <= 1 Then - tipoCambio = GlobalTipoCambio(factura.Fecha).ToString.ToDecimal - Else - tipoCambio = 1 - End If - - Select Case RowIL("TipoImpuesto").ToString - Case "1" - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, Importe, Concepto, 27, Concepto, factura.Fecha, IdCtaContable:=IdCtaContable, IdSegmentoNegocio:=-1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, ImporteMX:=Importe * tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - - Case "3" - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, Importe, Concepto, 116, Concepto, factura.Fecha, IdCtaContable:=IdCtaContable, IdSegmentoNegocio:=-1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, ImporteMX:=Importe * tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - Case "4" - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, Importe, Concepto, 58, Concepto, factura.Fecha, IdCtaContable:=IdCtaContable, IdSegmentoNegocio:=-1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, ImporteMX:=Importe * tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - Case "5" - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, True, Importe, Concepto, 27, Concepto, factura.Fecha, IdCtaContable:=IdCtaContable, IdSegmentoNegocio:=-1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, ImporteMX:=Importe * tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - End Select - End If - Next - - End If - - Return ErrorPrepoliza - End Function - Private Function GeneraNC(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ByRef ObjBancos As ClsBancos, ByRef ObjEventos As ClsOIEventos) As List(Of Object) - Dim Obj As New List(Of Object) - Dim CveVentaNueva As Integer = ObjVentas.CveVenta - Dim BanderaGeneraNC As Boolean = False - If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True - Dim CveEstatus As Integer = -1 - - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) - Dim TmpDTconceptos As DataTable = Nothing - Dim CveNCaVincular As Integer = factura.CveNCaVincular - 'CargaCliente - Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero - If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then - Return Nothing - ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then - Return Nothing - End If - factura.TipoDocto = drv("TipoDocto").ToString - factura.Serie = drv("Serie").ToString - factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime - factura.Fecha = drv("Fecha").ToString.ToDateTime - factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero - factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero - factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero - factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero - - 'CargaDetalle - If ObjVentas.GetVentaDetalle(CveVenta) Then - TmpDTconceptos = ObjVentas.DtResultados - TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - End If - - 'Carga Totales - factura.SubTotal = drv("SubTotal").ToString.ToDecimal - factura.Descuento = drv("Descuento").ToString.ToDecimal - factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal - factura.IVA = drv("IVA").ToString.ToDecimal - factura.RetIVA = drv("RetIVA").ToString.ToDecimal - factura.RetISR = drv("RetISR").ToString.ToDecimal - factura.Total = drv("Total").ToString.ToDecimal - factura.MotivoDescuento = drv("MotivoDescuento").ToString - factura.Observaciones = drv("Observaciones").ToString - factura.CveMoneda = drv("CveMoneda").ToString.ToEntero - factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal - factura.CveVendedor = drv("CveVendedor").ToString.ToEntero - factura.RefDocto = drv("Ref").ToString - - If factura.CveCliente > 0 Then - If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then - - If Not drv("Total").ToString.ToDecimal = factura.Total Then - Return Nothing - End If - - If FolioFiscal = "" Then - CveEstatus = 4 - Else - CveEstatus = 5 - End If - - '[IPP] - CANCELA INVENTARIO DE VENTA NUEVA Y NO TRASPASA MOVTOS DE ALMACEN - 'If UsuarioActual.CveEmpresa.Contiene(1) Then - 'QUEMA DOCUMENTO NUEVO - If Not ObjInventario.ActualizarEsDevolucionVenta(CveVentaNueva, 2) Then - Return Nothing - End If - - 'CANCELA PAGOS - If FacturaDevolucion.TipoDocto.Contiene("Ing", "Ant") Then - If Not ObjConta.PrePolizasCancelarPagos(CveDevolucion, Me.CvePrePoliza) Then - Return Nothing - End If - End If - - 'CANCELA FACTURA - If Month(factura.Fecha) = Month(Now) OrElse BanderaGeneraNC = True Then - If CancelarFactura(ObjVentas, ObjConta, ObjContPaq, ObjBancos) Then - Obj.Add(factura) - Else - Return Nothing - End If - Else - FacturaDevolucion.TipoDocto = "Egs" - FacturaDevolucion.Fecha = Now - If RegistrarNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, FacturaDevolucion, ObjBancos, TmpDTconceptos, ObjEventos) Then - Obj.Add(FacturaDevolucion) - Else - Return Nothing - End If - End If - - 'TRASPASA PAGADO - If Not ObjConta.TraspasarSaldosPrePolizas(Me.CveDevolucion, Me.CveVenta, Me.CvePrePoliza) Then - Return Nothing - End If - - If Not ObjInventario.TraspasaEntregaDirectaOCInv(Me.CveVenta, UsuarioActual.CveEmpresa) Then - Return Nothing - End If - - End If - End If - End If - End If - - If Obj.Count > 0 Then - Return Obj - Else - Return Nothing - End If - - End Function - Private Shared Function DecodeBase64(ByVal strXMLCodificado As String) As String - Try - Dim decbuff As Byte() = Convert.FromBase64String(strXMLCodificado) - Return System.Text.Encoding.UTF8.GetString(decbuff) - Catch - Return "" - End Try - End Function - Public Class MCancelacionVentaMensaje - Public Property HuboError As Boolean = False - Public Property TipoMensaje As TipoMensaje - Public Property Mensaje As String - Public Property CveEstatus As Integer - End Class - ''' - ''' Ejecuta los procesos pendientes para concluir la cancelacion de la factura - ''' - ''' - ''' - ''' - ''' - Public Function EjecutarCancelacionPendiente(CveEstatus As Integer, FechaCancelacion As DateTime, AcuseCancelacion As String) As MCancelacionVentaMensaje - Dim ListaRemisionesCancelar As New List(Of Integer) - Dim ObjVentas As New ClsVentas() - If ObjVentas.GetRemisionesXCancelar(Me.CveVenta) Then - For Each Row As DataRow In ObjVentas.DtResultados.Rows - ListaRemisionesCancelar.Add(Row("CveVentaRemision").ToString().ToEntero()) - Next - End If - ObjVentas.Dispose() - - Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion) - End Function - ''' - ''' Cancela la factura para poder realizar la refacturacion - ''' - ''' - Public Function CancelarPorRefacturacion() As MCancelacionVentaMensaje - Return CancelarVenta(Me, Me.UsuarioActual, EsRefacturacion:=True) - End Function - ''' - ''' Cancela la factura y realiza las operaciones correspondientes - ''' - ''' - ''' - ''' - Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing) As MCancelacionVentaMensaje - Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar) - End Function - - Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False, - Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveEstatusFacturaAsignado As Integer = -1, - Optional FechaCancelacion As String = "-1", Optional AcuseCancelacion As String = "") As MCancelacionVentaMensaje - Dim Retorno As New MCancelacionVentaMensaje() - Dim ErrorList As New List(Of String) - - Dim CveVenta As Integer = ObjFactura.CveVenta - - Dim EsRemisionFacturada As Boolean = False - Dim TieneRemisionesRelacionadas As Boolean = False - Dim CancelarRemisiones As Boolean = ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 - - Dim TieneAlmacen As Boolean = False - Dim AplicaRefacturacionConPagos As Boolean = False - - '1 NORMAL, 2 CON PAGOS - Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero() - - If EsRefacturacion AndAlso ModalidadRefacturacion <= 0 Then - Retorno.Mensaje = "La factura no se puede refacturar debido a que la empresa no tiene asignada una modalidad de refacturación." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - If EsRefacturacion AndAlso ModalidadRefacturacion = 2 Then - AplicaRefacturacionConPagos = True - End If - - 'VALIDA QUE LA FACTURA NO TENGA PAGOS - If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then - Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - Dim ObjInv As New ClsInventarios - If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then - TieneAlmacen = ObjInv.DtResultados.Rows.Count > 0 - End If - ObjInv.Dispose() - - 'CARGA AS NOTAS DE CREDITO VINCULADAS - Dim DTDocumentosRelacionados As New DataTable - If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") Then - Dim ObjVentasAntNC As New ClsVentas - If ObjVentasAntNC.GetVentasAntNC(ObjFactura.CveVenta, -1) Then - DTDocumentosRelacionados = ObjVentasAntNC.DtResultados.Copy() - End If - ObjVentasAntNC.Dispose() - End If - - 'LA VALIDACION DE SALDOS CUANDO ES REFACTURACION SE HACE ANTES ASI QUE SI ES REFACTURACION IGNORAMOS ESTA CONDICION, SI ES ANTICIPO VERIFICA QUE NO ESTÉ APLICADO - If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then - Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then - Retorno.Mensaje = "La factura no se puede cancelar debido a que el anticipo ha sido amortizado." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - 'SI LA REMISION ESTA FACTURADA NO SE PUEDE CANCELAR - If ObjFactura.TipoDocto = "Rem" Then - Dim ObjV As New ClsVentas - If ObjV.VerificarRemisionFacturada(ObjFactura.CveVenta) Then - EsRemisionFacturada = ObjV.DtResultados.Rows.Count > 0 - End If - ObjV.Dispose() - - If EsRemisionFacturada Then - Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - End If - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - Dim DtDevRem As New DataTable - If Not EsRefacturacion Then - Dim ObjInventarioTemporal As New ClsInventarios() - If ObjInventarioTemporal.GetDevolucionRemisionesCanceladas(ObjFactura.CveVenta) Then - DtDevRem = ObjInventarioTemporal.DtResultados - Else - ObjInventarioTemporal.Dispose() - - Retorno.Mensaje = "Ocurrió un error al verificar los movimientos de almacén relacionados al documento." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - ObjInventarioTemporal.Dispose() - End If - - 'CARGA REMISIONES - Dim DtRemisionesRelacionadas As New DataTable() - Dim ObjVentasRem As New ClsVentas - If ObjVentasRem.GetRemisionesRelacionadas(ObjFactura.CveVenta, ObjFactura.TipoDocto) Then - DtRemisionesRelacionadas = ObjVentasRem.DtResultados.Copy() - TieneRemisionesRelacionadas = DtRemisionesRelacionadas.Rows.Count > 0 - End If - ObjVentasRem.Dispose() - - 'SI ES REMISION PARA CANCELARLA NO DEBE TENER NINGUNA FACTURADA RELACIONADA - If ObjFactura.TipoDocto.Contiene("Rem") And DtRemisionesRelacionadas.Rows.Count > 0 Then - Retorno.Mensaje = "La remision no debe tener ninguna factura relacionada para poder cancelarla." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - 'CUANDO SE CANCELA, Y TIENE RELACIONADA UNA REMISIÓN, Y ESTA NO SE CANCELARÁ. DEBE DE HACER EN AUTOMÁTICO LOS MOVIMIENTOS AL ALMACEN DE ENTREGA POR ADELANTADO - Dim RevivirRemisiones = Not EsRefacturacion AndAlso ((TieneRemisionesRelacionadas AndAlso ListaRemisionesCancelar Is Nothing) OrElse (DtRemisionesRelacionadas.Rows.Count > ListaRemisionesCancelar.Count)) - - 'REMISION YA SE DEBE HACER POR EL PROCESO DE DEVOLUCION DE ALMACEN - If Not EsRefacturacion AndAlso (ObjFactura.SaldoAlmacen <> 0 AndAlso ObjFactura.EsDevolucionVenta.Contiene(0, 1)) AndAlso Not RealizarDevolucionAlmacen And RevivirRemisiones = False Then - - Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene movimientos de inventario." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - 'VALIDACION DE PEDIDOS: SI ESTA ENTEGADO NO SE PUEDA CANCELAR - If UsuarioActual.CveEmpresa = 72 AndAlso ObjFactura.TipoDocto = "Ped" AndAlso TieneAlmacen AndAlso ObjFactura.SaldoAlmacen <> 0 Then - Retorno.Mensaje = "El pedido no se puede cancelar debido ha que ya fue entregado." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - 'VALIDACION DE PEDIDOS: SI ESTA ENTEGADO NO SE PUEDA CANCELAR - If ObjFactura.TipoDocto = "Pd2" AndAlso TieneAlmacen AndAlso ObjFactura.SaldoAlmacen <> 0 Then - Retorno.Mensaje = "El pedido no se puede cancelar debido ha que ya fue entregado." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - - - Dim CveEstatusRefacturacion As Integer = If(ObjFactura.CveEstatusRefacturacion <= 0, 0, ObjFactura.CveEstatusRefacturacion) - - Dim CancelacionFecha As Date - Dim FolioFiscal As String = ObjFactura.FolioFiscal - Dim CancelacionAcuse As String = "" - Dim MensajeError As String = "" - Dim ObjCancelacion As New Timbrado - Dim TotalT As Decimal = ObjFactura.Total - Dim RFCReceptor As String = ObjFactura.Cliente.RFC - Dim CvePACCancelacion As Integer = ObjFactura.CvePAC - - If CvePACCancelacion <= 0 Then - CvePACCancelacion = UsuarioActual.Empresa.CvePAC - End If - - Dim CveEstatus As Integer = 4 - Dim IDPoliza As Integer = -1 - Dim CvePrePoliza As Integer - Dim CvePlantillaPoliza As Integer - Dim ErrorCancelar As Boolean = False - - Dim Continuar As Boolean = False - Dim ContinuarCancelacion As Boolean = False - Dim ObtenerAcuse As Boolean = False - Dim RequiereAceptacion As Boolean = False - Dim Mensaje As String = "" - - If CveEstatusFacturaAsignado <= 0 Then - Try - If ObjFactura.FolioFiscal <> "" Then - If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then - - 'VERIFICA SI DEBE VALIDAR ANTE EL SAT - If Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then - - Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion) - - If Vigencia IsNot Nothing Then - If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then - Retorno.Mensaje = "Esta factura no es cancelable." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then - ContinuarCancelacion = False - ObtenerAcuse = True - Dim solicitud = New WSGF.Service1SoapClient() - Dim acuse = solicitud.GetAcuse(UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal) - - If acuse.Estado = 0 Then - Dim xmlAcuse = New System.Xml.XmlDocument() - xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64)) - CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")(0).InnerText - CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate() - CveEstatus = 5 - Else - CancelacionFecha = Now.Date - CancelacionAcuse = "" - CveEstatus = 5 - End If - - ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then - - If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then - CveEstatus = 20 - ContinuarCancelacion = False - ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE CON ACEPTACIÓN" Then - CveEstatus = 20 - ContinuarCancelacion = True - RequiereAceptacion = True - ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then - ContinuarCancelacion = True - CveEstatus = 5 - End If - - Else - If Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then - ContinuarCancelacion = True - CveEstatus = 5 - Else - CveEstatus = 20 - ContinuarCancelacion = False - CancelacionFecha = Now.Date - CancelacionAcuse = "" - End If - End If - Else - Retorno.Mensaje = "SAT - No se pudo verificar el estatus de la factura." - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - - Return Retorno - End If - Else - ObtenerAcuse = False - ContinuarCancelacion = True - CancelacionFecha = Now.Date - CancelacionAcuse = "" - - Dim diasTimbrado As Decimal = DateDiff(DateInterval.Day, ObjFactura.FechaCP, Now) - - If ObjFactura.Total < 5000D OrElse diasTimbrado <= 3 OrElse ObjFactura.Cliente.RFC.Contiene("XAXX010101000", "XEXX010101000") Then - RequiereAceptacion = False - End If - - End If - - If Not ObtenerAcuse Then - If ContinuarCancelacion Then - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then - 'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN - If RequiereAceptacion Then - CancelacionFecha = Now.Date - CveEstatus = 20 - Else - CancelacionFecha = ObjCancelacion.CancelacionFecha - CveEstatus = 5 - End If - CancelacionAcuse = ObjCancelacion.CancelacionAcuse - Else - Retorno.Mensaje = "Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.
    Origen del error: WebService www.sat.gob.mx" - Retorno.TipoMensaje = TipoMensaje.MsgError - - Return Retorno - End If - Else - CancelacionFecha = Now.Date - CancelacionAcuse = "" - End If - End If - Else - CancelacionFecha = Now.Date - CancelacionAcuse = "" - End If - Else - CancelacionFecha = Now.Date - CancelacionAcuse = "" - End If - Catch ex As Exception - MensajeError = "Ocurrió un Error al Cancelar la factura con los servicios del SAT." - ModExtensiones.GuardaLog($"{MensajeError} - Error:{ex.Message}") - - Retorno.Mensaje = MensajeError - Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia - Retorno.HuboError = True - - Return Retorno - End Try - Else - CveEstatus = CveEstatusFacturaAsignado - CancelacionFecha = FechaCancelacion.ToDateTime() - CancelacionAcuse = AcuseCancelacion - End If - - 'BITACORA, SOLICITUD DE CANCELACION - If CveEstatus > 0 AndAlso CveEstatusFacturaAsignado <= 0 Then - - Dim msgBitacora As String = "Solicitud de cancelación de factura" - If EsRefacturacion Then - msgBitacora = "Solicitud de cancelación por refacturación" - End If - - Dim ObjE As New ClsOIEventos() - ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) - ObjE.Dispose() - Else - - If CveEstatus = 5 Then - Dim ObjE As New ClsOIEventos() - ObjE.AddEventoBitacora("La cancelación de la factura fue aceptada en el SAT", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) - ObjE.Dispose() - ElseIf CveEstatus = 4 Then - Dim ObjE As New ClsOIEventos() - ObjE.AddEventoBitacora("No se pudo comprobar el estatus de factura ante el SAT, solo sera cancelada en el sistema", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) - ObjE.Dispose() - End If - - End If - - 'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES - Dim SeCancelaRemisionProceso = (CveEstatus = 20 AndAlso TieneRemisionesRelacionadas AndAlso CancelarRemisiones) - - Retorno.CveEstatus = CveEstatus - - '0 Sin Refacturacion, 1 Refacturacion en Proceso, 3. Refacturación en proceso sin aceptación - If EsRefacturacion AndAlso CveEstatusRefacturacion = 0 Then - If CveEstatus = 5 Then - CveEstatusRefacturacion = 3 ' refacturación en proceso sin autorización de cancelación - Else - CveEstatusRefacturacion = 1 ' refacturación en proceso con autorización de cancelación - End If - End If - - Dim ObjVentas As New ClsVentas() : ObjVentas.IniciaTransacSQL() - Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) - Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL()) - Dim ObjContrato As New ClsContratos(ObjVentas.IniciaTransacSQL()) - Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) - Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) - Dim ObjAC As ClsContPAQi = Nothing - - If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - End If - - Try - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - CvePlantillaPoliza = 7 - ElseIf ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant", "RNC") Then - CvePlantillaPoliza = 4 - Else - CvePlantillaPoliza = 4 - End If - - 'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO - If Not AplicaRefacturacionConPagos AndAlso ((((ObjFactura.Saldo > 0 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20)) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20))) Then - - 'CUANDO SE CANCELA, LA PÓLIZA DEBE DE SER DE DIARIO - CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, Now, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) - ObjFactura.CvePrePoliza = CvePrePoliza - - If ObjFactura.CvePrePoliza <= 0 Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al generar la prepoliza de cancelación." - End If - - 'CANCELAR PAGOS - If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - If Not ErrorCancelar Then - If Not ObjConta.PrePolizasCancelarPagos(ObjFactura.CveDevolucion, CvePrePoliza) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al generar la prepoliza de cancelación de pago." - End If - End If - End If - - 'CANCELA PREPOLIZA - If Not ErrorCancelar Then - ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso, - CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion) - MensajeError = "Ocurrió un error al generar la prepoliza de cancelación." - End If - - 'CANCELA IMPUESTOS LOCALES - If Not ErrorCancelar Then - ErrorCancelar = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, -1) - MensajeError = "Ocurrió un error al cancelar los impuestos locales." - End If - - End If - - 'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO - If Not ErrorCancelar AndAlso Not EsRefacturacion AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20) AndAlso CveEstatusRefacturacion = 0 Then - - 'DEVOLUCION DE ALMACEN - If Not ErrorCancelar AndAlso TieneAlmacen Then - Dim TieneSalida As Boolean = False - Dim DtInventario As DataTable = Nothing - Dim DtSalidas As DataTable = Nothing - Dim DtDevoluciones As DataTable = Nothing - Dim DtExistencias As DataTable = Nothing - Dim DtRemisionesFacturadas As DataTable = Nothing - - 'CUANDO SE VAYA A REALIZAR LA DEVOLUCION AQUI DEBE MARCALA PARA NO SOLICITARLA DE NUEVO, SI NO LA SOLICITARA - If ObjFactura.EsDevolucionVenta = 0 Then - Dim EstatusDevolucion = 1 - If Not ObjVentas.UpdateVentasDevolucionAlmacen(EstatusDevolucion, CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al solicitar la devolucion de almacen." - End If - End If - - If Not ErrorCancelar Then - Dim Filtro As String = "" - Select Case ObjFactura.TipoDocto - Case "Ing", "Ped", "Dev" - Filtro = "CveConcepto IN (3, 40)" - Case Else - Filtro = "CveConcepto = 9" - End Select - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - If ObjInventario.GetDevolucionRemisionesFacturadas(CveVenta) Then - DtRemisionesFacturadas = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0") - Else - ErrorCancelar = True - End If - - If Not ErrorCancelar Then - If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then - DtInventario = ObjInventario.DtResultados.Copy() - DtSalidas = DtInventario.FiltraParametros($"CvePS IS NULL AND {Filtro}") - DtExistencias = DtInventario.FiltraParametros($"CvePS IS NOT NULL AND {Filtro} AND CveTipoPS = 2") - TieneSalida = DtExistencias.Rows.Count > 0 - Else - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." - End If - End If - - End If - - If Not ErrorCancelar AndAlso TieneSalida Then - - If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then - 'REALIZA DEVOLUCION A LAS SALIDAS PENDIENTES - For Each RowMovimiento As DataRow In DtSalidas.Rows - Dim CveConceptoDevolucion As Integer = -1 - Dim CveAlmacenDevolucion As Integer = -1 - - Dim CveMovimientoDevolucion As Integer = 0 - Dim Folio As Integer = 0 - - Select Case RowMovimiento("CveConcepto").ToString().ToEntero() - Case 3 - CveConceptoDevolucion = 18 'DEVOLUCION DEL CLIENTE - CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero() - Case 40 - CveConceptoDevolucion = 41 'DEVOLUCIÓN DEL CLIENTE DIRECTA - CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero() - ''SI TIENE REMISIONES RELACIONADAS - 'If DtRemisionesFacturadas.Rows.Count > 0 Then - ' Dim RowRemision As DataRow = DtExistencias.FiltroPrimero($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}") - - ' Dim CveRemision As Integer = RowRemision("CveRemision").ToString().ToEntero() - - ' Dim CancelarRemision As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = CveRemision)) - - ' 'SI LA REMISION SE VA A CANCELAR DEBE REGRESAR AL ALMACEN GENERAL - ' If CancelarRemision Then - ' CveAlmacenDevolucion = RowRemision("CveAlmacenDevolucion").ToString().ToEntero() - ' Else - ' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero() - ' End If - - 'Else - ' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero() - 'End If - End Select - - 'SI TIENE SALDO PENDIENTE POR DEVOLVER GENERA UN MOVIMIENTO DE DEVOLUCION - If ObjFactura.SaldoAlmacen <> 0 Then - 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) - CveMovimientoDevolucion = ObjInventario.AddMovimiento(CveAlmacenDevolucion, CveConceptoDevolucion, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=-1) - Folio = ObjInventario.Folio - - If CveMovimientoDevolucion > 0 Then - For Each Dr As DataRow In DtExistencias.FiltraParametros($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}").Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." - Exit For - End If - Next - Else - MensajeError = "Ocurrió un error al agregar el movimiento" - ErrorCancelar = True - End If - - 'GENERA PREPOLIZA DEL MOVIMIENTO DE DEVOLUCION - If Not ErrorCancelar Then - Dim DtCostos As DataTable = Nothing - Dim ValorInventario As Decimal = 0 - If ObjInventario.GetMovimientosDetalle(CveMovimientoDevolucion, UsuarioActual.CveEmpresa) Then - DtCostos = ObjInventario.DtResultados - - Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) - Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero - 'Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero - Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 - If tmpCostos.Rows.Count > 0 Then - - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - Dim Fecha As Date = Now - Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero - Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString - Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString - Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL() - Dim TotalCostoAcumulado As Decimal = 0 - Dim cont As Integer = 1 - - Dim CvePrePolizaDev As Integer = ObjConta.AddPrePolizas("Modelos/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'SE AGREGA MOVIMIENTO SEPARADO POR LA CUENTA DE VENTAS (ER) - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL() - TotalCostoAcumulado += ValorInventario - - 'CUANDO ES EL ÚLTIMO MOVIMIENTO Y HAY DIFERENCIAS EN LOS IMPORTES - If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then - ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado) - End If - - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - - If Not ErrorCancelar Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, False, -1 * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * ValorInventario, CveCuenta:=CveCuenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then - ErrorCancelar = True - End If - End If - - cont += 1 - Next - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, True, -1 * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * TotalCosto) Then - ErrorCancelar = True - End If - - 'AUTOCONTA - EL MOVIMIENTO 1 ES EL DE VENTA - - Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" - - If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then - AutoConta = False - End If - - If AutoConta And Not ErrorCancelar Then - - If IdCtaContable > 0 Then - If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaDev, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al contabilizar la prepoliza." - End If - Else - Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia) - End If - - End If - - Else - ErrorCancelar = True - MensajeError = "Ocurrió un Error al ingresar las prepolizas" - End If - End If - End If - End If - End If - - - 'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION - 'SI ES DEVOLUCION DEL CLIENTE DEBE REGRESAR A ENTREGA POR ADELANTADO - If Not ErrorCancelar AndAlso CveConceptoDevolucion = 18 AndAlso RevivirRemisiones Then - If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimientoDevolucion, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al generar los movimientos de devolución a remisión" - End If - End If - - - 'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL - If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowMovimiento("CveMovimiento").ToString().ToEntero(), ObjInventario) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." - End If - - 'AGREGA BITACORA A VENTA - If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then - Dim MensajeBitacora = "Devuelta" - If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: {1}", CveMovimientoDevolucion, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then - MensajeError = "Ocurrió un error al agregar la bitacora." - ErrorCancelar = True - End If - End If - - If ErrorCancelar Then - Exit For - End If - - Next - - 'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN ORGINAL (GENERAL,SIN COSTO) - If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then - - 'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO) - If Not ErrorCancelar Then - If ObjInventario.GetMovimientosDevoluciones(CveVenta, UsuarioActual.CveEmpresa) Then - DtDevoluciones = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10") - Else - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." - End If - End If - - 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN ORGINAL (GENERAL,SIN COSTO) - If Not ErrorCancelar AndAlso DtDevoluciones IsNot Nothing AndAlso DtDevoluciones.Rows.Count > 0 Then - For Each CveRemision As Integer In ListaRemisionesCancelar - Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") - - Dim DtDevMovs = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveRemision", "CveAlmacen", "CveAlmacenDestino"}) - - For Each RowDevolucion As DataRow In DtDevMovs.Rows - CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() - CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() - - If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." - Exit For - End If - Next - - If ErrorCancelar Then - Exit For - End If - - Next - End If - - End If - - 'VERIFICAR MOVIMIENTOS DE APARTADOS - 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 - - '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 - - End If - End If - End If - - 'CANCELA CONTRATOS - If Not ErrorCancelar Then - If ObjFactura.CveContrato > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then - ObjFactura.GuardarContratoAvanceEstimaciones(ObjFactura, ObjContrato, ErrorList, -1, True) - If ErrorList.Count > 0 Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar las estimaciones del contrato." - End If - ElseIf ObjFactura.CveContrato > 0 AndAlso ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - ObjFactura.GuardarContratoAvanceEstimaciones(ObjFactura, ObjContrato, ErrorList, 1, True) - If ErrorList.Count > 0 Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los avances del contrato." - End If - End If - End If - - 'DESVINCULA COTIZACIONES FACTURADAS - If Not ErrorCancelar Then - If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") Then - If Not ObjVentas.LiberarCotizacionesFacturadas(CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al desvincular las cotizaciones." - End If - End If - End If - - 'DESVINCULA PEDIDOS2 PREDECESORES - If Not ErrorCancelar Then - If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") Then - If Not ObjVentas.LiberarPedidos2Facturados(CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al desvincular los pedidos." - End If - End If - End If - - 'DESVINCULA OCs PREDECESORAS - If Not ErrorCancelar Then - If ObjFactura.TipoDocto = "Ing" Then - If Not ObjVentas.LiberarOCFacturadas(CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al desvincular las Ordenes de Compra." - End If - End If - End If - - 'ELIMINA LAS VENTAS DETALLE DE LA DEVOLUCION - If Not ErrorCancelar Then - If ObjFactura.TipoDocto = "Dev" Then - If Not ObjVentas.RemoveVentaDetalleDevolucion(CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al eliminar las ventas detalle devolución." - End If - End If - End If - - 'POLIZA DE CANCELACION - If Not ErrorCancelar Then - If UsuarioActual.Empresa.UsaAC Then - Dim Pol As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjFactura, ObjAC, True) - IDPoliza = Pol.IdPoliza - If IDPoliza <= 0 Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al generar la poliza de cancelación." - End If - End If - End If - - 'DESVINCULA REMISIONES PREDECESORAS - If Not ErrorCancelar Then - If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso RevivirRemisiones Then - For Each Row As DataRow In DtRemisionesRelacionadas.Rows - Dim PuedeLiberar As Boolean = (ListaRemisionesCancelar Is Nothing) OrElse (Not ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = Row("CveVenta").ToString().ToEntero())) - If PuedeLiberar Then - If Not ObjVentas.LiberarRemisionesFacturadas(CveVenta, Row("CveVenta").ToString().ToEntero()) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al desvincular las remisiones." - End If - End If - Next - End If - End If - - 'CANCELA MOVIMIENTOS DE USADOS - If Not ErrorCancelar Then - If ObjFactura.TipoDocto = "Ing" Then - If Not CancelarMovimientosUsados(ObjFactura, UsuarioActual, ObjAcum) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los movimientos de usados" - End If - End If - End If - - End If - - 'MARCA LA VENTA PARA REALIZAR LA DEVOLUCION POSTERIORMENTE - If Not ErrorCancelar Then - If RealizarDevolucionAlmacen AndAlso CveAlmacenDevolucion > 0 Then - If Not ObjVentas.UpdateVentaRealizarDevolucion(CveVenta, RealizarDevolucionAlmacen, CveAlmacenDevolucion) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al marcar la venta para devolución" - End If - End If - End If - - 'ACTUALIZA ESTATUS - If Not ErrorCancelar Then - Select Case ObjFactura.TipoDocto - Case "Rem" - CveEstatus = 12 - Case "Com" - CveEstatus = 9 - Case "Cot" - CveEstatus = 10 - Case "Ped", "DPe" - CveEstatus = 14 - End Select - - If CveEstatus.Contiene(4, 5) Then - - If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al guardar el estatus de cancelación." - 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 - ErrorCancelar = True - MensajeError = "Ocurrió un error al guardar el estatus de cancelación." - End If - End If - - If CancelarRemisiones Then - If SeCancelaRemisionProceso Then - - If Not ErrorCancelar Then - For Each CveRemisionCancelar In ListaRemisionesCancelar - If Not ObjVentas.AddRemisionesXCancelar(CveVenta, CveRemisionCancelar) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al guardar la remisión x cancelar." - Exit For - End If - Next - End If - - If Not ErrorCancelar Then - If Not ObjVentas.UpdateCancelaRemision(CveVenta, SeCancelaRemisionProceso) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al actualizar que la remision sea cancelable." - End If - End If - - Else - - If Not ErrorCancelar Then - For Each CveRemisionCancelar In ListaRemisionesCancelar - If Not ObjVentas.UpdateEstatusFactura(12, "", "", CancelacionFecha, CveRemisionCancelar) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al guardar el estatus de cancelación de la remisión." - End If - Next - End If - - End If - End If - - End If - - Catch ex As Exception - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar el documento" - OnError("Ocurrió un error al cancelar el documento", ex) - Finally - If Not ErrorCancelar Then - ObjVentas.Commit() - If ObjAC IsNot Nothing Then ObjAC.Commit() - - If CveEstatus = 5 Then - Dim MensajeAlert As New StringBuilder - MensajeAlert.Append("El Documento se canceló correctamente.") - MensajeAlert.Append($"
    Imprimir Acuse") - MensajeAlert.Append("

    ¿Desea enviar el Acuse de Cancelación al Cliente?") - - Retorno.Mensaje = MensajeAlert.ToString - Retorno.HuboError = False - Retorno.TipoMensaje = TipoMensaje.MsgConfirmacion - - Else - Retorno.Mensaje = "El documento se canceló exitosamente" - Retorno.HuboError = False - Retorno.TipoMensaje = TipoMensaje.MsgInformacion - End If - - ObjFactura.CveEstatus = CveEstatus - Else - ObjVentas.RollBack() - If ObjAC IsNot Nothing Then ObjAC.RollBack() - - Retorno.Mensaje = MensajeError - Retorno.HuboError = True - Retorno.TipoMensaje = TipoMensaje.MsgError - - End If - - Retorno.CveEstatus = CveEstatus - - ObjVentas.Dispose() - ObjBancos.Dispose() - ObjInventario.Dispose() - ObjContrato.Dispose() - ObjConta.Dispose() - If ObjAC IsNot Nothing Then ObjAC.Dispose() - End Try - - Return Retorno - End Function - Private Function GeneraMovimientosVirtuales(CveVenta As Integer, CveMovimiento As Integer, CveMovimientoRelacionado As Integer, ByRef ObjInventario As ClsInventarios) As Boolean - Dim ErrorCancelar As Boolean = False - Try - If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then - Dim CveMovimientoVirtual As Integer = -1 - Dim ValidaVirtual = True - Dim DtPSVirtual As New DataTable("DtTamanios") - - Dim tCveAlmacen As Integer = -1 - - If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero() - End If - - If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then - DtPSVirtual = ObjInventario.DtResultados - End If - - Dim CveConceptoMovimientoVirtual As Integer = 36 - Dim CveAlmacenVirtual As Integer = -1 - Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento - - CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero() - - If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, - Observaciones:="", Guia:="", CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="Modelos/CancelarVirtual") - - If CveMovimientoVirtual > 0 Then - For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() - Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() - Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() - Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then - ErrorCancelar = True - Exit For - End If - Next - Else - ErrorCancelar = True - End If - Else - If ValidaVirtual Then - ErrorCancelar = True - End If - End If - - If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then - ErrorCancelar = True - End If - End If - Catch ex As Exception - OnError("Ocurrió un error al realizar la devolución al almacen virtual.", ex) - ErrorCancelar = True - End Try - - Return Not ErrorCancelar - End Function - - Private Function GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento As Integer, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, ByRef DtDevRem As DataTable, ByRef ListaRemisionesCancelar As List(Of Integer)) As Boolean - Dim ErrorCancelar As Boolean = False - - Dim DtMovtosDev As New DataTable - Dim CveAlmacenTraspasoDestinoDevRem = -1 - - Dim CveVentaDetalleRem = -1 - Dim CantidadDevolver As Decimal = 0 - Dim CantidadRem As Decimal = 0 - Dim CveMovimientoSalidaDevRem As Integer = 0 - Dim FolioMovimientoSalidaDevRem As Integer = 0 - Dim CveMovimientoEntradaDevRem As Integer = 0 - Dim FolioMovimientoEntradaDevRem As Integer = 0 - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - If ObjInventario.GetDevolucionRemisionesFacturadas(CveVenta) Then - DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0") - Else - ErrorCancelar = True - End If - - 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtMovtosDev = ObjInventario.DtResultados - Else - ErrorCancelar = True - End If - - If Not ErrorCancelar Then - If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then - - For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows - - 'CHECO SI NO SE VA A CANCELAR - 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) - 'SI LA REMISION ESTA SALDADA DEBE REVIVIR LOS MOVIMIENTOS COMPLETAMENTE O PARCIALMENTE - 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 - 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.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Serie:=Dr("Serie").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString) Then - ErrorCancelar = True - Exit For - End If - Next - - If ErrorCancelar Then - 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) 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 - End If - End If - ObjRem.Dispose() - - End If - - Next - End If - End If - - Return Not ErrorCancelar - End Function - - Private Function CancelarMovimientosRemision(CveRemision As Integer, CveAlmacen As Integer, CveAlmacenDestino As Integer, DtMovDetalle As DataTable, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios) As Boolean - Dim ErrorCancelar As Boolean = False - - Dim CveMovimientoSalidaDevRem As Integer = 0 - Dim FolioMovimientoSalidaDevRem As Integer = 0 - - Dim CveMovimientoEntradaDevRem As Integer = 0 - Dim FolioMovimientoEntradaDevRem As Integer = 0 - - 'SALIDA DE (ENTREGA POR ADELANTADO) - CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacen, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenDestino) - FolioMovimientoSalidaDevRem = ObjInventario.Folio - - 'ENTRADA A (ALMACEN GENERAL) - CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDestino) - FolioMovimientoEntradaDevRem = ObjInventario.Folio - - If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then - ErrorCancelar = True - End If - - 'SALIDA DE (ENTREGA POR ADELANTADO) - If Not ErrorCancelar Then - For Each DrRem As DataRow In DtMovDetalle.Rows - Dim CveVentaDetalleRem = DrRem("CveVentaDetalleRemision").ToString.ToEntero - Dim CantidadRem = DrRem("Cantidad").ToString.ToDecimal - - If Not CveVentaDetalleRem > 0 Then - ErrorCancelar = True - Exit For - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, DrRem("Cantidad").ToString.ToDecimal, DrRem("CveUM").ToString.ToEntero, DrRem("CvePS").ToString.ToEntero, DrRem("PU").ToString.ToDecimal, CveAF:=DrRem("CveActivoFijo").ToString.ToEntero, Serie:=DrRem("Serie").ToString, Lote:=DrRem("Lote").ToString, CveVentaDetalle:=CveVentaDetalleRem, CveMovimientoDetalleEntrada:=DrRem("CveMovimientoDetalle").ToString().ToEntero(), CveSeccionAlmacen:=-3) Then - ErrorCancelar = True - Exit For - End If - - If ErrorCancelar Then - Exit For - End If - Next - End If - - 'ENTRADA A (ALMACEN GENERAL) - Dim DtEntradaDetalle As DataTable = Nothing - - If Not ErrorCancelar Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then - DtEntradaDetalle = ObjInventario.DtResultados.Copy() - End If - End If - - If Not ErrorCancelar Then - If DtEntradaDetalle IsNot Nothing Then - For Each Dr As DataRow In DtEntradaDetalle.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, CveSeccionAlmacen:=-3) Then - ErrorCancelar = True - Exit For - End If - Next - Else - ErrorCancelar = True - End If - End If - - If Not ErrorCancelar Then - If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then - ErrorCancelar = True - End If - End If - - - Return Not ErrorCancelar - End Function - - Private Function GeneraMovimientosApartados(ByRef ObjInventario As ClsInventarios) As Boolean - Dim ErrorCancelar As Boolean = False - If Not ErrorCancelar Then - If ObjInventario.VentasAlmacenApartadosGet(CveVenta) Then - - Dim DtTraspasos As New DataTable - DtTraspasos.Columns.Add("CveAlmacen", GetType(Integer)) - DtTraspasos.Columns.Add("Almacen", GetType(String)) - DtTraspasos.Columns.Add("CveMovimientoSalida", GetType(Integer)) - DtTraspasos.Columns.Add("FolioSalida", GetType(Integer)) - DtTraspasos.Columns.Add("CveMovimientoEntrada", GetType(Integer)) - DtTraspasos.Columns.Add("FolioEntrada", GetType(Integer)) - - Dim DtTempApartados = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 9", "CveAlmacen") - Dim CveMovimientoSalidaApartado = -1 - Dim CveAlmacenApartado = -1 - Dim CveAlmacenOrigen = CveAlmacenDevolucion - Dim FolioSalida As Integer = 0, FolioEntrada = 0, CveMovimientoSalida = 0, CveMovimientoEntradaApartado = 0 - - For Each Dr As DataRow In DtTempApartados.Rows - - If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString.ToEntero Then - CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveVendedor:=1, CveCliente:=CveCliente, CveAlmacenDestino:=Dr("CveAlmacen").ToString.ToEntero) - FolioSalida = ObjInventario.Folio - CveAlmacenApartado = Dr("CveAlmacen").ToString.ToEntero - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr("Almacen").ToString.ToEntero - DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString.ToEntero - DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - If Not CveMovimientoSalidaApartado > 0 Then - ErrorCancelar = True - Exit For - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then - ErrorCancelar = True - Exit For - End If - Next - - If Not ErrorCancelar Then - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString.ToEntero - - CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString.ToEntero, 9, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", CveAlmacenDestino:=CveAlmacenDevolucion, CveMovimientoRelacionado:=CveMovimientoSalida, Guia:="", CveContrato:=CveContrato, CveVendedor:=-1, CveCliente:=CveCliente) - FolioEntrada = ObjInventario.Folio - - If Not CveMovimientoEntradaApartado > 0 Then - ErrorCancelar = True - Exit For - End If - - Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado - Dr1("FolioEntrada") = FolioEntrada - - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then - ErrorCancelar = True - Exit For - End If - Next - End If - - If ErrorCancelar Then Exit For - Next - - DtTraspasos.Dispose() - End If - Else - ErrorCancelar = True - End If - End If - - Return Not ErrorCancelar - End Function - - - Public Function CancelarDocumento() As MMensajeFactura - Dim Retorno As New MMensajeFactura() - - CancelarVenta(Me, UsuarioActual) - - Return Retorno - End Function - Protected Function CancelarFactura(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjAC As ClsContPAQi, ByRef ObjBancos As ClsBancos) As Boolean - - Dim IDPoliza As Integer = -1 - Dim CvePrePoliza As Integer - Dim CvePlantillaPoliza As Integer - - Dim ErrorCancelar As Boolean = False - Dim Mensaje As String = "" - - FacturaDevolucion.TipoDocto = Me.TipoDocto - - If FacturaDevolucion.TipoDocto.Contiene("Egs", "Dev") Then - CvePlantillaPoliza = 7 - ElseIf FacturaDevolucion.TipoDocto.Contiene("Ing", "Rem", "Ant") Then - CvePlantillaPoliza = 4 - End If - - - CvePrePoliza = ObjConta.AddPrePolizas("Modelos/GuardaEstatus", CvePlantillaPoliza, Me.Total, Me.Total, Me.CveMoneda, Now, Me.Cliente.NombreComercial, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - FacturaDevolucion.CveVenta = CveVenta - FacturaDevolucion.CvePrePoliza = CvePrePoliza - - - If NuevaFactura = 1 AndAlso UsuarioActual.TienePermisoProceso(222) Then - If ObjVentas.GetVentaDetalle(FacturaDevolucion.CveVenta) Then - DtDetalle = ObjVentas.DtResultados - End If - ErrorCancelar = ProcesoPrepolizas(FacturaDevolucion, ObjConta, -1, DtDetalle, ObjAC, -1, ObjBancos, ObjVentas) - Else - ErrorCancelar = ProcesoPrepolizas(FacturaDevolucion, ObjConta, -1, DtDetalle, ObjAC, -1, ObjBancos, ObjVentas) - End If - - If Not ErrorCancelar Then - ErrorCancelar = GuardarVentaImpuestosLocales(FacturaDevolucion, ObjVentas, ObjConta, -1) - End If - - If CveEstatus = 4 Then - - If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, "", Now, CveVenta, IDPoliza) Then - Mensaje = "El nuevo estatus se guardó correctamente" - Else - ErrorCancelar = True - End If - - 'Si se está mandando a Cancelada SAT - ElseIf CveEstatus = 5 Then - - Dim DT As DataTable = Nothing - - If FolioFiscal = "" Then - Dim XmlDoc As New XmlDocument - XmlDoc.Load(Me.DirectorioServidor & UsuarioActual.Empresa.Ruta & "XML\" & Me.TipoDocto & "\" & Me.SerieFolio & ".xml") - FacturaDevolucion.FolioFiscal = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText - End If - - Dim ObjCancelacion As New Timbrado - - Dim Total As Decimal = Me.Total - Dim RFCReceptor As String = Me.Cliente.RFC - - If Not ObjVentas.UpdateEstatusFactura(13, FolioFiscal, "", Now, CveVenta, IDPoliza) Then 'Marcamos la factura como refacturada, si no se cancelo en el SAT el estatus nos dejara cancelarla despues - ErrorCancelar = True - End If - - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC) Then - 'falta verificar traer el acuse y reenviarlo - If UsuarioActual.Empresa.UsaAC Then - Dim Pol As Modelos.RetornoPolizaConta = GenerarPolizaAC(Me, ObjAC, True) - IDPoliza = Pol.IdPoliza - - If IDPoliza <= 0 Then - Mensaje = "No se pudo generar la poliza" - ErrorCancelar = True - End If - End If - - If Not ErrorCancelar Then - If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, ObjCancelacion.CancelacionAcuse, Now, CveVenta, IDPoliza, CvePAC:=UsuarioActual.Empresa.CvePAC) Then - Mensaje = "El nuevo estatus se guardó correctamente" - Else - ErrorCancelar = True - End If - End If - End If - - ObjCancelacion = Nothing - - End If - - Return Not ErrorCancelar - End Function - Private Function RegistrarNC(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean - Dim ProcesoCorrecto As Boolean = True - RefacturacionGeneroNC = True - factura.Folio = -1 - - 'Registramos la venta - GuardarVenta(factura, ObjVentas, ObjConta, ObjInventario, ObjContr, TmpDTconceptos, -1, ObjContPaq, ObjBancos) - - If ErrorList.Count > 0 Then - ProcesoCorrecto = False - End If - - Return ProcesoCorrecto - End Function - - - - Private Function GenerarPolizaAC(ObjFactura As Modelos.Factura, ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As RetornoPolizaConta - Dim Retorno As New RetornoPolizaConta - Dim IDPoliza As Integer = 0 - - Dim ErrorAC As Boolean = False - 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - Dim Fecha As Date = ObjFactura.Fecha - Dim Concepto As String = String.Format("GD {0}", ObjFactura.Cliente.Nombre) - Dim Paridad As Integer = 1 - Dim TipoMovto As Boolean = False - - If CancelacionIngreso Then - Concepto = String.Format("Cancelación GD {0}", ObjFactura.Cliente.Nombre) - Paridad = -1 - TipoMovto = True - End If - - Dim TipoPoliza = If(ObjFactura.TipoDocto = "OP" Or ObjFactura.TipoDocto = "Com", 3, 1) - - IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, ObjFactura.Total * 2, ObjFactura.Total * 2, UsuarioActual.CveUsuario, Fecha) - Dim dr As DataRow - - Dim CtaCliente As Integer = ObjFactura.Cliente.IdCtaContClientes - Dim CtaISSSTESON As Integer = 643 - Dim CtaISPT As Integer = 1745 - - - If IDPoliza > 0 Then - Retorno.IdPoliza = IDPoliza - Retorno.FolioPoliza = ObjAC.Folio - 'Orden de PAGO - If ObjFactura.TipoDocto = "OP" Then - 'ORDEN DE PAGO - If ObjFactura.Num3 = 1 Then - 'ISSSTESON - - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * ObjFactura.Total, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * ObjFactura.Total, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - - Else - 'ISPT - - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * ObjFactura.Total, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * ObjFactura.Total, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - End If - - ' NORMAL - Else - Dim DTPresupuestoIngresos As New DataTable - Dim AC As New ClsAC - If AC.GetPresupuestoIngresos(-1, Now.Year, True, UsuarioActual.CveEmpresa) Then - DTPresupuestoIngresos = AC.DtResultados.Copy() - End If - AC.Dispose() - - For Each grp As DataRow In DtDetalleAC.Rows - dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp("CvePresupuestoIngreso"))) - Concepto = String.Format("{0} - {1}: {2}", ObjFactura.Cliente.Nombre, ObjFactura.TipoDocumento, ObjFactura.Folio) - - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp("TotalImporte").ToString().ToDouble(), "", Concepto, 0, Fecha, "") Then - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp("TotalImporte").ToString().ToDouble(), "", Concepto, 0, Fecha, "") Then - 'CARGO la deuda del cliente - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp("TotalImporte").ToString().ToDouble(), "", Concepto, 0, Fecha, "") Then - 'abono, - If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp("TotalImporte").ToString().ToDouble(), "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Next - End If - - Else - ErrorAC = True - End If - - If Not ErrorAC Then - ObjAC.AjustaPoliza(IDPoliza) - - ' Retorno = IDPoliza - Else - 'Retorno = -1 - 'Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError) - End If - - Return Retorno - - End Function - -#End Region - - -#Region "P R O P I E D A D E S" - Public Property CveEstatusRefacturacion As Integer = 0 - Public Property NuevaFactura As Integer - Public Property EnviarCorreo As Boolean = False - Public Property ErrorList As List(Of String) - Public Property TipoContrato As Integer - Public Property CvePedido As Integer = -1 - Public Property CvePedidoA As Integer = -1 - Public Property CvePedido2 As Integer = -1 - Public Property CveAlmacenTraspasoOrigen As Integer = -1 - Public Property CveAlmacenTraspasoDestino As Integer = -1 - Public Property EsDevolucionVenta As Integer = -1 - Public Property EsInterno As Integer = -1 - Public Property CveEmpresaCRM As Integer = -1 - Public Property EmpresaCRM As String = "" - Public Property TotalImpuestoLocal As Decimal = 0 - Public Property AplicaDevolucion As Boolean - Public Property CveVentaDevolucion As Integer - Public Property ObservacionesAlmacen As String - Public Property CveOC As Integer = -1 - Public Property CveCuentaTerminal As Integer = -1 - Public Property ClienteEsDistribuidor As Boolean = False - Public Property AplicaGastoContrato As Boolean = False - Public Property FacturaDevolucion As Modelos.Factura - Public Property CveOrdenProduccion As Integer = -1 - Public Property Pago As Integer - Public Property TipoAmortizacionAnticipo As Integer - Public Property CveAlmacenExistenciasContrato As Integer - Public Property EraCotizacion As Integer - Public Property CveRemision As Integer = -1 - Public Property CveCotizacion As Integer = -1 - Public Property DevPed As Integer = -1 - Public Property CveFactura As Integer - Public Property CveCicloComercial As Integer - Public Property TipoDoctoDevolucion As String - Public Property SeGuardoPrePoliza As Boolean - Public Property DirectorioServidor As String - Public Property FacturaMateriales As Integer - Public Property TipoDescuento As Integer - Public Property SubProyectoPorcentajeIVA As Double - Public Property PorcentajeIVA As Double - Public Property CveAlmacenOrigenContrato As Integer - Public Property CveDevolucion As Integer - Public Property TotalOtrosConceptos As Decimal - Public Property CvePSAmortizacion As Integer - Public Property SaldoVentaDevolucion As Decimal - Public Property Saldo As Decimal - Public Property SaldoAlmacen As Decimal - Public Property SaldoAnticipo As Decimal - Public Property SaldoAmortizado As Decimal - Public Property CvePAC As Integer - Public Property CveAnticipo As Integer - Public Property RemisionesLista As List(Of Integer) - Public Property CveAlmacen As Integer - Public Property CveConceptoMovimiento As Integer - Public Property ObservacionesMovimiento As String - Public Property DtMovimientosUsados As DataTable - Public Property CveAlmacenDevolucion As Integer - Public Property CveVenta As Integer - Public Property CveEmpresa As Integer - Public Property CveSucursal As Integer 'sucursal de la empresa que factura - Public Property CveSubProyecto As Integer - Public Property CveAlmacenRecepcionUsados As Integer = -1 - Public Property CveDireccionEnvio As Integer - Public Property RefacturacionGeneroNC As Boolean = False - Public Property Pagado As Decimal - Public Property DescuentoProntoPago As Decimal - Public Property CveVentaRNCCargo As Integer - Public Property FacturarSucursal As Boolean = False - 'Public Property Sucursal As SucursalModel - Public Property SubProyecto As Modelos.SubProyectoModel - - Public Property DtDetalle As Data.DataTable - Public Property DtDetalleAC As Data.DataTable - Public Property DtAjustes As Data.DataTable - Public Property DtRecepcionUsados As Data.DataTable - Public Property DtPolizasVirtuales As Data.DataTable - Public Property DtVentasNC As Data.DataTable - Public Property DtDeduccion As Data.DataTable - Public Property DtFirmas As Data.DataTable - Public Property DtDesgloseImpuestos As Data.DataTable - Public Property DtDocumentosRelacionados As Data.DataTable - Public Property DtNCVinculadas As Data.DataTable - - Public Property DtAnticipos As Data.DataTable - Public Property DtPromociones As Data.DataTable - Public Property DtImpuestosLocales As Data.DataTable - Public Property DtPagos As Data.DataTable - Public Property DtRemisionesPS As Data.DataTable - Public Property DtRemisiones As Data.DataTable - Public Property DtPedidos2 As Data.DataTable - Public Property DtPedidos2PS As Data.DataTable - Public Property DTOrdenesCompraPS As Data.DataTable - Public Property DtCotizacionesPS As Data.DataTable - Public Property DtDocumentacionCliente As Data.DataTable - Public Property DtContratosSerieDetalle As Data.DataTable - Public Property DtOtrosConceptos As Data.DataTable - - Public Property DtRemisionesDocumentosRelacionados As Data.DataTable - Public Property DtInventario As Data.DataTable - 'Public Property DtAnticipoAmortizacion As Data.DataTable - Public Property DtRemConceptosSurtidos As Data.DataTable - Public Property UsadosBonificacion As List(Of Integer) - Public Property TipoBonificacion As Integer = 0 - Public Property Timbre As CFDITimbre - Public Property CveCliente As Integer - Public Property Cliente As Modelos.ClienteModel - Public Property SubProyectoMatriz As Modelos.SubProyectoModel - 'CFDi - - Public Property Version As String - Public Property Serie As String = "" - Public Property Folio As Integer - - Public ReadOnly Property SerieFolio As String - Get - If Not IsNothing(Serie) AndAlso Serie.Trim <> String.Empty Then - Return String.Format("{0}-{1}", Serie, Folio) - Else - Return Folio.ToString - End If - End Get - End Property - - Public Property Inv_CveMovimiento As Integer - Public Property Inv_CveEstatusEntrega As Integer - Public Property Inv_EstatusEntrega As String - Public Property Inv_ValorInventario As Decimal - Public Property Fecha As DateTime - - Public ReadOnly Property FechaCP As DateTime - Get - If Me.SubProyecto IsNot Nothing Then - If Now.EsHorarioVerano Then - Return DateTime.UtcNow.AddHours(Me.SubProyecto.UTCOffsetVerano) - Else - Return DateTime.UtcNow.AddHours(Me.SubProyecto.UTCOffsetInvierno) - End If - Else - Return Fecha - End If - End Get - End Property - Public Property FechaVencimiento As DateTime - Public Property EstatusFactura As String - Public Property SeTimbro As String - Public Property TipoDocto As String - Public Property RefDocto As String - Public Property RealizarDevolucionAlmacen As Boolean - Public Property CveAlmacenDevolucionVenta As Integer - - Public Property TipoDocumento As String - - - - - Public ReadOnly Property TipodeComprobante As String - Get - Select Case TipoDocto - Case "Ing" - Return "Ingresos" - Case "Egs" - Return "Egresos" - Case "Dev" - Return "Devolucion" - Case "Ped" - Return "Pedido" - Case "Cot" - Return "Cotización" - Case "Rem" - Return "Remisión" - Case "Nom" - Return "Nom" - Case "Ant" - Return "Anticipos" - Case Else - Return "No Identificado" - End Select - End Get - End Property - Public ReadOnly Property CvePlantillaPoliza As Integer - Get - Select Case TipoDocto - Case "Ing" - Return 4 - Case "Egs" - Return 7 - Case "Dev" - Return 7 - Case "Rem" - Return 4 - Case "Ant" - Return 12 - Case Else - Return 25 - End Select - End Get - End Property - Public ReadOnly Property TipodeComprobanteSAT As ClbNegBICFDv3_2.TipoDeComprobante - Get - Select Case TipoDocto - Case "Ing" - Return ClbNegBICFDv3_2.TipoDeComprobante.ingreso - Case "Egs" - Return ClbNegBICFDv3_2.TipoDeComprobante.egreso - Case "Dev" - Return ClbNegBICFDv3_2.TipoDeComprobante.egreso - Case "Cot" - Return Nothing - Case "Rem" - Return Nothing - Case "Nom" - Return Nothing - Case "Ant" - Return ClbNegBICFDv3_2.TipoDeComprobante.ingreso - Case Else - Return Nothing - End Select - End Get - End Property - Public ReadOnly Property ClaseDoctoSat As Integer - Get - Select Case TipoDocto - Case "Ing" - Return 1 - Case "Egs" - Return 9 - Case "Dev" - Return 9 - Case "Cot" - Return 0 - Case "Rem" - Return 0 - Case "Nom" - Return 0 - Case "Ant" - Return 0 - Case Else - Return 0 - End Select - End Get - End Property - Public Property CveUsuario As Integer - Public Property SerieFolioPadre As String - Public Property CveMoneda As Integer - Public Property Moneda As String - Public Property MonedaSAT As String - Public Property UsuarioCreo As String - Public Property MonedaAbreviatura As String - Public Property TipoCambio As Decimal - Public Property TipoCambioDolares As Decimal - Public Property ConvertirPesos As Boolean - Public Property ConvertirDolares As Boolean - Public Property FormaPago As Integer - - Public ReadOnly Property FormaPagoText As String - Get - Dim retorno = "" - Select Case FormaPago - Case 0 - retorno = "PAGO EN UNA SOLA EXHIBICIÓN" - Case 1 - retorno = "PAGO EN PARCIALIDADES" - End Select - Return retorno - End Get - End Property - - Public Property CondicionesPago As Integer - - Public ReadOnly Property CondicionesPagoText As String - Get - Dim retorno = "" - Select Case CondicionesPago - Case 0 - retorno = "contado" - Case 1 - retorno = "crédito" - End Select - Return retorno - End Get - End Property - - Public Property MotivoDescuento As String - - -#Region "Totales" - Public Property SubTotal As Decimal - Public Property Descuento As Decimal - Public Property Amortizacion As Decimal - - 'IVA - Public Property RetIVA As Decimal - Public Property RetISR As Decimal - Public Property IVA As Decimal - Public Property IEPS As Decimal - - Public Property Total As Decimal - Public Property Otros As Decimal - - Public Property TotalRemNCAplicado As Decimal - -#Region "Totales por Tipo de cambio" - - Public ReadOnly Property SubTotalTC As Decimal - Get - If ConvertirPesos Then - Return SubTotal * TipoCambio - Else - Return SubTotal - End If - End Get - End Property - Public ReadOnly Property DescuentoTC As Decimal - Get - If ConvertirPesos Then - Return Descuento * TipoCambio - Else - Return Descuento - End If - End Get - End Property - Public ReadOnly Property AmortizacionTC As Decimal - Get - If ConvertirPesos Then - Return Amortizacion * TipoCambio - Else - Return Amortizacion - End If - End Get - End Property - 'IVA - Public ReadOnly Property RetIVATC As Decimal - Get - If ConvertirPesos Then - Return RetIVA * TipoCambio - Else - Return RetIVA - End If - End Get - End Property - Public ReadOnly Property RetISRTC As Decimal - Get - If ConvertirPesos Then - Return RetISR * TipoCambio - Else - Return RetISR - End If - End Get - End Property - Public ReadOnly Property IVATC As Decimal - Get - If ConvertirPesos Then - Return IVA * TipoCambio - Else - Return IVA - End If - End Get - End Property - Public ReadOnly Property IEPSTC As Decimal - Get - If ConvertirPesos Then - Return IEPS * TipoCambio - Else - Return IEPS - End If - End Get - End Property - Public ReadOnly Property TotalTC As Decimal - Get - If ConvertirPesos Then - Return Total * TipoCambio - Else - Return Total - End If - End Get - End Property - Public ReadOnly Property OtrosTC As Decimal - Get - If ConvertirPesos Then - Return Otros * TipoCambio - Else - Return Otros - End If - End Get - End Property -#End Region -#End Region - Public Property AtencionA As String - Public Property AtnA As String - Public Property TelefonoGenerico As String - Public Property Det_OrdenCompra As String - Public Property Det_FechaOrdenCompra As String - Public Property Det_ContraRecibo As String - Public Property Observaciones As String - - Public Property Alfa1 As String - Public Property Alfa2 As String - Public Property Alfa3 As String - - Public Property Fech1 As Date - Public Property Fech2 As Date - Public Property Fech3 As Date - - Public Property Num1 As Double - Public Property Num2 As Double - Public Property Num3 As Double - - Public Property DiasCredito As Integer - Public Property EsDiasCreditoFijo As Boolean - - Public Property CveCorte As Integer - Public Property CveMesa As Integer - Public Property NumeroPersonas As Integer - - - Public Property FechaPago As Date - - Public Property CveNCaVincular As Integer - Public Property FolioFiscal As String - Public Property NoSerieCertificado As String - Public Property SelloCFDi As String - Public Property SelloSAT As String - Public Property FechaEmision As Date - Public Property FechaCertificacion As Date - Public Property NoSerieCertificadoContribuyente As String - Public Property NumeroCuenta As String - Public Property CveTipoAmortizacionAnticipo As Integer = -1 - Public Property DescripcionContrato As String - Public Property NumeroDescripcionContrato As String - Public Property CveComplementoTimbrado As Integer = 0 - Public Property ComplementoINE As Modelos.ComplementoINE - Public Property FordGSDB As String = "" - Public Property FordASN As String = "" - Public Property FemsaFactura As Modelos.FemsaFactura - - Public Sub SetSubProyecto() - If CveSubProyecto > 0 AndAlso UsuarioActual IsNot Nothing Then - SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) - End If - End Sub - Public Sub SetSubProyectoMatriz() - If UsuarioActual IsNot Nothing Then - Dim Row As Data.DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") - If Not IsNothing(Row) Then - SubProyectoMatriz = New Modelos.SubProyectoModel(Row) - End If - End If - End Sub - Public Sub SetCliente() - If CveCliente > 0 Then - Cliente = New Modelos.ClienteModel(CveCliente, CveEmpresa) - If Me.CveClienteSucursal > 0 Then - Dim ObjCliente As New ClsClientes() - If ObjCliente.GetSucursales(CveCliente, Me.CveClienteSucursal) AndAlso ObjCliente.DtResultados.Rows.Count > 0 Then - Me.ClienteSucursal = New Modelos.SucursalModel(ObjCliente.DtResultados.Rows(0)) - End If - ObjCliente.Dispose() - Else - Me.ClienteSucursal = New Modelos.SucursalModel() - Me.ClienteSucursal.NoExt = Cliente.NoExt - Me.ClienteSucursal.NoInt = Cliente.NoInt - Me.ClienteSucursal.Localidad = Cliente.Localidad - Me.ClienteSucursal.Direccion = Cliente.Direccion - Me.ClienteSucursal.Colonia = Cliente.Colonia - Me.ClienteSucursal.Municipio = Cliente.Localidad - Me.ClienteSucursal.Estado = Cliente.Estado - Me.ClienteSucursal.CP = Cliente.CP - Me.ClienteSucursal.Pais = Cliente.Pais - Me.ClienteSucursal.CorreoSucursal = Cliente.CorreoCotizacion - Me.ClienteSucursal.TelefonoSucursal = Cliente.Telefono - Me.ClienteSucursal.Sucursal = Cliente.Sucursal - Me.ClienteSucursal.ImprimeNombreSucursal = Cliente.ImprimeNombreSucursal.ToString() - End If - End If - End Sub - Public Sub SetMoneda() - If CveMoneda > 0 Then - Dim dr As DataRow = GlobalDTMonedas.FiltroPrimero(String.Format("CveMoneda ={0}", CveMoneda)) - If Not IsNothing(dr) Then - Moneda = dr("Moneda").ToString() - MonedaSAT = dr("AbreviaturaSAT").ToString() - MonedaAbreviatura = dr("Abreviatura").ToString() - End If - End If - End Sub - Public Sub SetMetodoPago() - If CveMetodoPago > 0 AndAlso Not IsNothing(GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))) Then - MetodoPago = GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))("MetodoPago").ToString() - ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))("ClaveSAT").ToString() - End If - End Sub - Public Sub SetMoneda(ObjClsPaginas As ClsPaginas) - If Not IsNothing(ObjClsPaginas) Then - Dim dr As DataRow = ObjClsPaginas.GlobalDTMonedas.FiltroPrimero(String.Format("CveMoneda ={0}", CveMoneda)) - If Not IsNothing(dr) Then - Moneda = dr("Moneda").ToString() - MonedaSAT = dr("AbreviaturaSAT").ToString() - MonedaAbreviatura = dr("Abreviatura").ToString() - End If - End If - End Sub - Public Sub SetMetodoPago(ObjClsPaginas As ClsPaginas) - If Not IsNothing(ObjClsPaginas) Then - If Not IsNothing(ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))) Then - MetodoPago = ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))("MetodoPago").ToString() - ClaveMetodoPagoSAT = ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(String.Format(" CveMetodoPago ={0}", CveMetodoPago))("ClaveSAT").ToString() - End If - End If - End Sub - Public Sub SetSubProyecto(obj As ClsPaginas) - If CveSubProyecto > 0 AndAlso Not IsNothing(obj) Then - SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) - End If - End Sub - Public Sub SetSubProyectoMatriz(obj As ClsPaginas) - If Not IsNothing(obj) Then - Dim Row As Data.DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") - If Not IsNothing(Row) Then - SubProyectoMatriz = New Modelos.SubProyectoModel(Row) - End If - End If - End Sub - - Public Property CveClienteSucursal As Integer - Public Property ClienteSucursal As Modelos.SucursalModel - Public Property EnviarA As Modelos.EnviarAModel - Public Property NumeroContrato As String - Public Property PedidoContrato As String - Public Property OrdenCompra As String = "-1" - Public Property CveMetodoPago As Integer - Public Property MetodoPago As String - Public Property ClaveMetodoPagoSAT As String - Public Property CveMetodoPago33 As Integer - Public Property MetodoPago33 As String - Public Property CveFormaPago33 As Integer - Public Property MetodoPagoSAT33 As String - Public Property FormaPago33 As String - Public Property FormaPagoSAT33 As String - Public Property UsoCFDI As String = "" - Public Property CveUsoCFDI As Integer - Public Property ClaveUsoCFDI As String = "" - Public Property CveTipoRelacion As Integer = -1 - Public Property CveEstatusFactura As Integer - Public Property CveVendedor As Integer - Public Property VendedorCodigo As String - Public Property CveSucursalEjecucion As Integer - Public Property FechaEjecucion As Date - Public Property CveSucursalCobranza As Integer - - Public Property CveSubProyectoCobranza As Integer - Public Property CveSubProyectoEjecucion As Integer - Public Property CveOS As Integer - Public Property CveContrato As Integer - Public Property CveVentaPadre As Integer - Public Property CvePrePoliza As Integer - Public Property Entrega As String - Public Property TiempoEntrega As String - Public Property Vigencia As Date - Public Property TipoEstatus As Integer - Public Property CveCondicionEntrega As Integer - Public Property CondicionEntrega As String - - Public Property TipoRelacion As String - Public Property UUIDRelacionados As List(Of String) - - - Public Property CveVentaRelacion As Integer = -1 - Public Property ImporteRelacion As Decimal - - Public Property EsNCAmortizacion As Boolean - Public Property Kilometraje As Decimal - - Public Property CveTipoRetencion As Integer - - Public Property VentaDesglosaIEPS As Boolean - -#End Region - - -#Region "IDisposable Support" - 'Atributos de la clase - Private disposedValue As Boolean = False - - ' IDisposable - Protected Overridable Sub Dispose(disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - '' TODO: dispose managed state (managed objects). - If Not DtDetalle Is Nothing Then DtDetalle.Dispose() - If Not DtAjustes Is Nothing Then DtAjustes.Dispose() - If Not DtAnticipos Is Nothing Then DtAnticipos.Dispose() - If Not DtContratosSerieDetalle Is Nothing Then DtContratosSerieDetalle.Dispose() - If Not DtCotizacionesPS Is Nothing Then DtCotizacionesPS.Dispose() - If Not DtDeduccion Is Nothing Then DtDeduccion.Dispose() - If Not DtDesgloseImpuestos Is Nothing Then DtDesgloseImpuestos.Dispose() - If Not DtDocumentacionCliente Is Nothing Then DtDocumentacionCliente.Dispose() - If Not DtDocumentosRelacionados Is Nothing Then DtDocumentosRelacionados.Dispose() - If Not DtFirmas Is Nothing Then DtFirmas.Dispose() - If Not DtImpuestosLocales Is Nothing Then DtImpuestosLocales.Dispose() - If Not DtInventario Is Nothing Then DtInventario.Dispose() - If Not DtNCVinculadas Is Nothing Then DtNCVinculadas.Dispose() - If Not DTOrdenesCompraPS Is Nothing Then DTOrdenesCompraPS.Dispose() - If Not DtOtrosConceptos Is Nothing Then DtOtrosConceptos.Dispose() - If Not DtPagos Is Nothing Then DtPagos.Dispose() - If Not DtPedidos2 Is Nothing Then DtPedidos2.Dispose() - If Not DtPedidos2PS Is Nothing Then DtPedidos2PS.Dispose() - If Not DtPromociones Is Nothing Then DtPromociones.Dispose() - If Not DtRecepcionUsados Is Nothing Then DtRecepcionUsados.Dispose() - If Not DtRemConceptosSurtidos Is Nothing Then DtRemConceptosSurtidos.Dispose() - If Not DtRemisiones Is Nothing Then DtRemisiones.Dispose() - If Not DtRemisionesPS Is Nothing Then DtRemisionesPS.Dispose() - If Not DtVentasNC Is Nothing Then DtVentasNC.Dispose() - End If - End If - Me.disposedValue = True - End Sub - ' This code added by Visual Basic to correctly implement the disposable pattern. - Public Sub Dispose() Implements IDisposable.Dispose - ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - -#Region "G L O B A L - D T" - Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double - Get - If GlobalTipoCambio <= 0 Then - 'sino tiene dato lo recargo por si ya esta insertado - If Fecha = MinFecha Then Fecha = Now - - Dim ObjGral As New ClsGenerales - If ObjGral.GetTipoCambio(-1, Fecha) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then - - HttpContext.Current.Application("GlobalTipoCambio") = ObjGral.DtResultados.Rows(0)("TipoCambio").ToString.ToDouble - Else - HttpContext.Current.Application("GlobalTipoCambio") = 0 - End If - ObjGral.Dispose() - - End If - - Return HttpContext.Current.Application("GlobalTipoCambio").ToString.ToDouble - End Get - Set(value As Double) - HttpContext.Current.Application("GlobalTipoCambio") = value - End Set - - End Property - Public Property GlobalTipoCambioEuro(Optional Fecha As Date = MinFecha) As Double - Get - If GlobalTipoCambioEuro <= 0 Then - 'sino tiene dato lo recargo por si ya esta insertado - If Fecha = MinFecha Then Fecha = Now - - Dim ObjGral As New ClsGenerales - If ObjGral.GetTipoCambio(-1, Fecha) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then - - HttpContext.Current.Application("GlobalTipoCambioEuro") = ObjGral.DtResultados.Rows(0)("TipoCambioEuro").ToString.ToDouble - Else - HttpContext.Current.Application("GlobalTipoCambioEuro") = 0 - End If - ObjGral.Dispose() - - End If - - Return HttpContext.Current.Application("GlobalTipoCambioEuro").ToString.ToDouble - End Get - Set(value As Double) - HttpContext.Current.Application("GlobalTipoCambioEuro") = value - End Set - - End Property - 'Property GlobalValidarCFDI As Boolean - ' Get - ' GlobalValidarCFDI = CBool(HttpContext.Current.Application("GlobalValidarCFDI")) - ' End Get - ' Set(value As Boolean) - ' HttpContext.Current.Application("GlobalValidarCFDI") = value - ' End Set - 'End Property - Property GlobalDTUsuarios(Optional CveUsuario As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCliente As Integer = -1, Optional CveProveedor As Integer = -1) As DataTable - Get - Dim Str As New StringBuilder - If CveUsuario <> -1 Then Str.AppendFormat("CveUsuario = {0}", CveUsuario) - If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa) - If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente) - If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor) - - If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTUsuarios = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUsuarios = DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUsuarios") = value - End Set - End Property - Property GlobalDTNomConceptos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTNomConceptos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTNomConceptos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTNomConceptos = DirectCast(HttpContext.Current.Application("GlobalDTNomConceptos"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTNomConceptos") = value - End Set - End Property - Property GlobalDTTiposGastos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTiposGastos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTiposGastos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTiposGastos = DirectCast(HttpContext.Current.Application("GlobalDTTiposGastos"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTiposGastos") = value - End Set - End Property - Property GlobalDTMFActividad(CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveActividad As Integer = -1) As DataTable - Get - - Dim dt As DataTable = Nothing - Dim ObjMF As New ClsMF - - If ObjMF.GetActividad(CveActividad, CveEmpresa, Estatus) Then - dt = ObjMF.DtResultados - End If - - ObjMF.Dispose() - GlobalDTMFActividad = dt - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTActividad") = value - End Set - End Property - Property GlobalDTMFOperador(CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveOperador As Integer = -1) As DataTable - Get - - Dim dt As DataTable = Nothing - Dim ObjMF As New ClsMF - - If ObjMF.GetOperador(CveOperador, CveEmpresa, Estatus) Then - dt = ObjMF.DtResultados - End If - - ObjMF.Dispose() - GlobalDTMFOperador = dt - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOperador") = value - End Set - End Property - Property GlobalDTMFEstatus(CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable - Get - - Dim dt As DataTable = Nothing - Dim ObjMF As New ClsMF - - If ObjMF.GetEstatus(CveEstatus, Estatus, CveEmpresa) Then - dt = ObjMF.DtResultados - End If - - ObjMF.Dispose() - GlobalDTMFEstatus = dt - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstatus") = value - End Set - End Property - Property DtFacturaDefault() As DataTable - Get - DtFacturaDefault = DirectCast(HttpContext.Current.Application("DtFacturaDefault"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("DtFacturaDefault") = value - End Set - End Property - Property Directorio() As String - Get - Directorio = DirectCast(HttpContext.Current.Application("Directorio"), String) - End Get - Set(value As String) - HttpContext.Current.Application("Directorio") = value - End Set - End Property - Property GlobalDTPSATPS() As DataTable - Get - GlobalDTPSATPS = DirectCast(HttpContext.Current.Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPSATPS") = value - End Set - End Property - -#Region "GLOBALES DE SAT COMERCIO EXTERIOR" - - Property GlobalDTClavePedimento() As DataTable - Get - GlobalDTClavePedimento = DirectCast(HttpContext.Current.Application("GlobalDTClavePedimento"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClavePedimento") = value - End Set - End Property - - Property GlobalDTFraccionArancelaria() As DataTable - Get - GlobalDTFraccionArancelaria = DirectCast(HttpContext.Current.Application("GlobalDTFraccionArancelaria"), EnumerableRowCollection(Of DataRow)).CopyToDataTable - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTFraccionArancelaria") = value - End Set - End Property - - Property GlobalDTIncoterm() As DataTable - Get - GlobalDTIncoterm = DirectCast(HttpContext.Current.Application("GlobalDTIncoterm"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTIncoterm") = value - End Set - End Property - - Property GlobalDTTipoOperacion() As DataTable - Get - GlobalDTTipoOperacion = DirectCast(HttpContext.Current.Application("GlobalDTTipoOperacion"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoOperacion") = value - End Set - End Property - - Property GlobalDTSATMotivoTraslado() As DataTable - Get - GlobalDTSATMotivoTraslado = DirectCast(HttpContext.Current.Application("GlobalDTSATMotivoTraslado"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSATMotivoTraslado") = value - End Set - End Property - - Property GlobalDTUnidadAduana() As DataTable - Get - GlobalDTUnidadAduana = DirectCast(HttpContext.Current.Application("GlobalDTUnidadAduana"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUnidadAduana") = value - End Set - End Property - - Property GlobalDTPais() As DataTable - Get - GlobalDTPais = DirectCast(HttpContext.Current.Application("GlobalDTPais"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPais") = value - End Set - End Property - - Property GlobalDTEstado(ClaveSATPais As String) As DataTable - Get - If ClaveSATPais <> "-1" Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTEstado"), DataTable), String.Format("ClaveSATPais = '{0}'", ClaveSATPais), "", DataViewRowState.CurrentRows) - GlobalDTEstado = Dv.ToTable - Dv.Dispose() - Else - GlobalDTEstado = DirectCast(HttpContext.Current.Application("GlobalDTEstado"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstado") = value - End Set - End Property - - Property GlobalDTMunicipio(ClaveSATEstado As String) As DataTable - Get - If ClaveSATEstado <> "-1" Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTMunicipio"), DataTable), String.Format("ClaveSATEstado = '{0}'", ClaveSATEstado), "", DataViewRowState.CurrentRows) - GlobalDTMunicipio = Dv.ToTable - Dv.Dispose() - Else - GlobalDTMunicipio = DirectCast(HttpContext.Current.Application("GlobalDTMunicipio"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMunicipio") = value - End Set - End Property - - Property GlobalDTColonia(ClaveSATMunicipio As String) As DataTable - Get - If ClaveSATMunicipio <> "-1" Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTColonia"), DataTable), String.Format("ClaveSATMunicipio = '{0}'", ClaveSATMunicipio), "", DataViewRowState.CurrentRows) - GlobalDTColonia = Dv.ToTable - Dv.Dispose() - Else - GlobalDTColonia = DirectCast(HttpContext.Current.Application("GlobalDTColonia"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTColonia") = value - End Set - End Property - -#End Region - - Property GlobalDTPSATUM() As DataTable - Get - GlobalDTPSATUM = DirectCast(HttpContext.Current.Application("GlobalDTPSATUM"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPSATUM") = value - End Set - End Property - Property GlobalDTNomConceptosFunciones() As DataTable - Get - GlobalDTNomConceptosFunciones = DirectCast(HttpContext.Current.Application("GlobalDTNomConceptosFunciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTNomConceptosFunciones") = value - End Set - End Property - Property GlobalDTUsuarioResponsable() As DataTable - Get - GlobalDTUsuarioResponsable = DirectCast(HttpContext.Current.Application("GlobalDTUsuarioResponsable"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUsuarioResponsable") = value - End Set - End Property - Property GlobalDTProveedoresCuentas(CveProveedor As Integer, Estatus As Boolean) As DataTable - Get - GlobalDTProveedoresCuentas = DirectCast(HttpContext.Current.Application("GlobalDTProveedoresCuentas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProveedoresCuentas") = value - End Set - End Property - - Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias-{0}", CveEmpresa) - - - If CvePS <> -1 OrElse CveUM <> -1 Then - Dim StrSQL As New StringBuilder - If CvePS <> -1 Then StrSQL.AppendFormat(" AND CvePS = {0}", CvePS) - If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosEquivalencias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) - End If - End Get - - End Property - Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProveedorClasificacion"), DataTable), String.Format("CveEmpresa ={0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProveedorClasificacion = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProveedorClasificacion = DirectCast(HttpContext.Current.Application("GlobalDTProveedorClasificacion"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProveedorClasificacion") = value - End Set - End Property - Property GlobalDTProveedorSucursales(CveProveedor As Integer) As DataTable - Get - If CveProveedor <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProveedorSucursales"), DataTable), String.Format("CveProveedor = {0}", CveProveedor), "", DataViewRowState.CurrentRows) - GlobalDTProveedorSucursales = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProveedorSucursales = DirectCast(HttpContext.Current.Application("GlobalDTProveedorSucursales"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProveedorSucursales") = value - End Set - End Property - Property GlobalDTRoles(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTRoles"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTRoles = Dv.ToTable - Dv.Dispose() - Else - GlobalDTRoles = DirectCast(HttpContext.Current.Application("GlobalDTRoles"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTRoles") = value - End Set - End Property - Property GlobalDTNomSatBancos() As DataTable - Get - GlobalDTNomSatBancos = DirectCast(HttpContext.Current.Application("GlobalDTNomSatBancos"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTNomSatBancos") = value - End Set - End Property - Property GlobalDTNomSatConceptos() As DataTable - Get - GlobalDTNomSatConceptos = DirectCast(HttpContext.Current.Application("GlobalDTNomSatConceptos"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTNomSatConceptos") = value - End Set - End Property - Property GlobalDTNomSatRegimenContratacion() As DataTable - Get - GlobalDTNomSatRegimenContratacion = DirectCast(HttpContext.Current.Application("GlobalDTNomSatRegimenContratacion"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTNomSatRegimenContratacion") = value - End Set - End Property - Property GlobalDTNomSatRiesgoPuesto() As DataTable - Get - GlobalDTNomSatRiesgoPuesto = DirectCast(HttpContext.Current.Application("GlobalDTNomSatRiesgoPuesto"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTNomSatRiesgoPuesto") = value - End Set - End Property - Property GlobalDTNomSatTipoIncapacidad() As DataTable - Get - GlobalDTNomSatTipoIncapacidad = DirectCast(HttpContext.Current.Application("GlobalDTNomSatTipoIncapacidad"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTNomSatTipoIncapacidad") = value - End Set - End Property - Property GlobalDTEmpresas(Optional CveEmpresa As Integer = -1) As DataTable - Get - - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTEmpresas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTEmpresas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTEmpresas = DirectCast(HttpContext.Current.Application("GlobalDTEmpresas"), DataTable) - End If - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTEmpresas") = value - End Set - End Property - Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - If UsoClasificacion <> -1 Then Str.AppendFormat(" AND UsoClasificacion IN ({0},3) ", UsoClasificacion) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTClasificaciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones"), DataTable) - End If - - - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificaciones") = value - End Set - End Property - Property GlobalDTClasificaciones2(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones2"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTClasificaciones2 = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificaciones2 = DirectCast(HttpContext.Current.Application("GlobalDTClasificaciones2"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificaciones2") = value - End Set - End Property - Property GlobalDTClasificacionesSubProyectos(Optional CveClasificacion As Integer = -1, Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesSubProyecto"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTClasificacionesSubProyectos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificacionesSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesSubProyecto"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionesSubProyecto") = value - End Set - End Property - Property GlobalDTACClasificadorObjetoGasto(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTACClasificadorObjetoGasto"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTACClasificadorObjetoGasto = Dv.ToTable - Dv.Dispose() - Else - GlobalDTACClasificadorObjetoGasto = DirectCast(HttpContext.Current.Application("GlobalDTACClasificadorObjetoGasto"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTACClasificadorObjetoGasto") = value - End Set - End Property - Property GlobalDTClasificacionesDetalle(Optional CveEmpresa As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveClasificacion <> -1 Then Str.AppendFormat(" AND CveClasificacion = {0}", CveClasificacion) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesDetalle"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTClasificacionesDetalle = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificacionesDetalle = DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesDetalle"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionesDetalle") = value - End Set - End Property - Property GlobalDTSubFamilias(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubFamilias"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTSubFamilias = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTSubFamilias = DirectCast(HttpContext.Current.Application("GlobalDTSubFamilias"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSubFamilias") = value - End Set - End Property - Property GlobalDTFamilias(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTFamilias"), DataTable), String.Format("CveEmpresa = {0} ", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTFamilias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTFamilias = DirectCast(HttpContext.Current.Application("GlobalDTFamilias"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTFamilias") = value - End Set - End Property - Property GlobalDTClasificacionesPresupuestos(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesPresupuestos"), DataTable), String.Format("CveEmpresa = {0} ", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTClasificacionesPresupuestos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificacionesPresupuestos = DirectCast(HttpContext.Current.Application("GlobalDTClasificacionesPresupuestos"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionesPresupuestos") = value - End Set - End Property - Property GlobalDTMetodosPago() As DataTable - Get - GlobalDTMetodosPago = DirectCast(HttpContext.Current.Application("GlobalDTMetodosPago"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMetodosPago") = value - End Set - End Property - Property GlobalDTModulos() As DataTable - Get - GlobalDTModulos = DirectCast(HttpContext.Current.Application("GlobalDTModulos"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTModulos") = value - End Set - End Property - Property GlobalDTMonedas() As DataTable - Get - GlobalDTMonedas = DirectCast(HttpContext.Current.Application("GlobalDTMonedas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMonedas") = value - End Set - End Property - Property GlobalDTMonedasAlias() As DataTable - Get - GlobalDTMonedasAlias = DirectCast(HttpContext.Current.Application("GlobalDTMonedasAlias"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMonedasAlias") = value - End Set - End Property - Property GlobalDTSucursales(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSucursales"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " Sucursal", DataViewRowState.CurrentRows) - GlobalDTSucursales = Dv.ToTable - Dv.Dispose() - Else - GlobalDTSucursales = DirectCast(HttpContext.Current.Application("GlobalDTSucursales"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSucursales") = value - End Set - End Property - Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable - Get - If EsPersonaFisica <> -1 Then - Dim Tipo As String = "" - If EsPersonaFisica = 1 Then Tipo = "AplicaPersonaFisica = 1" Else Tipo = "AplicaPersonaMoral = 1" - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSATUsosCFDI"), DataTable), Tipo, " UsoCFDIDescripcion", DataViewRowState.CurrentRows) - GlobalDTSATUsosCFDI = Dv.ToTable - Dv.Dispose() - Else - GlobalDTSATUsosCFDI = DirectCast(HttpContext.Current.Application("GlobalDTSATUsosCFDI"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTSATUsosCFDI") = value - End Set - End Property - 'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - ' Get - ' If CveEmpresa <> -1 Then - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - ' GlobalDTUnidadesMedida = Dv.ToTable - ' Dv.Dispose() - ' Else - ' GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable) - ' End If - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTUnidadesMedida") = value - ' End Set - 'End Property - 'Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable - ' Get - ' If CveEmpresa <> -1 Then - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - ' GlobalDTUnidadesMedidaAlias = Dv.ToTable - ' Dv.Dispose() - ' Else - ' GlobalDTUnidadesMedidaAlias = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable) - ' End If - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias") = value - ' End Set - 'End Property - Property GlobalDTEstatusOrdenCompra() As DataTable - Get - GlobalDTEstatusOrdenCompra = DirectCast(HttpContext.Current.Application("GlobalDTEstatusOrdenCompra"), DataTable) - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTEstatusOrdenCompra") = value - End Set - End Property - Property GlobalDTLeyendasFiscales() As DataTable - Get - GlobalDTLeyendasFiscales = DirectCast(HttpContext.Current.Application("GlobalDTLeyendasFiscales"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTLeyendasFiscales") = value - End Set - End Property - Property GlobalDTEstatusFactura() As DataTable - Get - GlobalDTEstatusFactura = DirectCast(HttpContext.Current.Application("GlobalDTEstatusFactura"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstatusFactura") = value - End Set - End Property - Property GlobalDTProyectos(CveEmpresa As Integer, Optional Estatus As Integer = -1) As DataTable - Get - - If DirectCast(HttpContext.Current.Application("GlobalDTProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTProyectos"), DataTable).Rows.Count = 0) Then - Dim P As New ClsProyectos - If P.GetProyectos Then - HttpContext.Current.Application("GlobalDTProyectos") = P.DtResultados - End If - P.Dispose() - - End If - - If CveEmpresa <> -1 OrElse Estatus <> -1 Then 'OrElse CveProyecto <> -1 - - Dim StrSQL As New StringBuilder - If CveEmpresa <> -1 Then StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" {0} CveProyecto = {1}", If(StrSQL.Length > 0, "AND", ""), CveProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" {0} CveEstatus = {1}", If(StrSQL.Length > 0, "AND", ""), Estatus) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProyectos"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProyectos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProyectos = DirectCast(HttpContext.Current.Application("GlobalDTProyectos"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - - End If - HttpContext.Current.Application("GlobalDTProyectos") = value - End Set - End Property - - Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = P.DtResultados - P.Dispose() - - Dim msg As String = "aqui no se carga subproyectos" - If HttpContext.Current.Request IsNot Nothing Then - msg = msg & HttpContext.Current.Request.ServerVariables("URL") - End If - msg.GuardaLog() - - End If - - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set - End Property - - Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable - Get - - If HttpContext.Current.Application("GlobalDTSubProyectosUsuarios") Is Nothing Then - Dim ObjSubProyectos As New ClsSubProyectos() - If ObjSubProyectos.GetSubProyectosUsuarios Then HttpContext.Current.Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados Else Alert("Ocurrió un error al cargar los SubProyectos. Por favor comuniquese con sistemas.", TipoMensaje.MsgError) - ObjSubProyectos.Dispose() - End If - - If CveUsuario <> -1 OrElse CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse CveEstatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - If CveUsuario <> -1 Then StrSQL.AppendFormat(" AND CveUsuario = {0}", CveUsuario) - If CveEstatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", CveEstatus) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectosUsuarios"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectosUsuarios = Dv.ToTable - Dv.Dispose() - - Dim ObjSubProyectos As New ClsSubProyectos() - If ObjSubProyectos.GetSubProyectosUsuarios(CveUsuario:=CveUsuario, CveProyecto:=CveProyecto, CveSubProyecto:=CveSubProyecto, CveEstatus:=CveEstatus, CveEmpresa:=CveEmpresa) Then - GlobalDTSubProyectosUsuarios = ObjSubProyectos.DtResultados - Else - GlobalDTSubProyectosUsuarios = Nothing - End If - ObjSubProyectos.Dispose() - - Else - GlobalDTSubProyectosUsuarios = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectosUsuarios"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - - - End If - HttpContext.Current.Application("GlobalDTSubProyectosUsuarios") = value - End Set - End Property - Property GlobalDTProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, CveEstatus As Integer) As DataTable - Get - - If HttpContext.Current.Application("GlobalDTProyectosUsuarios") Is Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTProyectosUsuarios"), DataTable).Rows.Count = 0 Then - Dim ObjSubProyectos As New ClsSubProyectos() - If ObjSubProyectos.GetSubProyectosUsuarios Then HttpContext.Current.Application("GlobalDTProyectosUsuarios") = ObjSubProyectos.DtResultados.FiltraParametros("", "", {"Proyecto", "CveProyecto", "CveUsuario", "CveEmpresa", "CveEstatusProyecto"}) Else Alert("Ocurrió un error al cargar los Proyectos. Por favor comuniquese con sistemas.", TipoMensaje.MsgError) - ObjSubProyectos.Dispose() - GuardaLog("Se Cargo GlobalDTProyectosUsuarios") - End If - - If CveUsuario <> -1 OrElse CveProyecto <> -1 OrElse CveEmpresa <> -1 OrElse CveEstatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - If CveUsuario <> -1 Then StrSQL.AppendFormat(" AND CveUsuario = {0}", CveUsuario) - If CveEstatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatusProyecto = {0}", CveEstatus) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProyectosUsuarios"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTProyectosUsuarios = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProyectosUsuarios = DirectCast(HttpContext.Current.Application("GlobalDTProyectosUsuarios"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - - End If - HttpContext.Current.Application("GlobalDTProyectosUsuarios") = value - End Set - End Property - Property GlobalDTPrecioListas(CveEmpresa As Integer) As DataTable - Get - GlobalDTPrecioListas = DirectCast(HttpContext.Current.Application("GlobalDTPrecioListas"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPrecioListas") = value - End Set - End Property - Property GlobalDTMesas() As DataTable - Get - GlobalDTMesas = DirectCast(HttpContext.Current.Application("GlobalDTMesas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMesas") = value - End Set - End Property - Property GlobalDTTipoOrdenServicios(CveEmpresa As Integer) As DataTable - Get - GlobalDTTipoOrdenServicios = DirectCast(HttpContext.Current.Application("GlobalDTTipoOrdenServicios"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoOrdenServicios") = value - End Set - End Property - Property GlobalDTSubTipoOrdenServicios() As DataTable - Get - GlobalDTSubTipoOrdenServicios = DirectCast(HttpContext.Current.Application("GlobalDTSubTipoOrdenServicios"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSubTipoOrdenServicios") = value - End Set - End Property - Property GlobalDTCaracteristicasOrdenServicios() As DataTable - Get - GlobalDTCaracteristicasOrdenServicios = DirectCast(HttpContext.Current.Application("GlobalDTCaracteristicasOrdenServicios"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCaracteristicasOrdenServicios") = value - End Set - End Property - Property GlobalDTOrdenesServiciosCaracteristicas() As DataTable - Get - GlobalDTOrdenesServiciosCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTOrdenesServiciosCaracteristicas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOrdenesServiciosCaracteristicas") = value - End Set - End Property - Property GlobalDTCaracteristicasOpciones() As DataTable - Get - GlobalDTCaracteristicasOpciones = DirectCast(HttpContext.Current.Application("GlobalDTCaracteristicasOpciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCaracteristicasOpciones") = value - End Set - End Property - Property GlobalDTTipoCuentasEquipos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquipos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTipoCuentasEquipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTipoCuentasEquipos = DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquipos"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoCuentasEquipos") = value - End Set - End Property - Property GlobalDTTipoCuentasEquiposCaracteristicas(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquiposCaracteristicas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTipoCuentasEquiposCaracteristicas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTipoCuentasEquiposCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquiposCaracteristicas"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoCuentasEquiposCaracteristicas") = value - End Set - End Property - Property GlobalDTTipoCuentasEquiposOpciones(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquiposOpciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTipoCuentasEquiposOpciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTipoCuentasEquiposOpciones = DirectCast(HttpContext.Current.Application("GlobalDTTipoCuentasEquiposOpciones"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoCuentasEquiposOpciones") = value - End Set - End Property - ReadOnly Property GlobalDTPS(CveEmpresa As Integer, Optional CvePS As Integer = -1, Optional SATClavePS As String = "-1", Optional AplicaParaVenta As Integer = -1) As DataTable - Get - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPS(CvePS, -1, CveEmpresa, SATClavePS:=SATClavePS, pAplicaParaVenta:=AplicaParaVenta) Then - GlobalDTPS = ObjPS.DtResultados - Else - GlobalDTPS = Nothing - End If - - ObjPS.Dispose() - End Get - End Property - - - - Property GlobalDTInvMetodosInventario() As DataTable - Get - GlobalDTInvMetodosInventario = DirectCast(HttpContext.Current.Application("GlobalDTInvMetodosInventario"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTInvMetodosInventario") = value - End Set - End Property - Property GlobalDTAFCaracteristicasOpciones() As DataTable - Get - GlobalDTAFCaracteristicasOpciones = DirectCast(HttpContext.Current.Application("GlobalDTAFCaracteristicasOpciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAFCaracteristicasOpciones") = value - End Set - End Property - Property GlobalDTAFCaracteristicas() As DataTable - Get - GlobalDTAFCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTAFCaracteristicas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAFCaracteristicas") = value - End Set - End Property - Property GlobalDTAFCaracteristicasClasificaciones() As DataTable - Get - GlobalDTAFCaracteristicasClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTAFCaracteristicasClasificaciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAFCaracteristicasClasificaciones") = value - End Set - End Property - Property GlobalDTImpuestosLocales(CvePS As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CvePS > 0 Then Str.AppendFormat("CvePS = {0}", CvePS) - If CveEmpresa > 0 Then Str.AppendFormat("{0} CveEmpresa = {1}", If(CvePS > 0, " AND ", ""), CveEmpresa) - - If CvePS > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTImpuestosLocales"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTImpuestosLocales = Dv.ToTable - Dv.Dispose() - Else - GlobalDTImpuestosLocales = DirectCast(HttpContext.Current.Application("GlobalDTImpuestosLocales"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTImpuestosLocales") = value - End Set - End Property - 'Bancos - Property GlobalDTBancos() As DataTable - Get - GlobalDTBancos = DirectCast(HttpContext.Current.Application("GlobalDTBancos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTBancos") = value - End Set - End Property - - - 'Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1) As DataTable - ' Get - - ' Dim Str As String = String.Format("CveEmpresa = {0} ", UsuarioActual.CveEmpresa) - ' If CveUsuario > -1 Then Str = String.Format("{0} AND CveUsuario = {1}", Str, CveUsuario) - ' If CveCuenta > -1 Then Str = String.Format("{0} AND CveCuenta = {1}", Str, CveCuenta) - ' If Estatus > -1 Then Str = String.Format("{0} AND Estatus = '{1}'", Str, If(Estatus = 1, "Activo", "Inactivo")) - - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable), Str, "", DataViewRowState.CurrentRows) - ' GlobalDTBancosCuentas = Dv.ToTable - ' Dv.Dispose() - ' 'GlobalDTBancosCuentas = DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable) - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTBancosCuentas") = value - ' End Set - 'End Property - - Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1, Optional CveEmpresa As Integer = -1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTBancosCuentas-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then - Dim ObjBancos As New ClsBancos - If ObjBancos.GetBancosCuentasUsuarios(-1, CveEmpresa) Then - HttpContext.Current.Application(AppNombre) = ObjBancos.DtResultados - Else - HttpContext.Current.Application(AppNombre) = Nothing - End If - ObjBancos.Dispose() - End If - - Dim Str As String = String.Format("CveEmpresa = {0} ", UsuarioActual.CveEmpresa) - If CveUsuario > -1 Then Str = String.Format("{0} AND CveUsuario = {1}", Str, CveUsuario) - If CveCuenta > -1 Then Str = String.Format("{0} AND CveCuenta = {1}", Str, CveCuenta) - If Estatus > -1 Then Str = String.Format("{0} AND Estatus = '{1}'", Str, If(Estatus = 1, "Activo", "Inactivo")) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str, "", DataViewRowState.CurrentRows) - GlobalDTBancosCuentas = Dv.ToTable - Dv.Dispose() - 'GlobalDTBancosCuentas = DirectCast(Application("GlobalDTBancosCuentas"), DataTable) - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTBancosCuentas-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set - End Property - - - - Property GlobalDTTipoTransacciones() As DataTable - Get - If UsuarioActual.CveEmpresa = 66 Then - GlobalDTTipoTransacciones = DirectCast(HttpContext.Current.Application("GlobalDTTipoTransacciones"), DataTable).FiltraParametros("Estatus = 1") - Else - GlobalDTTipoTransacciones = DirectCast(HttpContext.Current.Application("GlobalDTTipoTransacciones"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoTransacciones") = value - End Set - End Property - Property GlobalDTEstatusIE() As DataTable - Get - GlobalDTEstatusIE = DirectCast(HttpContext.Current.Application("GlobalDTEstatusIE"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstatusIE") = value - End Set - End Property - Property GlobalDTBancosIE() As DataTable - Get - GlobalDTBancosIE = DirectCast(HttpContext.Current.Application("GlobalDTBancosIE"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTBancosIE") = value - End Set - End Property - Property GlobalDTTipoCuenta() As DataTable - Get - GlobalDTTipoCuenta = DirectCast(HttpContext.Current.Application("GlobalDTTipoCuenta"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoCuenta") = value - End Set - End Property - 'Fin Bancos - - 'Fin EstadoCIvil - 'TipoPerioso - Property GlobalDTTipoPeriodo() As DataTable - Get - GlobalDTTipoPeriodo = DirectCast(HttpContext.Current.Application("GlobalDTTipoPeriodo"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoPeriodo") = value - End Set - End Property - 'Fin TipoPeriodo - - 'Periodos - Property GlobalDTNominasPeriodos(CveTipoPeriodo As Integer, CvePeriodo As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveTipoPeriodo <> -1 Then Str.AppendFormat(" {0} CveTipoPeriodo = {1}", If(Str.Length > 0, "AND", ""), CveTipoPeriodo) - If CvePeriodo <> -1 Then Str.AppendFormat(" {0} CvePeriodo = {1}", If(Str.Length > 0, "AND", ""), CvePeriodo) - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTNominasPeriodos"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTNominasPeriodos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTNominasPeriodos = DirectCast(HttpContext.Current.Application("GlobalDTNominasPeriodos"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTNominasPeriodos") = value - End Set - End Property - 'Fin Periodos - - 'Fin Ruta - 'Cliente - Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTCliente-{0}", CveEmpresa) - 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados - ObjClientes.Dispose() - End If - - - If CveEmpresa <> -1 Then - - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTCliente = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) - End If - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTCliente-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - 'Dim ObjClientes As New ClsClientes - 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados - 'ObjClientes.Dispose() - End Set - End Property - Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones-{0}", CveEmpresa) - 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteClasificacion(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados - ObjClientes.Dispose() - End If - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTClienteClasificaciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClienteClasificaciones = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) - End If - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - 'Dim ObjClientes As New ClsClientes - 'If ObjClientes.GetClienteClasificacion(CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados - 'ObjClientes.Dispose() - End Set - End Property - Property GlobalDTEstatusOrdenServicios(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTEstatusOrdenServicios"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTEstatusOrdenServicios = Dv.ToTable - Dv.Dispose() - Else - GlobalDTEstatusOrdenServicios = DirectCast(HttpContext.Current.Application("GlobalDTEstatusOrdenServicios"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstatusOrdenServicios") = value - End Set - End Property - 'Variables para Ventas - Property GlobalDTVendedores(CveEmpresa As Integer, Optional Estatus As Boolean = True, Optional VendedorTipo As Integer = 1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTVendedores"), DataTable), String.Format("CveEmpresa = {0} AND CveEstatus = {1} AND VendedorTipo = {2}", CveEmpresa, If(Estatus, 1, 0), VendedorTipo), "", DataViewRowState.CurrentRows) - GlobalDTVendedores = Dv.ToTable - Dv.Dispose() - Else - GlobalDTVendedores = DirectCast(HttpContext.Current.Application("GlobalDTVendedores"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVendedores") = value - End Set - End Property - Property GlobalDTClientesCorporativo(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClientesCorporativo"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTClientesCorporativo = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClientesCorporativo = DirectCast(HttpContext.Current.Application("GlobalDTClientesCorporativo"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClientesCorporativo") = value - End Set - End Property - Property GlobalDTCompProveedores(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCompProveedores"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTCompProveedores = Dv.ToTable - Dv.Dispose() - Else - GlobalDTCompProveedores = DirectCast(HttpContext.Current.Application("GlobalDTCompProveedores"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCompProveedores") = value - End Set - End Property - 'EstatusFactura - Property GlobalDTCompEstatusFactura() As DataTable - Get - GlobalDTCompEstatusFactura = DirectCast(HttpContext.Current.Application("GlobalDTCompEstatusFactura"), DataTable).FiltraParametros("Estatus = 'Activo'") - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCompEstatusFactura") = value - End Set - End Property - Property GlobalDTContratosSecciones() As DataTable - Get - GlobalDTContratosSecciones = DirectCast(HttpContext.Current.Application("GlobalDTContratosSecciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContratosSecciones") = value - End Set - End Property - Property GlobalDTContratos() As DataTable - Get - GlobalDTContratos = DirectCast(HttpContext.Current.Application("GlobalDTContratos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContratos") = value - End Set - End Property - Property GlobalDTContratosTipos() As DataTable - Get - GlobalDTContratosTipos = DirectCast(HttpContext.Current.Application("GlobalDTContratosTipos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContratosTipos") = value - End Set - End Property - Property GlobalDTTipoAlmacen(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTipoAlmacen"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTipoAlmacen = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTipoAlmacen = DirectCast(HttpContext.Current.Application("GlobalDTTipoAlmacen"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoAlmacen") = value - End Set - End Property - Property GlobalDTInvConceptos() As DataTable - Get - - Return DirectCast(HttpContext.Current.Application("GlobalDTInvConceptos"), DataTable) - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTInvConceptos") = value - End Set - End Property - Property GlobalDTSeccionAlmacen(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSeccionAlmacen"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTSeccionAlmacen = Dv.ToTable - Dv.Dispose() - Else - GlobalDTSeccionAlmacen = DirectCast(HttpContext.Current.Application("GlobalDTSeccionAlmacen"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSeccionAlmacen") = value - End Set - End Property - Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1, Optional CveEstatus As Integer = 1, Optional CveAlmacen As Integer = -1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) - 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then - Dim ObjUsr As New ClsInventarios - If ObjUsr.GetAlmacenes(-1, -1, CveEmpresa, -1) Then HttpContext.Current.Application(AppNombre) = ObjUsr.DtResultados - ObjUsr.Dispose() - End If - - Dim Str As New StringBuilder - Str.Append("1=1 AND ") - If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) - If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) - If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) - If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTAlmacen = Dv.ToTable - Dv.Dispose() - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set - 'Get - - ' Dim Str As New StringBuilder - ' Str.Append("1=1 AND ") - ' If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) - ' If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) - ' If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) - ' If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) - - ' Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - ' GlobalDTAlmacen = Dv.ToTable - ' Dv.Dispose() - - 'End Get - 'Set(value As DataTable) - ' Application("GlobalDTAlmacen") = value - 'End Set - End Property - Property GlobalDTAlmacenUsuarios(CveUsuario As Integer, CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = 1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTAlmacenUsuarios-{0}", CveEmpresa) - 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then - Dim ObjUsr As New ClsSisUsuarios - If ObjUsr.GetAlmacen(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUsr.DtResultados - ObjUsr.Dispose() - End If - Dim Str As New StringBuilder - Str.AppendFormat("CveUsuario = {0} AND CveEmpresa = {1} ", CveUsuario, CveEmpresa) - If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTAlmacenUsuarios = Dv.ToTable - Dv.Dispose() - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTAlmacenUsuarios-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set - End Property - Property GlobalDTNom_Periodos() As DataTable - Get - GlobalDTNom_Periodos = DirectCast(HttpContext.Current.Application("GlobalDTNom_Periodos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTNom_Periodos") = value - End Set - End Property - Property GlobalDTVtaFormaPago() As DataTable - Get - GlobalDTVtaFormaPago = DirectCast(HttpContext.Current.Application("GlobalDTVtaFormaPago"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVtaFormaPago") = value - End Set - End Property - Property GlobalDTVtaMetodoPago() As DataTable - Get - GlobalDTVtaMetodoPago = DirectCast(HttpContext.Current.Application("GlobalDTVtaMetodoPago"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVtaMetodoPago") = value - End Set - End Property - Property GlobalDTVtaTiposRelacion() As DataTable - Get - GlobalDTVtaTiposRelacion = DirectCast(HttpContext.Current.Application("GlobalDTVtaTiposRelacion"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVtaTiposRelacion") = value - End Set - End Property - Property GlobalDTTiposDocumentos() As DataTable - Get - GlobalDTTiposDocumentos = DirectCast(HttpContext.Current.Application("GlobalDTTiposDocumentos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTiposDocumentos") = value - End Set - End Property - Property GlobalDTCobranzaEstatus(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTVtaCobranzaEstatus"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTCobranzaEstatus = Dv.ToTable - Dv.Dispose() - Else - GlobalDTCobranzaEstatus = DirectCast(HttpContext.Current.Application("GlobalDTVtaCobranzaEstatus"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVtaCobranzaEstatus") = value - End Set - End Property - - -#Region "***********************************************************************DT EVENTOS****************************************************************************************" - Property GlobalDTTiposEventos() As DataTable - Get - GlobalDTTiposEventos = DirectCast(HttpContext.Current.Application("GlobalDTTiposEventos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTiposEventos") = value - End Set - End Property - - Property GlobalDTEventos() As DataTable - Get - GlobalDTEventos = DirectCast(HttpContext.Current.Application("GlobalDTEventos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEventos") = value - End Set - End Property - - Property GlobalDTOIEventoTarea() As DataTable - Get - GlobalDTOIEventoTarea = DirectCast(HttpContext.Current.Application("GlobalDTOIEventoTarea"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOIEventoTarea") = value - End Set - End Property - - Property GlobalDTOIEstatusEventos() As DataTable - Get - GlobalDTOIEstatusEventos = DirectCast(HttpContext.Current.Application("GlobalDTOIEstatusEventos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOIEstatusEventos") = value - End Set - End Property -#End Region - -#Region " **********************************************************************DT PROSPECTOS*************************************************************************************" - Property GlobalDTProspectosCaracteristicasClasificaciones() As DataTable - Get - GlobalDTProspectosCaracteristicasClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTProspectosCaracteristicasClasificaciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosCaracteristicasClasificaciones") = value - End Set - End Property - Property GlobalDTProspectosTiposCaracteristicas() As DataTable - Get - GlobalDTProspectosTiposCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTProspectosTiposCaracteristicas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosTiposCaracteristicas") = value - End Set - End Property - Property GlobalDTProspectosCaracteristicas(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosCaracteristicas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosCaracteristicas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTProspectosCaracteristicas"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosCaracteristicas") = value - End Set - End Property - - Property GlobalDTProspectosCaracteristicasOpciones() As DataTable - Get - GlobalDTProspectosCaracteristicasOpciones = DirectCast(HttpContext.Current.Application("GlobalDTProspectosCaracteristicasOpciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosCaracteristicasOpciones") = value - End Set - End Property -#End Region - -#Region "***********************************************************************DT ACTIVOS FIJOS**********************************************************************************" - Property GlobalDTActivoFijos(CveEmpresa As Integer, Optional CveSubTipoActivoFijo As Integer = -1, Optional CveActivoFijo As Integer = -1) As DataTable - Get - Dim dt As DataTable = Nothing - 'Dim Str As New StringBuilder - 'Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - 'If CveSubTipoActivoFijo <> -1 Then Str.AppendFormat(" AND CveSubTipoActivoFijo = {0}", CveSubTipoActivoFijo) - - Dim ObjAF As New ClsAF - 'If ObjAF.GetActivosFijos(CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, -1, "-1", -1, -1, -1, -1, -1) Then - If ObjAF.GetActivosFijos(CveActivoFijo, CveEmpresa, "-1", "-1", -1, CveSubTipoActivoFijo, "-1", -1, -1, -1, -1, -1, "", -1) Then - dt = ObjAF.DtResultados - End If - - ObjAF.Dispose() - GlobalDTActivoFijos = dt - - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTActivoFijos") = value - End Set - End Property - Property GlobalDTEstadoActivoFijo() As DataTable - Get - GlobalDTEstadoActivoFijo = DirectCast(HttpContext.Current.Application("GlobalDTEstadoActivoFijo"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstadoActivoFijo") = value - End Set - End Property - Property GlobalDTMarcaActivoFijo(CveEmpresa As Integer) As DataTable - Get - Dim dt As DataTable = Nothing - - Dim ObjAF As New ClsAF - - If ObjAF.GetMarcasActivosFijos(CveEmpresa) Then - dt = ObjAF.DtResultados - End If - - ObjAF.Dispose() - GlobalDTMarcaActivoFijo = dt - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMarcaActivoFijo") = value - End Set - End Property - Property GlobalDTModeloActivoFijo(CveEmpresa As Integer, CveMarca As Integer) As DataTable - Get - Dim dt As DataTable = Nothing - - Dim ObjAF As New ClsAF - - If ObjAF.GetModelosActivosFijos(CveEmpresa, CveMarca) Then - dt = ObjAF.DtResultados - End If - - ObjAF.Dispose() - GlobalDTModeloActivoFijo = dt - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTModeloActivoFijo") = value - End Set - End Property - - Property GlobalDTSubTipoActivoFijo(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubTipoActivoFijo"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTSubTipoActivoFijo = Dv.ToTable - Dv.Dispose() - Else - GlobalDTSubTipoActivoFijo = DirectCast(HttpContext.Current.Application("GlobalDTSubTipoActivoFijo"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTSubTipoActivoFijo") = value - End Set - End Property - Property GlobalDTTipoActivoFijo(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTTipoActivoFijo"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTTipoActivoFijo = Dv.ToTable - Dv.Dispose() - Else - GlobalDTTipoActivoFijo = DirectCast(HttpContext.Current.Application("GlobalDTTipoActivoFijo"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoActivoFijo") = value - End Set - End Property - -#End Region - -#Region "***********************************************************************DT GENERALES**************************************************************************************" - Property GlobalDTGralPaises() As DataTable - Get - GlobalDTGralPaises = DirectCast(HttpContext.Current.Application("GlobalDTGralPaises"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralPaises") = value - End Set - End Property - Property GlobalDTGralEstados(CvePais As Integer) As DataTable - Get - GlobalDTGralEstados = DirectCast(HttpContext.Current.Application("GlobalDTGralEstados"), DataTable).FiltraParametros(String.Format("CvePais ={0}", CvePais)) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralEstados") = value - End Set - End Property - Property GlobalDTGralMunicipios(CveEstado As Integer) As DataTable - Get - GlobalDTGralMunicipios = DirectCast(HttpContext.Current.Application("GlobalDTGralMunicipios"), DataTable).FiltraParametros(String.Format("CveEstado ={0}", CveEstado)) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralMunicipios") = value - End Set - End Property - - Property GlobalDTGralPoblaciones() As DataTable - Get - GlobalDTGralPoblaciones = DirectCast(HttpContext.Current.Application("GlobalDTGralPoblaciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralPoblaciones") = value - End Set - End Property - Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable - - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTGralCategorias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralCategorias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralCategorias = DirectCast(HttpContext.Current.Application("GlobalDTGralCategorias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralCategorias") = value - End Set - End Property - Property GlobalDTGralCategorias2(CveEmpresa As Integer) As DataTable - - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCategorias2"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralCategorias2 = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralCategorias2 = DirectCast(HttpContext.Current.Application("GlobalDTCategorias2"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCategorias2") = value - End Set - End Property - - Property GlobalDTGralEscolaridades() As DataTable - Get - GlobalDTGralEscolaridades = DirectCast(HttpContext.Current.Application("GlobalDTGralEscolaridades"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralEscolaridades") = value - End Set - End Property - - Property GlobalDTGralColectivas(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTGralColectivas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralColectivas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralColectivas = DirectCast(HttpContext.Current.Application("GlobalDTGralColectivas"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGralColectivas") = value - End Set - End Property - -#End Region - -#Region "***********************************************************************DT PROSPECTOS*************************************************************************************" - Property GlobalDTProspectosSupervisores(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosSupervisores"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosSupervisores = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosSupervisores = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSupervisores"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosSupervisores") = value - End Set - End Property - Property GlobalDTProspectosCoordinadores(CveSupervisor As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveSupervisor <> -1 Then Str.AppendFormat(" {0} CveSupervisor = {1}", If(Str.Length > 0, "AND", ""), CveSupervisor) - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosCoordinadores"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosCoordinadores = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProspectosCoordinadores = DirectCast(HttpContext.Current.Application("GlobalDTProspectosCoordinadores"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosCoordinadores") = value - End Set - End Property - Property GlobalDTProspectosApoyos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosApoyos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosApoyos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosApoyos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosApoyos"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosApoyos") = value - End Set - End Property - Property GlobalDTProspectosClasificaciones(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosClasificaciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosClasificaciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTProspectosClasificaciones"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosClasificaciones") = value - End Set - End Property - Property GlobalDTProspectosEventosTipo(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEventosTipo"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosEventosTipo = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosEventosTipo = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEventosTipo"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEventosTipo") = value - End Set - End Property - Property GlobalDTProspectosEvento(CveEventoTipo As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveEventoTipo <> -1 Then Str.AppendFormat(" {0} CveEventoTipo = {1}", If(Str.Length > 0, "AND", ""), CveEventoTipo) - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEvento"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosEvento = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosEvento = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEvento"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEvento") = value - End Set - End Property - Property GlobalDTProspectosEstatus(CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEstatus"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosEstatus = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosEstatus = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEstatus"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEstatus") = value - End Set - End Property - Property GlobalDTProspectosApoyosTipos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosApoyosTipos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosApoyosTipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosApoyosTipos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosApoyosTipos"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosApoyosTipos") = value - End Set - End Property - Property GlobalDTProspectosApoyosTipos() As DataTable - Get - GlobalDTProspectosApoyosTipos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosApoyosTipos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosApoyosTipos") = value - End Set - End Property - Property GlobalDTProspectosEncuestas(CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestas"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosEncuestas = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProspectosEncuestas = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestas"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEncuestas") = value - End Set - End Property - Property GlobalDTProspectosEncuestasPreguntas(CveEncuesta As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveEncuesta <> -1 Then Str.AppendFormat(" {0} CveEncuesta = {1}", If(Str.Length > 0, "AND", ""), CveEncuesta) - - - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestasPreguntas"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosEncuestasPreguntas = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProspectosEncuestasPreguntas = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestasPreguntas"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEncuestasPreguntas") = value - End Set - End Property - Property GlobalDTProspectosEncuestasRespuestas(CvePregunta As Integer, CveEncuesta As Integer, CveEmpresa As Integer) As DataTable - Get - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveEncuesta <> -1 Then Str.AppendFormat(" {0} CveEncuesta = {1}", If(Str.Length > 0, "AND", ""), CveEncuesta) - If CvePregunta <> -1 Then Str.AppendFormat(" {0} CvePregunta = {1}", If(Str.Length > 0, "AND", ""), CvePregunta) - - - If Str.Length > 0 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestasRespuestas"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProspectosEncuestasRespuestas = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTProspectosEncuestasRespuestas = DirectCast(HttpContext.Current.Application("GlobalDTProspectosEncuestasRespuestas"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosEncuestasRespuestas") = value - End Set - End Property - Property GlobalDTProspectosTipos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosTipos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosTipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosTipos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosTipos"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosTipos") = value - End Set - End Property - -#Region " DT PROSPECTOS SOLICITUDES" - Property GlobalDTProspectosSolicitudes(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudes"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosSolicitudes = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosSolicitudes = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudes"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosSolicitudes") = value - End Set - End Property - Property GlobalDTProspectosSolicitudesEstatus(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesEstatus"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosSolicitudesEstatus = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosSolicitudesEstatus = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesEstatus"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosSolicitudesEstatus") = value - End Set - End Property - Property GlobalDTProspectosSolicitudesTipos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesTipos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosSolicitudesTipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosSolicitudesTipos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesTipos"), DataTable) - End If - End Get - - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosSolicitudesTipos") = value - End Set - End Property - 'Property GlobalDTProspectosSolicitudesTipos() As DataTable - ' Get - ' GlobalDTProspectosSolicitudesTipos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesTipos"), DataTable) - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTProspectosSolicitudesTipos") = value - ' End Set - 'End Property - Property GlobalDTProspectosSolicitudesApoyos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesApoyos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProspectosSolicitudesApoyos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProspectosSolicitudesApoyos = DirectCast(HttpContext.Current.Application("GlobalDTProspectosSolicitudesApoyos"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProspectosSolicitudesApoyos") = value - End Set - End Property - -#End Region -#End Region - -#Region "**********************************************DT AMORTIZACIÓN CONTABLE PLAN DE DESARROLLO********************************************************************************" - -#Region "***********************************************************************DT AMORTIZACIÓN CONTABLE*********************************************************************************************" - - Property GlobalDTAC_RubrosIngreso() As DataTable - Get - GlobalDTAC_RubrosIngreso = DirectCast(HttpContext.Current.Application("GlobalDTAC_RubrosIngreso"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_RubrosIngreso") = value - End Set - End Property - Property GlobalDTAC_FuentesRecaudacion(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesRecaudacion"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTAC_FuentesRecaudacion = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_FuentesRecaudacion = DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesRecaudacion"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_FuentesRecaudacion") = value - End Set - End Property - - Property GlobalDTAC_FuentesFinanciamiento() As DataTable - Get - GlobalDTAC_FuentesFinanciamiento = DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamiento"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamiento") = value - End Set - End Property - Property GlobalDTAC_OG() As DataTable - Get - GlobalDTAC_OG = DirectCast(HttpContext.Current.Application("GlobalDTAC_OG"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_OG") = value - End Set - End Property - 'Property GlobalDTAC_ClasificadorOG(CveEmpresa As Integer) As DataTable - ' Get - ' If CveEmpresa <> -1 Then - ' Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificadorOG"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - ' GlobalDTAC_ClasificadorOG = Dv.ToTable - ' Dv.Dispose() - ' Else - ' GlobalDTAC_ClasificadorOG = DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificadorOG"), DataTable) - ' End If - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTAC_ClasificadorOG") = value - ' End Set - 'End Property - Property GlobalDTAC_Ubicaciones() As DataTable - Get - GlobalDTAC_Ubicaciones = DirectCast(HttpContext.Current.Application("GlobalDTAC_Ubicaciones"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_Ubicaciones") = value - End Set - End Property - Property GlobalDTAC_UnidadesAdministrativas(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_UnidadesAdministrativas"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTAC_UnidadesAdministrativas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_UnidadesAdministrativas = DirectCast(HttpContext.Current.Application("GlobalDTAC_UnidadesAdministrativas"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_UnidadesAdministrativas") = value - End Set - End Property - Property GlobalDTAC_ClasificacionFuncional(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionFuncional"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAC_ClasificacionFuncional = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_ClasificacionFuncional = DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionFuncional"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ClasificacionFuncional") = value - End Set - End Property - Property GlobalDTAC_ClasificacionGeografica(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionGeografica"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAC_ClasificacionGeografica = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_ClasificacionGeografica = DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionGeografica"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ClasificacionGeografica") = value - End Set - End Property - Property GlobalDTAC_Cuentas() As DataTable - Get - GlobalDTAC_Cuentas = DirectCast(HttpContext.Current.Application("GlobalDTAC_Cuentas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_Cuentas") = value - End Set - End Property - Property GlobalDTAC_Finalidad() As DataTable - Get - GlobalDTAC_Finalidad = DirectCast(HttpContext.Current.Application("GlobalDTAC_Finalidad"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_Finalidad") = value - End Set - End Property - 'Property GlobalDTAC_FuenteFinanciamiento() As DataTable - ' Get - ' GlobalDTAC_FuenteFinanciamiento = DirectCast(HttpContext.Current.Application("GlobalDTAC_FuenteFinanciamiento"), DataTable) - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTAC_FuenteFinanciamiento") = value - ' End Set - 'End Property - Property GlobalDTAC_FuentesFinanciamiento(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamiento"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTAC_FuentesFinanciamiento = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_FuentesFinanciamiento = DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamiento"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamiento") = value - End Set - End Property - Property GlobalDTAC_FuentesFinanciamientoCONAC() As DataTable - Get - GlobalDTAC_FuentesFinanciamientoCONAC = DirectCast(HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamientoCONAC"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_FuentesFinanciamientoCONAC") = value - End Set - End Property - Property GlobalDTAC_Funcion() As DataTable - Get - GlobalDTAC_Funcion = DirectCast(HttpContext.Current.Application("GlobalDTAC_Funcion"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_Funcion") = value - End Set - End Property - Property GlobalDTAC_Programas() As DataTable - Get - GlobalDTAC_Programas = DirectCast(HttpContext.Current.Application("GlobalDTAC_Programas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_Programas") = value - End Set - End Property - Property GlobalDTAC_ProgramasCONAC() As DataTable - Get - GlobalDTAC_ProgramasCONAC = DirectCast(HttpContext.Current.Application("GlobalDTAC_ProgramasCONAC"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ProgramasCONAC") = value - End Set - End Property - Property GlobalDTAC_ProyectosProceso() As DataTable - Get - GlobalDTAC_ProyectosProceso = DirectCast(HttpContext.Current.Application("GlobalDTAC_ProyectosProceso"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ProyectosProceso") = value - End Set - End Property - Property GlobalDTAC_SubFuncion() As DataTable - Get - GlobalDTAC_SubFuncion = DirectCast(HttpContext.Current.Application("GlobalDTAC_SubFuncion"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_SubFuncion") = value - End Set - End Property - Property GlobalDTAC_SubProgramas() As DataTable - Get - GlobalDTAC_SubProgramas = DirectCast(HttpContext.Current.Application("GlobalDTAC_SubProgramas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_SubProgramas") = value - End Set - End Property - Property GlobalDTAC_ClasificacionAdministrativa(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionAdministrativa"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAC_ClasificacionAdministrativa = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_ClasificacionAdministrativa = DirectCast(HttpContext.Current.Application("GlobalDTAC_ClasificacionAdministrativa"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ClasificacionAdministrativa") = value - End Set - End Property - Property GlobalDTAC_TipoGasto() As DataTable - Get - GlobalDTAC_TipoGasto = DirectCast(HttpContext.Current.Application("GlobalDTAC_TipoGasto"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_TipoGasto") = value - End Set - End Property - - Property GlobalDTAC_ProgramaOperativo(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_ProgramaOperativo"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAC_ProgramaOperativo = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_ProgramaOperativo = DirectCast(HttpContext.Current.Application("GlobalDTAC_ProgramaOperativo"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_ProgramaOperativo") = value - End Set - End Property - - Property GlobalDTAC_MatrizIngresos() As DataTable - Get - GlobalDTAC_MatrizIngresos = DirectCast(HttpContext.Current.Application("GlobalDTAC_MatrizIngresos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_MatrizIngresos") = value - End Set - End Property - - Property GlobalDTAC_MatrizEgresos() As DataTable - Get - GlobalDTAC_MatrizEgresos = DirectCast(HttpContext.Current.Application("GlobalDTAC_MatrizEgresos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_MatrizEgresos") = value - End Set - End Property - - -#End Region - - Property GlobalDTAC_PD_EjeRector(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_EjeRector"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTAC_PD_EjeRector = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_PD_EjeRector = DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_EjeRector"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_PD_EjeRector") = value - End Set - End Property - - Property GlobalDTAC_PD_Programas(CveEjeRector As Integer) As DataTable - Get - If CveEjeRector <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Programas"), DataTable), String.Format("CveEjeRector = {0}", CveEjeRector), "", DataViewRowState.CurrentRows) - GlobalDTAC_PD_Programas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_PD_Programas = DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Programas"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_PD_Programas") = value - End Set - End Property - - Property GlobalDTAC_PD_Estrategias(CveProgramas As Integer) As DataTable - Get - If CveProgramas <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Estrategias"), DataTable), String.Format("CvePrograma = {0}", CveProgramas), "", DataViewRowState.CurrentRows) - GlobalDTAC_PD_Estrategias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_PD_Estrategias = DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Estrategias"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_PD_Estrategias") = value - End Set - End Property - - Property GlobalDTAC_PD_LineasAccion(CveEstrategias As Integer) As DataTable - Get - If CveEstrategias <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_LineasAccion"), DataTable), String.Format("CveEstrategia = {0}", CveEstrategias), "", DataViewRowState.CurrentRows) - GlobalDTAC_PD_LineasAccion = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_PD_LineasAccion = DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_LineasAccion"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_PD_LineasAccion") = value - End Set - End Property - - Property GlobalDTAC_PD_Metas(CveLineasAccion As Integer) As DataTable - Get - If CveLineasAccion <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Metas"), DataTable), String.Format("CveLineaAccion = {0}", CveLineasAccion), "", DataViewRowState.CurrentRows) - GlobalDTAC_PD_Metas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTAC_PD_Metas = DirectCast(HttpContext.Current.Application("GlobalDTAC_PD_Metas"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAC_PD_Metas") = value - End Set - End Property -#End Region - -#Region "***********************************************************************GLOBAL DT ORDENES DE COMPRA***********************************************************************" - - Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable - Get - - Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then - - Dim ObjOC As New ClsOC - If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then - HttpContext.Current.Application(AppNombre) = ObjOC.DtResultados - Else - HttpContext.Current.Application(AppNombre) = Nothing - End If - - ObjOC.Dispose() - - End If - - Dim filtro As New StringBuilder - filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa) - If CveUsuario > 0 Then - filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario) - End If - If Tipo <> "" Then - filtro.AppendFormat(" AND Tipo='{0}'", Tipo) - End If - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) - GlobalDTOCEstatusUsuarios = Dv.ToTable - Dv.Dispose() - - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set - End Property - - - Property GlobalDTOCEstatus(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTOCEstatus"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTOCEstatus = Dv.ToTable - Dv.Dispose() - Else - GlobalDTOCEstatus = DirectCast(HttpContext.Current.Application("GlobalDTOCEstatus"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOCEstatus") = value - End Set - End Property - - - 'Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable - ' Get - ' If CveEmpresa <> -1 Then - ' Dim filtro As New StringBuilder - ' filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa) - ' If CveUsuario > 0 Then - ' filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario) - ' End If - ' If Tipo <> "" Then - ' filtro.AppendFormat(" AND Tipo='{0}'", Tipo) - ' End If - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTOCEstatusUsuarios"), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) - ' GlobalDTOCEstatusUsuarios = Dv.ToTable - ' Dv.Dispose() - ' Else - ' GlobalDTOCEstatusUsuarios = DirectCast(HttpContext.Current.Application("GlobalDTOCEstatusUsuarios"), DataTable) - ' End If - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTOCEstatusUsuarios") = value - ' End Set - 'End Property - - -#End Region - -#Region "F I N A N Z A S " - Property GlobalDTFinan_RazonesFinancieras() As DataTable - Get - GlobalDTFinan_RazonesFinancieras = DirectCast(HttpContext.Current.Application("GlobalDTFinan_RazonesFinancieras"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTFinan_RazonesFinancieras") = value - End Set - End Property -#End Region - - -#Region "***********************************************************************GLOBAL DT CONTABILIDAD****************************************************************************" - Property GlobalDTContaPlantillasPolizas(CveEmpresa As Integer, Optional TipoPlantilla As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Or TipoPlantilla <> -1 Then - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - If TipoPlantilla <> -1 Then Str.AppendFormat(" AND TipoPlantilla = {0}", TipoPlantilla) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTContaPlantillasPolizas"), DataTable), Str.ToString.Substring(5), "", DataViewRowState.CurrentRows) - GlobalDTContaPlantillasPolizas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTContaPlantillasPolizas = DirectCast(HttpContext.Current.Application("GlobalDTContaPlantillasPolizas"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContaPlantillasPolizas") = value - End Set - End Property - - Property GlobalDTContaPlantillasPolizasDetalle(CvePlantillaPoliza As Integer) As DataTable - Get - If CvePlantillaPoliza <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTContaPlantillasPolizasDetalle"), DataTable), String.Format("CvePlantillaPoliza = {0}", CvePlantillaPoliza), "", DataViewRowState.CurrentRows) - GlobalDTContaPlantillasPolizasDetalle = Dv.ToTable - Dv.Dispose() - Else - GlobalDTContaPlantillasPolizasDetalle = DirectCast(HttpContext.Current.Application("GlobalDTContaPlantillasPolizasDetalle"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContaPlantillasPolizasDetalle") = value - End Set - End Property - - - - Property GlobalDTContaConceptosContables(CvePlantillaPoliza As Integer) As DataTable - Get - If CvePlantillaPoliza <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTContaConceptosContables"), DataTable), String.Format("CvePlantillaPoliza = {0}", CvePlantillaPoliza), "", DataViewRowState.CurrentRows) - GlobalDTContaConceptosContables = Dv.ToTable - Dv.Dispose() - Else - GlobalDTContaConceptosContables = DirectCast(HttpContext.Current.Application("GlobalDTContaConceptosContables"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTContaConceptosContables") = value - End Set - End Property -#End Region - -#Region "**********************************************************************GLOBAL DT RH (RECURSOS HUMANOS)********************************************************************" - Property GlobalDTAsistenciaDetalle() As DataTable - Get - GlobalDTAsistenciaDetalle = DirectCast(HttpContext.Current.Application("GlobalDTAsistenciaDetalle"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAsistenciaDetalle") = value - End Set - End Property - Property GlobalDTAsistenciasInasistencias() As DataTable - Get - GlobalDTAsistenciasInasistencias = DirectCast(HttpContext.Current.Application("GlobalDTAsistenciasInasistencias"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTAsistenciasInasistencias") = value - End Set - End Property - Property GlobalDTEstatusPersonal() As DataTable - Get - GlobalDTEstatusPersonal = DirectCast(HttpContext.Current.Application("GlobalDTEstatusPersonal"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstatusPersonal") = value - End Set - End Property - - Property GlobalDTRHPersonal(CveEmpresa As Integer) As DataTable - Get - Dim ObjPersonal As New ClsRH - ObjPersonal.GetPersonal(-1, CveEmpresa) - GlobalDTRHPersonal = ObjPersonal.DtResultados - ObjPersonal.Dispose() - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTRHPersonal") = value - End Set - End Property - - - Property GlobalDTDepartamentos() As DataTable - Get - GlobalDTDepartamentos = DirectCast(HttpContext.Current.Application("GlobalDTDepartamentos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTDepartamentos") = value - End Set - End Property - Property GlobalDTRHPuestos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTRHPuestos"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTRHPuestos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTRHPuestos = DirectCast(HttpContext.Current.Application("GlobalDTRHPuestos"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTRHPuestos") = value - End Set - End Property - Property GlobalDTEscolaridad() As DataTable - Get - GlobalDTEscolaridad = DirectCast(HttpContext.Current.Application("GlobalDTEscolaridad"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEscolaridad") = value - End Set - End Property - Property GlobalDTEstadoCivil() As DataTable - Get - GlobalDTEstadoCivil = DirectCast(HttpContext.Current.Application("GlobalDTEstadoCivil"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTEstadoCivil") = value - End Set - End Property - Property GlobalDTDocumentos() As DataTable - Get - GlobalDTDocumentos = DirectCast(HttpContext.Current.Application("GlobalDTDocumentos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTDocumentos") = value - End Set - End Property - Property GlobalDTGenero() As DataTable - Get - GlobalDTGenero = DirectCast(HttpContext.Current.Application("GlobalDTGenero"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTGenero") = value - End Set - End Property - Property GlobalDTMotivoBaja() As DataTable - Get - GlobalDTMotivoBaja = DirectCast(HttpContext.Current.Application("GlobalDTMotivoBaja"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMotivoBaja") = value - End Set - End Property - Property GlobalDTTiposContrato() As DataTable - Get - GlobalDTTiposContrato = DirectCast(HttpContext.Current.Application("GlobalDTTiposContrato"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTiposContrato") = value - End Set - End Property - Property GlobalDTRutas() As DataTable - Get - GlobalDTRutas = DirectCast(HttpContext.Current.Application("GlobalDTRutas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTRutas") = value - End Set - End Property - Property GlobalDTTurno() As DataTable - Get - GlobalDTTurno = DirectCast(HttpContext.Current.Application("GlobalDTTurno"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTurno") = value - End Set - End Property - Property GlobalDTJornadas() As DataTable - Get - GlobalDTJornadas = DirectCast(HttpContext.Current.Application("GlobalDTJornadas"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTJornadas") = value - End Set - End Property - Property GlobalDTMotivosHorasExtras() As DataTable - Get - GlobalDTMotivosHorasExtras = DirectCast(HttpContext.Current.Application("GlobalDTMotivosHorasExtras"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMotivosHorasExtras") = value - End Set - End Property - Property GlobalDTTipoBuzon() As DataTable - Get - GlobalDTTipoBuzon = DirectCast(HttpContext.Current.Application("GlobalDTTipoBuzon"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTipoBuzon") = value - End Set - End Property -#End Region - -#Region "*********** D T - C O M B U S T I B L E S ***********" - - - - Property GlobalDTCombustibles(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCombustibles"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCombustibles = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTCombustibles = DirectCast(HttpContext.Current.Application("GlobalDTCombustibles"), DataTable) - End If - - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCombustibles") = value - End Set - End Property - - Property GlobalDTCombustiblesTipos(Optional CveCombustibleTipo As Integer = -1) As DataTable - Get - - If CveCombustibleTipo <> -1 Then - - Dim StrSQL As New StringBuilder - If CveCombustibleTipo <> -1 Then StrSQL.AppendFormat("CveCombustibleTipo = {0}", CveCombustibleTipo) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCombustiblesTipos"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCombustiblesTipos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTCombustiblesTipos = DirectCast(HttpContext.Current.Application("GlobalDTCombustiblesTipos"), DataTable) - End If - End Get - Set(ByVal value As DataTable) - HttpContext.Current.Application("GlobalDTCombustiblesTipos") = value - End Set - End Property -#End Region - -#Region "*********** D T - M A N T E N I M I E N T O S ***********" - - Property GlobalDTMantenimientosTipos() As DataTable - Get - GlobalDTMantenimientosTipos = DirectCast(HttpContext.Current.Application("GlobalDTMantenimientosTipos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMantenimientosTipos") = value - End Set - End Property - - Property GlobalDTMantenimientos() As DataTable - Get - GlobalDTMantenimientos = DirectCast(HttpContext.Current.Application("GlobalDTMantenimientos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTMantenimientos") = value - End Set - End Property - - Property GlobalDTMantenimientosTipos(Optional CveMantenimientoTipo As Integer = -1) As DataTable - Get - - If CveMantenimientoTipo <> -1 Then - - Dim StrSQL As New StringBuilder - If CveMantenimientoTipo <> -1 Then StrSQL.AppendFormat("CveMantenimientoTipo = {0}", CveMantenimientoTipo) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTMantenimientosTipos"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTMantenimientosTipos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTMantenimientosTipos = DirectCast(HttpContext.Current.Application("GlobalDTMantenimientosTipos"), DataTable) - End If - End Get - Set(ByVal value As DataTable) - - HttpContext.Current.Application("GlobalDTMantenimientosTipos") = value - End Set - End Property - -#End Region - - -#Region "*********** D T - T A L L E R E S ***********" - - Property GlobalDTTalleresTipos() As DataTable - Get - GlobalDTTalleresTipos = DirectCast(HttpContext.Current.Application("GlobalDTTalleresTipos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTalleresTipos") = value - End Set - End Property - - Property GlobalDTTalleres() As DataTable - Get - GlobalDTTalleres = DirectCast(HttpContext.Current.Application("GlobalDTTalleres"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTTalleres") = value - End Set - End Property - -#End Region - -#Region "*********** D T - D I S T R I B U I D O R E S ***********" - - Property GlobalDTDistribuidoresTipos() As DataTable - Get - GlobalDTDistribuidoresTipos = DirectCast(HttpContext.Current.Application("GlobalDTDistribuidoresTipos"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTDistribuidoresTipos") = value - End Set - End Property - - Property GlobalDTDistribuidores() As DataTable - Get - GlobalDTDistribuidores = DirectCast(HttpContext.Current.Application("GlobalDTDistribuidores"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTDistribuidores") = value - End Set - End Property - -#End Region - - - Property GlobalDTOIRevision(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTOIRevision"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTOIRevision = Dv.ToTable - Dv.Dispose() - Else - GlobalDTOIRevision = DirectCast(HttpContext.Current.Application("GlobalDTOIRevision"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOIRevision") = value - End Set - End Property - Property GlobalDTOIAgendaTipo() As DataTable - Get - GlobalDTOIAgendaTipo = DirectCast(HttpContext.Current.Application("GlobalDTOIAgendaTipo"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOIAgendaTipo") = value - End Set - End Property - Property GlobalDTOIAgenda() As DataTable - Get - GlobalDTOIAgenda = DirectCast(HttpContext.Current.Application("GlobalDTOIAgenda"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTOIAgenda") = value - End Set - End Property - Property GlobalDTVtaCondicionesEntrega(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTVtaCondicionesEntrega"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTVtaCondicionesEntrega = Dv.ToTable - Dv.Dispose() - Else - GlobalDTVtaCondicionesEntrega = DirectCast(HttpContext.Current.Application("GlobalDTVtaCondicionesEntrega"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTVtaCondicionesEntrega") = value - End Set - End Property - Property GlobalDTPaqueteriaGuiaTipos(CveEmpresa As Integer) As DataTable - - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTPaqueteriaGuiaTipos"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTPaqueteriaGuiaTipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTPaqueteriaGuiaTipos = DirectCast(HttpContext.Current.Application("GlobalDTPaqueteriaGuiaTipos"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPaqueteriaGuiaTipos") = value - End Set - End Property - Property GlobalDTClasificacionPorcentaje(CveEmpresa As Integer, Optional CveClasicacionPorcentaje As Integer = -1, Optional CveClasicacion As Integer = -1, - Optional PorcentajeIVA As Double = -1) As DataTable - - Get - Dim Str As StringBuilder = New StringBuilder() - If CveEmpresa <> -1 Or CveClasicacionPorcentaje <> -1 Or CveClasicacion <> -1 Or PorcentajeIVA <> -1 Then - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveClasicacionPorcentaje <> -1 Then Str.AppendFormat(" {0} CveClasicacionPorcentaje = {1}", If(Str.Length > 0, "AND", ""), CveClasicacionPorcentaje) - If CveClasicacion <> -1 Then Str.AppendFormat(" {0} CveClasicacion = {1}", If(Str.Length > 0, "AND", ""), CveClasicacion) - If PorcentajeIVA <> -1 Then Str.AppendFormat(" {0} PorcentajeIVA = {1}", If(Str.Length > 0, "AND", ""), PorcentajeIVA) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClasificacionPorcentaje"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTClasificacionPorcentaje = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClasificacionPorcentaje = DirectCast(HttpContext.Current.Application("GlobalDTClasificacionPorcentaje"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionPorcentaje") = value - End Set - End Property - Property GlobalDTPaqueterias() As DataTable - Get - GlobalDTPaqueterias = DirectCast(HttpContext.Current.Application("GlobalDTPaqueterias"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPaqueterias") = value - End Set - End Property - - Public Property CveContratoSecciones As String - Public Property CveEstatus As Integer - Public Property GenerarPDFFactura As Boolean = False -#End Region - - End Class - - - Public Class ComplementoINE - Implements ADSTimbrado.ComplementoINE - - Public Property INETipoProceso As String = "" - Public Property INETipoComite As String = "" - Public Property INEEntidad As String = "" - Public Property INEIdContabilidad As Integer = 0 - End Class - - - Public Class FemsaFactura - Inherits Modelos.EntityModel - Public Sub New() - MyBase.New() - End Sub - Public Sub New(Row As System.Data.DataRow) - setValues(Row) - End Sub - - Public Property AplicaFEMSA As Boolean = False 'AplicaFEMSA - Public Property FEMSA_NumSociedad As String 'TxtFEMSA_NumSociedad.Text.Trim, - Public Property FEMSA_NumProveedor As String 'TxtFEMSA_NumProveedor.Text.Trim, - Public Property FEMSA_Mail As String 'TxtFEMSA_Mail.Text.Trim - - - Public Property FEMSA_Version As Integer 'TxtFEMSA_Version.Text.ToEntero, ClaseDocto, - Public Property FEMSA_NumPedido As Long 'TxtFEMSA_NumPedido.Text.Trim.ToLong, - Public Property FEMSA_NumEntrada As String 'TxtFEMSA_NumEntrada.Text.Trim, - Public Property FEMSA_NumRemision As String 'TxtFEMSA_NumRemision.Text.Trim, - Public Property FEMSA_NumSocio As String 'TxtFEMSA_NumSocio.Text.Trim, - Public Property FEMSA_CentroCosto As String 'TxtFEMSA_CentroCosto.Text.Trim, - Public Property FEMSA_IPeriodoLiquidacion As String 'TxtFEMSA_IPeriodoLiquidacion.Text.Trim, - Public Property FEMSA_FPeriodoLiquidacion As String 'TxtFEMSA_FPeriodoLiquidacion.Text.Trim, - Public Property FEMSA_CodRetencion1 As String 'TxtFEMSA_CodRetencion1.Text.Trim, - Public Property FEMSA_CodRetencion2 As String 'TxtFEMSA_CodRetencion2.Text.Trim, - End Class - - - Public Class SucursalModel - Inherits Modelos.EntityModel - - Protected Overloads Sub SetDefaultValues() - Calle = "" - NoExt = "" - NoInt = "" - Colonia = "" - Localidad = "" - Municipio = "" - Estado = "" - Pais = "" - CP = "" - IVA = 0 - Serie = "" - TipoFormato = "" - FormatoFactura = "" - Sucursal = "" - CorreoSucursal = "" - RFC = "" - End Sub - Public Sub New() - MyBase.New() - End Sub - Public Sub New(Row As System.Data.DataRow) - SetDefaultValues() - setValues(Row) - End Sub - - Public ReadOnly Property LugarExp As String - Get - Dim arr = {Calle, NoExt, NoInt, Colonia, Localidad, Municipio, Estado, Pais, CP} - Return String.Join(",", arr) - End Get - End Property - Public Property CveSucursal As Integer - Public Property RFC As String - Public Property Nombre As String - Public Property Calle As String - Public Property Direccion As String - Public Property NoExt As String - Public Property NoInt As String - Public Property Colonia As String - Public Property Localidad As String - Public Property Municipio As String - Public Property Estado As String - Public Property Pais As String - Public Property CP As String - Public Property IVA As Decimal - Public Property Serie As String - Public Property TipoFormato As String - Public Property FormatoFactura As String - Public Property Sucursal As String - Public Property CorreoSucursal As String - Public Property TelefonoSucursal As String - Public Property ImprimeNombreSucursal As String - - - End Class - - - Public Class SubProyectoModel - Inherits Modelos.EntityModel - - Protected Overloads Sub SetDefaultValues() - Calle = "" - NoExt = "" - NoInt = "" - Colonia = "" - Localidad = "" - Municipio = "" - Estado = "" - Pais = "" - CP = "" - IVA = 0 - Serie = "" - TipoFormato = "" - FormatoFactura = "" - SubProyecto = "" - Correo = "" - Telefono = "" - UTCOffsetVerano = -7 - UTCOffsetInvierno = -7 - End Sub - Public Sub New() - MyBase.New() - End Sub - Public Sub New(Row As System.Data.DataRow) - SetDefaultValues() - If Row IsNot Nothing Then - Me.setValues(Row) - End If - End Sub - - Public ReadOnly Property LugarExp As String - Get - Dim arr = {Calle, NoExt, NoInt, Colonia, Localidad, Municipio, Estado, Pais, CP, SubProyecto} - Return String.Join(",", arr) - End Get - End Property - Public Property CveSubProyecto As Integer - Public Property Calle As String - Public Property Direccion As String - Public Property NoExt As String - Public Property NoInt As String - Public Property Colonia As String - Public Property Localidad As String - Public Property Municipio As String - Public Property Estado As String - Public Property Pais As String - Public Property CP As String - Public Property IVA As Decimal - Public Property Serie As String - Public Property TipoFormato As String - Public Property FormatoFactura As String - Public Property SubProyecto As String - Public Property Correo As String - Public Property Telefono As String - Public Property ImprimeNombre As String - Public Property UTCOffsetVerano As Integer - Public Property UTCOffsetInvierno As Integer - - End Class - - - Public Class ClienteModel - Inherits Modelos.EntityModel - Protected Overloads Sub SetDefaultValues() - CveCliente = -1 - EnviarFactura = "Si" - Estatus = "Activo" - NoExt = "" - NoInt = "" - Direccion = "" - Colonia = "" - Localidad = "" - Ciudad = "" - Estado = "" - Pais = "" - CP = "" - Telefono = "" - AplicaFord = False - Ford_GSDB = "" - AplicaFEMSA = False - AplicaDetallista = False - AplicaComercioExterior = False - End Sub - Public Sub New() - MyBase.New() - End Sub - Public Sub New(Row As Data.DataRow) - SetDefaultValues() - setValues(Row) - End Sub - Public Sub New(CveCliente As Integer, CveEmpresa As Integer) - SetDefaultValues() - Dim ObjCliente As New ClsClientes() - If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, -1, TipoCliente:=-1) AndAlso ObjCliente.DtResultados.Rows.Count > 0 Then - setValues(ObjCliente.DtResultados.Rows(0)) - End If - ObjCliente.Dispose() - End Sub - Public Property CveCliente As Integer - Public Property Nombre As String - Public Property NombreComercial As String - Public Property Codigo As String - Public Property Direccion As String - Public Property NoExt As String - Public Property NoInt As String - Public Property Colonia As String - Public Property Localidad As String - Public Property Ciudad As String - Public Property Estado As String - Public Property Pais As String - Public Property RFC As String - Public Property CP As String - Public Property Telefono As String - Public Property Contacto As String - Public Property Mail As String - Public Property MailCotizacion As String - Public Property NotificarA As String - Public Property Pagina As String - Public Property Giro As String - Public Property CvePrecioLista As Integer - Public Property EnviarFactura As String - Public Property CveSucursal As Integer - Public Property RetIVA As Decimal - Public Property RetISR As Decimal - Public Property IEPS As Decimal - Public Property RetIVAFletes As Boolean - Public Property Estatus As String - Public Property Fecha As DateTime - Public Property Usuario As String - Public Property NombreCorto As String - Public Property Vendedor As String - Public Property PlazoCobranza As Integer - Public Property Sucursal As String - Public Property RecepcionPagos As String - Public Property TipoPago As String - Public Property CuentaContable As String - Public Property IdCtaContClientes As Integer - Public Property IdCtaContMonedaExtranjera As Integer - Public Property IdCtaContComplementaria As Integer - Public Property IdCtaContAnticipos As Integer - Public Property IdCtaContRetIVA As Integer - Public Property IdCtaContRetISR As Integer - Public Property CveCuentaClientes As Integer - Public Property CveCuentaMonedaExtranjera As Integer - Public Property CveCuentaComplementaria As Integer - Public Property CveCuentaAnticipos As Integer - Public Property CveCuentaRetIVA As Integer - Public Property CveCuentaRetISR As Integer - Public Property ConvenioCIE As String - Public Property FormaFacturacion As String - Public Property LimiteCredito As Decimal - Public Property NumCtaPago As String - Public Property CveMetodoPago As Integer - Public Property AplicaFEMSA As Boolean - Public Property FEMSA_NumSociedad As String - Public Property FEMSA_NumProveedor As String - Public Property FEMSA_Mail As String - Public Property AplicaDetallista As Boolean - Public Property Detallista_GLNComprador As String - Public Property Detallista_Departamento As String - Public Property Detallista_GLNVendedor As String - Public Property Detallista_NumProveedor As String - Public Property SevenEleven_NumProveedor As String - Public Property Detallista_GLNEnvio As String = "envio num" - Public Property AplicaFord As Boolean - Public Property Ford_GSDB As String - Public Property ReferenciaFiscal As String - Public Property NumRegIdTrib As String - Public Property CobranzaTelefono As String - Public Property AplicaComercioExterior As Boolean - Public Property ClaveSATPais As String - Public Property ClaveSATEstado As String - Public Property ClaveSATMunicipio As String - Public Property ClaveSATColonia As String - Public Property ClaveSATCP As String - Public Property EsDistribuidor As Boolean - Public Property CorreoCotizacion As String - Public Property ImprimeNombreSucursal As Integer - End Class - - - Public Class EnviarAModel - Inherits Modelos.EntityModel - - Protected Overloads Sub SetDefaultValues() - EnvioDireccion = "" - EnvioNoExt = "" - EnvioNoInt = "" - EnvioColonia = "" - EnvioCiudad = "" - EnvioEstado = "" - EnvioContacto = "" - EnvioDepartamento = "" - EnvioPedidoContrato = "" - EnvioCP = "" - EnvioTel = "" - - End Sub - Public Sub New() - MyBase.New() - End Sub - Public Sub New(Row As System.Data.DataRow) - SetDefaultValues() - setValues(Row) - End Sub - - Public ReadOnly Property LugarExp As String - Get - Dim arr = {EnvioDireccion, EnvioColonia, EnvioCiudad, EnvioEstado, EnvioCP, EnvioTel} - Return String.Join(",", arr) - End Get - End Property - Public Property CveDireccionEnvio As Integer - Public Property EnvioDireccion As String - Public Property EnvioNoExt As String - Public Property EnvioNoInt As String - Public Property EnvioColonia As String - Public Property EnvioCiudad As String - Public Property EnvioEstado As String - Public Property EnvioContacto As String - Public Property EnvioDepartamento As String - Public Property EnvioPedidoContrato As String - Public Property EnvioCP As String - Public Property EnvioTel As String - End Class -End Namespace - - diff --git a/RH/CatPersonal.aspx b/RH/CatPersonal.aspx index 7f100829f..e65ec1a90 100644 --- a/RH/CatPersonal.aspx +++ b/RH/CatPersonal.aspx @@ -604,7 +604,7 @@ - Fecha Ing + Fecha registro diff --git a/RH/Personal.aspx b/RH/Personal.aspx index 7470dab84..1fc9a31b9 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -35,7 +35,7 @@ Expediente de personal
  • - +
  • @@ -147,7 +147,7 @@
    - + @@ -155,7 +155,7 @@
    - + @@ -163,7 +163,7 @@
    - + @@ -279,7 +279,7 @@
    - +
    @@ -478,7 +478,7 @@
    - + @@ -494,7 +494,7 @@
    - + @@ -504,7 +504,7 @@
    - + @@ -513,7 +513,7 @@
    - + @@ -522,7 +522,7 @@
    - + @@ -531,7 +531,7 @@
    - + @@ -539,7 +539,7 @@
    - + @@ -565,16 +565,18 @@
    - + + + <%-- - + --%>
    Proyecto: - + <%-- --%> @@ -582,7 +584,7 @@
    SubProyecto: - + @@ -596,7 +598,7 @@
    --%>
    - + @@ -616,7 +618,7 @@
    - + @@ -624,7 +626,7 @@
    - + @@ -716,14 +718,14 @@
    - +
    - + @@ -751,14 +753,14 @@
    - +
    - +
    @@ -1000,7 +1002,7 @@ - + @@ -1117,7 +1119,7 @@   - + @@ -1380,7 +1382,7 @@
    - + @@ -1388,7 +1390,7 @@
    - + @@ -1729,9 +1731,10 @@
    - + + <%-- - + --%>
    @@ -1844,9 +1847,11 @@ - + + + <%-- - + --%> @@ -3224,8 +3229,7 @@ Gafete - - + @@ -3718,7 +3722,7 @@

    - +
    @@ -4237,9 +4241,10 @@
    - + + <%-- - + --%> <%-- --%> diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index c54647919..fcd911134 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -939,9 +939,9 @@ Partial Class RH_Personal End Sub Private Sub SetValues() ViewState("Orden") = String.Empty - DdlClienteAsignado.Attributes.Add("onclick", "CargaClientes();") - DdlClienteAsistenciaC.Attributes.Add("onclick", "CargaClientes();") - DdlClienteAsistenciaA.Attributes.Add("onclick", "CargaClientes();") + 'DdlClienteAsignado.Attributes.Add("onclick", "CargaClientes();") + 'DdlClienteAsistenciaC.Attributes.Add("onclick", "CargaClientes();") + 'DdlClienteAsistenciaA.Attributes.Add("onclick", "CargaClientes();") CargaClientes() Dim fechainicioasistencia As String Dim fechaFinasistencia As String @@ -1064,20 +1064,24 @@ Partial Class RH_Personal End Sub Private Sub CargaClientes() - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - DdlClienteAsignado.DataSource = ObjClientes.DtResultados - DdlClienteAsistenciaC.DataSource = ObjClientes.DtResultados - DdlClienteAsistenciaA.DataSource = ObjClientes.DtResultados - Else - DdlClienteAsignado.DataSource = Nothing - DdlClienteAsistenciaC.DataSource = Nothing - DdlClienteAsistenciaA.DataSource = Nothing - End If - ObjClientes.Dispose() - DdlClienteAsignado.DataBind() - DdlClienteAsistenciaC.DataBind() - DdlClienteAsistenciaA.DataBind() + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + ' DdlClienteAsignado.DataSource = ObjClientes.DtResultados + ' DdlClienteAsistenciaC.DataSource = ObjClientes.DtResultados + ' DdlClienteAsistenciaA.DataSource = ObjClientes.DtResultados + 'Else + ' DdlClienteAsignado.DataSource = Nothing + ' DdlClienteAsistenciaC.DataSource = Nothing + ' DdlClienteAsistenciaA.DataSource = Nothing + 'End If + 'ObjClientes.Dispose() + 'DdlClienteAsignado.DataBind() + 'DdlClienteAsistenciaC.DataBind() + 'DdlClienteAsistenciaA.DataBind() + DdlClienteAsignado.setEsWebService(True) + DdlClienteAsistenciaC.setEsWebService(True) + DdlClienteAsistenciaA.setEsWebService(True) + DdlClienteBuzon.setEsWebService(True) End Sub Private Sub CargaProyecto() @@ -1173,7 +1177,13 @@ Partial Class RH_Personal End Sub Private Sub CargaTipoRegimen() - DdlRegimenContratacion.DataSource = GlobalDTNomSatRegimenContratacion + Dim dt As DataTable = GlobalDTNomSatRegimenContratacion.Copy() + For Each item As DataRow In dt.Rows + item("RegimenContratacion") = String.Format("{1}{0} {2}", item("CveSATRegimenContratacion"), If(item("CveSATRegimenContratacion").ToString().Length > 1, "", "0"), item("RegimenContratacion")) + Next + dt.AcceptChanges() + + DdlRegimenContratacion.DataSource = dt.FiltraParametros("", "RegimenContratacion") DdlRegimenContratacion.DataBind() End Sub @@ -1477,7 +1487,7 @@ Partial Class RH_Personal ViewState("CveEstatusOriginal") = ObjPersonal.CveEstatusPersonal.ToString() 'Asignación If ObjPersonal.CveCliente <> -1 Then - DdlClienteAsignado.Items.Insert(1, New ListItem(ObjPersonal.Cliente, ObjPersonal.CveCliente.ToString())) + 'DdlClienteAsignado.Items.Insert(1, New ListItem(ObjPersonal.Cliente, ObjPersonal.CveCliente.ToString())) DdlClienteAsignado.SelectedValue = ObjPersonal.CveCliente.ToString() Else DdlClienteAsignado.SelectedValue = ObjPersonal.CveCliente.ToString() @@ -2004,7 +2014,7 @@ Partial Class RH_Personal Private Sub BuzonCalidadLimpiaModal(ControlesActivos As Boolean) - DdlClienteBuzon.SelectedIndex = 0 + DdlClienteBuzon.SelectedValue = "0" DdlClienteBuzon.Enabled = ControlesActivos DdlSucursalClienteBuzon.SelectedIndex = 0 @@ -2050,7 +2060,7 @@ Partial Class RH_Personal CvePersonalBuzon = GvRow.DataKey("CvePersonalBuzon").ToEntero CargaBuzonCalidadSeguimiento() - DdlClienteBuzon.SelectedValueExist(GvRow.DataKey("CveCliente")) + DdlClienteBuzon.SelectedValue = GvRow.DataKey("CveCliente") ' DdlClienteBuzon.Enabled = False If GvRow.DataKey("CveClienteSucursal").ToEntero > 0 Then @@ -2223,7 +2233,7 @@ Partial Class RH_Personal End Sub - Private Sub DdlClienteBuzon_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClienteBuzon.SelectedIndexChanged + Private Sub DdlClienteBuzon_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClienteBuzon.selectedindexchange CargaClienteSucursal() End Sub @@ -3188,6 +3198,14 @@ Partial Class RH_Personal #Region "I M P R I M I R N O M I N A" + Private Function ValorNodoXML(n As System.Xml.XmlNode, Campo As String, Optional Retorno As String = "") As String + Dim o As System.Xml.XmlNode = n.Attributes.Cast(Of System.Xml.XmlAttribute)().SingleOrDefault(Function(a) String.Compare(a.Name, Campo, True) = 0) + If o Is Nothing Then + Return Retorno + Else + Return o.Value + End If + End Function Protected Sub LbPDF_Click(sender As Object, e As EventArgs) Dim LB = CType(sender, LinkButton) @@ -3266,7 +3284,7 @@ Partial Class RH_Personal params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue = "-1", "", DdlPuesto.SelectedItem.Text))) params.Add(New ReportParameter("SupervisorRH", If(DdlSupervisor.SelectedValue = "-1", "", DdlSupervisor.SelectedItem.Text))) params.Add(New ReportParameter("SupervisorInmediato", If(DdlSupervisorOrganigrama.SelectedValue = "-1", "", DdlSupervisorOrganigrama.SelectedItem.Text))) - params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedItem.Text)) + params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedText)) params.Add(New ReportParameter("Proyecto", DdlProyectoAsignado.SelectedItem.Text)) params.Add(New ReportParameter("SubProyecto", DdlSubProyectoAsignado.SelectedItem.Text)) params.Add(New ReportParameter("Estatus", If(DdlEstatusPersonal.SelectedValue = "-1", "", DdlEstatusPersonal.SelectedItem.Text))) @@ -3360,7 +3378,7 @@ Partial Class RH_Personal params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue = "-1", "", DdlPuesto.SelectedItem.Text))) params.Add(New ReportParameter("SupervisorRH", If(DdlSupervisor.SelectedValue = "-1", "", DdlSupervisor.SelectedItem.Text))) params.Add(New ReportParameter("SupervisorInmediato", If(DdlSupervisorOrganigrama.SelectedValue = "-1", "", DdlSupervisorOrganigrama.SelectedItem.Text))) - params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedItem.Text)) + params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedText)) params.Add(New ReportParameter("Proyecto", DdlProyectoAsignado.SelectedItem.Text)) params.Add(New ReportParameter("SubProyecto", DdlSubProyectoAsignado.SelectedItem.Text)) params.Add(New ReportParameter("Estatus", If(DdlEstatusPersonal.SelectedValue = "-1", "", DdlEstatusPersonal.SelectedItem.Text))) diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 18fb5bee9..20408025b 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -6536,7 +6536,7 @@ Partial Class PV If ObjAcumuladores.FoliosGarantiaGet(DdlFolioGarantia.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then Dim Limite As Integer = If(ObjAcumuladores.DtResultados.FiltroPrimeroValor("Limite") IsNot Nothing, ObjAcumuladores.DtResultados.FiltroPrimeroValor("Limite").ToEntero, 0) 'ObjAcumuladores.DtResultados.FiltroPrimeroValor("Limite").ToEntero If resultado < Limite Or Limite = 0 Then - TxtConsecutivoAjuste.Text = resultado.ToString + TxtConsecutivoAjuste.Text = (resultado + 1).ToString Else Alert("limite de folios alcanzado") End If diff --git a/Ventas/RepPedidos2.aspx.cs b/Ventas/RepPedidos2.aspx.cs index ee455cfe0..a44cc43f2 100644 --- a/Ventas/RepPedidos2.aspx.cs +++ b/Ventas/RepPedidos2.aspx.cs @@ -33,7 +33,7 @@ public partial class Ventas_RepPedidos2 : ClsPaginas DdlVendedor.DataBind(); if (UsuarioActual.CveVendedor > 0) { DdlVendedor.SelectedValuesIfExistM(UsuarioActual.CveVendedor.ToString()); } - txtFechaI.Text = DateTime.Now.AddMonths(-6).ToShortDateString(); + txtFechaI.Text = DateTime.Now.AddMonths(-12).ToShortDateString(); txtFechaF.Text = DateTime.Now.AddMonths(6).ToShortDateString(); //TxtFechaVencimiento.Text = DateTime.Now.ToShortDateString(); }