From e3bb4258789c8f80579bc51b13d4cafbebb26ac2 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 13:23:59 -0700 Subject: [PATCH 01/16] --- filtro por importaciones activas --- Compras/Compras.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 0bd2bdc3b..4c2548edd 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -19914,7 +19914,7 @@ Partial Class Compras_Compras RblFleteImportacionOpcion.Items.Clear() Dim ObjCompras As New ClsCompras - If ObjCompras.GetImportaciones(-1, -1, -1, "-1", "-1", UsuarioActual.CveEmpresa) Then + If ObjCompras.GetImportaciones(-1, -1, -1, "-1", "-1", UsuarioActual.CveEmpresa, CveEstatus:=0) Then DdlImportaciones.DataSource = ObjCompras.DtResultados DdlImportaciones.Items.Insert(0, New ListItem("Seleccione", "-1")) End If From 7529c8dd0d1aaa446c209debdda25a4ab9bc0dab Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 18:39:51 -0700 Subject: [PATCH 02/16] --- si no es productivo que ignore la rutaarchivos de la empresa --- App_Code/ClsPaginas.vb | 2 +- App_Code/Empresa.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index af839dd38..ef001a1c1 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -35,7 +35,7 @@ Public Class ClsPaginas - Public ReadOnly Property EsProduccion As Boolean + Public Shared ReadOnly Property EsProduccion As Boolean Get If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then Return False diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index 1121e56d9..1217f4dbc 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -102,7 +102,7 @@ Public Class Empresa Public Property RutaArchivos As String Public ReadOnly Property Ruta As String Get - If Not String.IsNullOrEmpty(RutaArchivos) Then + If Not String.IsNullOrEmpty(RutaArchivos) AndAlso ClsPaginas.EsProduccion Then Return RutaArchivos Else Return String.Format("{0}\{1}\", Extensiones.ModExtensiones.DirectorioEmpresas, Me.CveEmpresa) From 86b4e0015c42a7c7aa4869bf4c179bc295eb252f Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 18:41:38 -0700 Subject: [PATCH 03/16] =?UTF-8?q?--=20correci=C3=B3n=20de=20TCPAgo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 4c2548edd..a3c44fd31 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7482,7 +7482,8 @@ Partial Class Compras_Compras Dim Pago As New CompraPago Pago.ImportePago = importeMovimiento Pago.CveIE = Ant.CveIE - Pago.CveMonedaPago = 1 + Pago.TCPago = Ant.TCCompra + Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1) ErrorPrepoliza = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) From c2e861e170259b2c63679440ddc8109189171eb7 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 18:41:49 -0700 Subject: [PATCH 04/16] redondeo --- Contabilidad/RegPrePolizaS.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index e8c7c3c55..eafc5dd0b 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1633,7 +1633,7 @@ Partial Class ContabilidadC_RegPrePolizaS If AplicaComplementaria Then Dim Importe As Decimal = IIf(TxtCargoE.Text.ToDecimal <> 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal) 'valida Mon Extranjera por el TC - Mon Extranjera - Dim dif As Decimal = ((TxtME.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal) - TxtME.Text.ToDecimal).RoundSQL - Importe + Dim dif As Decimal = ((TxtME.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal).RoundSQL - TxtME.Text.ToDecimal).RoundSQL - Importe If dif <> 0 Then Alert("El importe moneda extranjera no coinciden con el TC ") From f25e57ff74c67b26e1c4b8b4f24160902256fd78 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 18:42:00 -0700 Subject: [PATCH 05/16] ---cta consumo interno --- Inventarios/EntradasSalidas.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 963a0b22d..94e2d5e33 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1829,9 +1829,9 @@ Partial Class Inventarios_EntradasSalidas Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy 'Dim IdCuentaGasto As Integer = 0 For Each Dr As DataRow In Dt.Rows - Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion").ToString}").SUM("Total").ToDecimal.RoundSQL() + Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").ToDecimal.RoundSQL() - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAlmacen, Total, TxtObservaciones.Text.Trim, CveConceptoContable, TxtObservaciones.Text.Trim, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=Total, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, TxtFolio.Text, TxtObservaciones.Text.Trim, IdCtaContableOtro, CveMovimientoAlmacen:=CveMovimiento, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then ErrorMovInv = True End If Next From 55243cc5a9d92268615d74a2a6d53a25e9499720 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 18:42:19 -0700 Subject: [PATCH 06/16] -- que se pueda veriicar serie --- Inventarios/RecepcionAlmacen.aspx.vb | 36 ++++++---------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 2fc3c9bb5..685635a67 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -1758,13 +1758,12 @@ Partial Class Inventarios_RecepcionAlmacen 'RegistraScript("document.getElementById(""TxtSerie"").focus();") RegistraScript("$('#DivSerie').modal();", "ModalLote") - GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC") GvSerie.DataBind() 'VALIDA QUE SIGA AGREGANDO If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then - BtnAgregarPS.Enabled = False + BtnAgregarPS.Enabled = True If CerrarCompletado Then RegistraScript("$('#DivSerie').modal('hide');") End If @@ -1807,9 +1806,7 @@ Partial Class Inventarios_RecepcionAlmacen Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) AgregaSerie(TxtSerie.Text.Replace(" ", String.Empty), 1) End Sub - Private Sub AgregaSerie(Serie As String, Tipo As Integer, Optional AlertaSonido As Boolean = True) - 'SerieLote = SerieLote.Trim.Replace(" ", " ") - + Private Sub AgregaSerie(Serie As String, Tipo As Integer, Optional AlertaSonido As Boolean = True, Optional CargaMasivaSeries As Boolean = False) If Serie.Trim = "" Then Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -1820,10 +1817,6 @@ Partial Class Inventarios_RecepcionAlmacen 'VALIDACION DE SERIES DUPLICADAS Dim MensajeAlert As New StringBuilder Dim DtDuplicado As New DataTable - Dim DtSeriesNuevas As New DataTable - DtSeriesNuevas.Columns.Add("Serie", GetType(String)) - - 'If CvePSS > 0 And CvePSSerie = 0 Then CvePSSerie = CvePSS 'PARA VALIDAR SI LA SERIE ES IGUAL AL CODIGO O CODIGOBARRAS Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltroPrimero("", "PS") @@ -1832,12 +1825,8 @@ Partial Class Inventarios_RecepcionAlmacen DtDuplicado = DtDatosDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{Serie}'") If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then MensajeAlert.Append($"
El numero de Serie ""{Serie}"" proporcionado ya se encuentra ingresado.") - Continue For - End If - - DtDuplicado = DtSeriesNuevas.FiltraParametros($"Serie = '{Serie}'") - If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then - MensajeAlert.Append($"
El numero de Serie ""{Serie}"" proporcionado se encuentra duplicado.") + TxtSerie.Text = "" + TxtSerie.Focus() Continue For End If @@ -1846,27 +1835,21 @@ Partial Class Inventarios_RecepcionAlmacen MensajeAlert.Append($"
El numero de Serie {Serie} coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.") Continue For End If - - Dim Row = DtSeriesNuevas.NewRow - Row("Serie") = Serie - DtSeriesNuevas.Rows.Add(Row) Next If MensajeAlert.ToString <> "" Then - Alert(MensajeAlert.ToString, TipoMensaje.MsgAdvertencia) + Alert(MensajeAlert.ToString, TipoMensaje.ToastError) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") Exit Sub End If - Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios Dim Index = 0 For Each Serie In SeriesArreglo If Serie <> "" Then - - + Dim Row = DtDatosDetalle.NewRow Index = Index + 1 @@ -1895,11 +1878,6 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - 'Dim AplicaCaducidad = False - 'If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltraParametros("").Rows(0) IsNot Nothing Then - ' AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) - 'End If - Row("ConsecId") = CveConsecSerie Row("Consec") = DtDatosDetalle.Rows.Count + 1 Row("CvePS") = CvePSSerie @@ -1918,7 +1896,7 @@ Partial Class Inventarios_RecepcionAlmacen TxtSerie.Text = "" End If - CargaSerie(Tipo, True) + If Not CargaMasivaSeries Then CargaSerie(Tipo, True) If MensajeAlert.ToString <> "" Then If AlertaSonido Then RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") From 5ed6973c181ed7912ee3820370b66b4d8873f81e Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Jul 2022 19:05:38 -0700 Subject: [PATCH 07/16] -- activar por funcionalidad RSCO --- Ventas/ProductosServicios.aspx | 72 +++++++------------------------ Ventas/ProductosServicios.aspx.vb | 3 +- 2 files changed, 17 insertions(+), 58 deletions(-) diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index f45019d1f..ba2e5b401 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -211,8 +211,6 @@ - -
Seleccione @@ -228,13 +226,13 @@
-
+
-
+
@@ -249,12 +247,11 @@
-
<%----%> - +
@@ -272,8 +269,8 @@
-
-
+
+
@@ -283,19 +280,19 @@
-
+
-
+
- +
-
+
-
+
- + @@ -304,62 +301,25 @@ - - <%----%> - - - <%----%> - + +
- -
- - - -
- - - - - - - - - - - - - - - - - - - +
- <%----%> - +
-
-
-
+
- - <%--
- - -
--%>
diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 09ca91d2b..d2bfa8061 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1948,8 +1948,7 @@ Partial Class ProductosyServicios PS.Dispose() DdlCompuesto.DataBind() - - + divRowRSCO.Visible = True End If End Sub From 291207bf63ac0af5a3b30a82d3d66fac84ba8e86 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Fri, 8 Jul 2022 07:35:30 -0700 Subject: [PATCH 08/16] --- App_Code/ClsRH.vb | 3 ++- Compras/PopUpVerFactura.aspx.vb | 3 +++ Nomina/Nomina.aspx | 6 ++--- Nomina/Nomina.aspx.cs | 44 +++++++++++++++++++++++++++++---- vwd.webinfo | 2 ++ 5 files changed, 49 insertions(+), 9 deletions(-) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 338e50251..bc3ad4f2b 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -2063,7 +2063,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo CveJornada As Integer, IdCtaContPersonal As Integer, CtaContPersonal As String, IdCtaContPrestamos As Integer, CtaContPrestamos As String, CveEmpresa As Integer, CveUsuarioNomina As Integer, Optional CveSubProyectoZona As Integer = Nothing, Optional CveUniforme As Integer = -1, Optional TelefonoExtension As String = "-1", Optional CelularPersonal As String = "-1", Optional TelefonoMarcadoRapido As String = "-1", Optional ContactoAlterno As String = "-1", Optional CveUsuarioModifico As Integer = -1, Optional FechaActivo As Date = MinFecha, Optional FechaReingreso As Date = MinFecha, Optional CveTipodeSalario As Integer = 1, Optional Sindicalizado As Integer = -1, Optional CvePais As Integer = -1, Optional Pensionado As Boolean = False, Optional CveRegistroPatronal As Integer = -1, - Optional CveEmpresaAsignado As Integer = -1) As Boolean + Optional CveEmpresaAsignado As Integer = -1, Optional CveMedioTransporte As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2153,6 +2153,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CvePais", SqlDbType.Int).Value = CvePais .Add("@CveRegistroPatronal", SqlDbType.Int).Value = CveRegistroPatronal .Add("@CveEmpresaAsignado", SqlDbType.Int).Value = CveEmpresaAsignado + .Add("@CveMedioTransporte", SqlDbType.Int).Value = CveMedioTransporte diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 3dbb9b2f6..536ae9bc7 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -289,6 +289,9 @@ Partial Class PopUpVerFactura If rfc.Length > 0 Then contador = contador + 1 RFCs.AppendLine(String.Format("{0}|{1}", contador, rfc)) + Else + contador = contador + 1 + RFCs.AppendLine(String.Format("{0}|{1}", contador, "...")) End If Next End If diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index b378ec86b..9ad4d63de 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -577,9 +577,9 @@ - - - + + +
diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index f1b2b9445..1907bd879 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -1037,11 +1037,21 @@ public partial class Nomina_Nomina2 : ClsPaginas string SubProyecto = e.Row.DataKey("SubProyecto").ToString(); e.Row.FCHyperLink("LnkSobreRecibo").Attributes.Add("onclick", string.Format("GETSobreRecibo({0},{1})", cvePersonal, CvePeriodo)); LnkTimbrar.Visible = false; + LinkButton ImgDelete = (LinkButton)e.Row.FindControl("ImgDelete"); + LinkButton Imgdesautorizar = (LinkButton)e.Row.FindControl("Imgdesautorizar"); + LinkButton LnkCancelar = (LinkButton)e.Row.FindControl("LnkCancelar"); + ImgDelete.Visible = false; + Imgdesautorizar.Visible = false; + LnkCancelar.Visible = false; if (cvePersonal > 0) { + LnkCancelar.Visible = PermisoCancelarEmitido && SeTimbro.ToUpper().Contiene("TRUE", "1"); + LtlNombre.Text = String.Format("{2} {1}", cvePersonal, Nombre, Codigo); if (CveNomina > 0) { + Imgdesautorizar.Visible = NomAutorizado.ToUpper().Contiene("TRUE", "1") && !SeTimbro.ToUpper().Contiene("TRUE", "1"); + ImgDelete.Visible = !NomAutorizado.ToUpper().Contiene("TRUE", "1") && !SeTimbro.ToUpper().Contiene("TRUE", "1"); if (NomAutorizado == "False") { @@ -1207,6 +1217,8 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkTimbrar.Visible = false; gvRow.CssClass = "success"; gvRow.FindControl("ImgDelete").Visible = false; + gvRow.FindControl("Imgdesautorizar").Visible = false; + gvRow.FindControl("LnkCancelar").Visible = true; gvRow.FindControl("HypXml").Visible = true; gvRow.FindControl("HypPDF").Visible = true; @@ -1335,6 +1347,8 @@ public partial class Nomina_Nomina2 : ClsPaginas } Alert("Se ha timbrado correctamente"); gvRow.FindControl("ImgDelete").Visible = false; + gvRow.FindControl("Imgdesautorizar").Visible = false; + gvRow.FindControl("LnkCancelar").Visible = true; gvRow.FindControl("HypXml").Visible = true; gvRow.FindControl("HypPDF").Visible = true; @@ -1563,10 +1577,17 @@ public partial class Nomina_Nomina2 : ClsPaginas continuar = true; } } + string msgerror = "Debe seleccionar los conceptos a cargar."; + if(dtConceptos == null || dtConceptos.Columns.Count <= 2) + { + msgerror = "Debe cargar el periodo antes de descargar la plantilla"; + continuar = false; + } if (continuar) { ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); + var libro = wb.AddWorksheet("Nomina"); int column = 1; libro.Row(1).Hide(); @@ -1693,12 +1714,12 @@ public partial class Nomina_Nomina2 : ClsPaginas } else { - Alert("Debe seleccionar los conceptos a cargar.", TipoMensaje.MsgAdvertencia); + Alert(msgerror, TipoMensaje.MsgAdvertencia); } } catch (Exception ex) { - Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString()); + Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString(), TipoMensaje.MsgAdvertencia); } } @@ -6001,9 +6022,9 @@ public partial class Nomina_Nomina2 : ClsPaginas int chkImporte = 1; int chkImporteGravado = 1; int chkImporteValor = 1; - string[] getcolumnas = new string[] { "CvePersonal", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" }; + string[] getcolumnas = new string[] { "CvePersonal", "Nombre", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" }; - DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0 AND SumaPercepciones > 0", FiltroCvePersonal), "", getcolumnas); + DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0 AND SumaPercepciones > 0 AND Total >0", FiltroCvePersonal), "", getcolumnas); DataTable dtconp = null; //int CvePeriodoSeleccionado = DdlPeriodo.SelectedValue.ToEntero();//cambiar reparar @@ -6020,6 +6041,19 @@ public partial class Nomina_Nomina2 : ClsPaginas decimal ImporteConcepto = 0, ImporteGravadoConcepto = 0, ImporteExentoConcepto = 0, ImporteValor = 0; #endregion + string erroralturizar = ""; + + + DataTable dtrFail = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0 AND SumaPercepciones > 0 AND Total <=0", FiltroCvePersonal), "", getcolumnas); + StringBuilder strbuilder = new StringBuilder(); + foreach (DataRow itf in dtrFail.Rows) + { + strbuilder.AppendLine(String.Format("
{0} con neto a pagar {1} ", itf["Nombre"], itf["Total"])); + } + if(dtrFail.Rows.Count > 0) + { + erroralturizar = string.Format("
no se autorizaron los siguientes empleados con neto a pagar negativo para evitar inconsistencias{0}", strbuilder.ToString()); + } using (ClsNominas objNomina = new ClsNominas()) { @@ -6126,7 +6160,7 @@ public partial class Nomina_Nomina2 : ClsPaginas } if (continuar) { - Alert("La nomina se autorizó correctamente."); + Alert(string.Format("La nomina se autorizó correctamente.{0}", erroralturizar)); cargaDatos(); } return continuar; diff --git a/vwd.webinfo b/vwd.webinfo index 8f55aaf0a..f70db6dd5 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -516,6 +516,8 @@ + + From 668c70a6c2d398647f030c9b6d165b0dc5d0d097 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Fri, 8 Jul 2022 07:55:25 -0700 Subject: [PATCH 09/16] --- App_Code/ClsRH.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index bc3ad4f2b..26f34bc5a 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -2063,7 +2063,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo CveJornada As Integer, IdCtaContPersonal As Integer, CtaContPersonal As String, IdCtaContPrestamos As Integer, CtaContPrestamos As String, CveEmpresa As Integer, CveUsuarioNomina As Integer, Optional CveSubProyectoZona As Integer = Nothing, Optional CveUniforme As Integer = -1, Optional TelefonoExtension As String = "-1", Optional CelularPersonal As String = "-1", Optional TelefonoMarcadoRapido As String = "-1", Optional ContactoAlterno As String = "-1", Optional CveUsuarioModifico As Integer = -1, Optional FechaActivo As Date = MinFecha, Optional FechaReingreso As Date = MinFecha, Optional CveTipodeSalario As Integer = 1, Optional Sindicalizado As Integer = -1, Optional CvePais As Integer = -1, Optional Pensionado As Boolean = False, Optional CveRegistroPatronal As Integer = -1, - Optional CveEmpresaAsignado As Integer = -1, Optional CveMedioTransporte As Integer = -1) As Boolean + Optional CveEmpresaAsignado As Integer = -1, Optional CveMedioTransporte As Integer = -1, Optional EsReserva As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2154,6 +2154,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveRegistroPatronal", SqlDbType.Int).Value = CveRegistroPatronal .Add("@CveEmpresaAsignado", SqlDbType.Int).Value = CveEmpresaAsignado .Add("@CveMedioTransporte", SqlDbType.Int).Value = CveMedioTransporte + .Add("@EsReserva", SqlDbType.Int).Value = EsReserva From 5e7a47d60f078743be671221a26c112de51ddb68 Mon Sep 17 00:00:00 2001 From: rrene Date: Fri, 8 Jul 2022 12:38:41 -0700 Subject: [PATCH 10/16] =?UTF-8?q?--=20actualizaci=C3=B3n=20de=20timbre=20e?= =?UTF-8?q?n=20carta=20porte.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/Timbrado.vb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 8c9a35137..fa00d566c 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -3483,6 +3483,14 @@ Public Class Timbrado End If If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then + Dim objGrales As New ClsGenerales + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "3.3") Then + Retorno = "" + Else + Retorno = "Error" + End If + objGrales.Dispose() + Using ObjInv As New ClsInventarios() If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then Retorno = "" @@ -5706,6 +5714,14 @@ Public Class Timbrado End If If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then + Dim objGrales As New ClsGenerales + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "4.0") Then + Retorno = "" + Else + Retorno = "Error" + End If + objGrales.Dispose() + Using ObjInv As New ClsInventarios() If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then Retorno = "" From 4256bfaeafbe05e6b7d06fd835ea84c31a0a0dde Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 9 Jul 2022 00:23:19 -0700 Subject: [PATCH 11/16] Correciones en cancelacion, carga de inventario --- App_Code/ClsAcumuladores.vb | 405 ++++++++++++++-------------- App_Code/Modelos.vb | 50 ++-- Inventarios/RecepcionUsados.aspx.vb | 2 +- 3 files changed, 239 insertions(+), 218 deletions(-) diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 85b31fb86..0ad493781 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -7,10 +7,10 @@ Imports Extensiones Public Class ClsAcumuladores - Implements IDisposable - + Implements IDisposable + #Region "Campos" - 'SQL + 'SQL Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter Private SqlTransacc As SqlTransaction @@ -51,7 +51,7 @@ Public Class ClsAcumuladores If TransaccionCompartida Is Nothing Then SqlConexion = New SqlConnection - SqlConexion.ConnectionString = CadenaConexion() ' ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + SqlConexion.ConnectionString = CadenaConexion() ' ConfigurationManager.ConnectionStrings("Conexion").ConnectionString SqlAdapter = New SqlDataAdapter("", SqlConexion) Try @@ -68,9 +68,9 @@ Public Class ClsAcumuladores SqlAdapter = New SqlDataAdapter("", SqlConexion) ConexionAdd() - End Sub + End Sub #Region "Conexiones" - + Private Sub ConexionAdd() If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -103,18 +103,18 @@ Public Class ClsAcumuladores CveConexion = 0 End If - End Sub + End Sub #End Region Public ReadOnly Property DtResultados() As DataTable Get DtResultados = Data End Get - End Property - + End Property + #End Region - + #Region " TAMAÑOS " - + Public Function TamañoGet(CveTamaño As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -245,38 +245,38 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - Public Function EntradasUsadosGet(CveEmpresa As Integer, CveAlmacen As Integer, FechaInicial As Date, FechaFinal As Date) As Boolean - Dim retorno As Boolean = False - - SqlDataAdapter("PA_Acum_EntradasUsadosResumenRep") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@FechaInicial", SqlDbType.Date).Value = FechaInicial - .Add("@FechaFinal", SqlDbType.Date).Value = FechaFinal - End With - - Try - SqlAdapter.Fill(Data) - retorno = True - Catch ex As Exception - - OnError("Ocurrió un error al traerse el reporte de usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - - End Try - - Return retorno - - End Function - - + End Function + + Public Function EntradasUsadosGet(CveEmpresa As Integer, CveAlmacen As Integer, FechaInicial As Date, FechaFinal As Date) As Boolean + Dim retorno As Boolean = False + + SqlDataAdapter("PA_Acum_EntradasUsadosResumenRep") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@FechaInicial", SqlDbType.Date).Value = FechaInicial + .Add("@FechaFinal", SqlDbType.Date).Value = FechaFinal + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al traerse el reporte de usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return retorno + + End Function + + #End Region - + #Region " TIPOS DEFECTO " - + Public Function TiposDefectoGet(CveTipoDefecto As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -375,12 +375,12 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + #End Region - + #Region " TIPOS USO " - + Public Function TiposUsoGet(CveTipoUso As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -479,12 +479,12 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + #End Region - + #Region " FOLIOS GARANTÍA " - + Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -492,11 +492,11 @@ Public Class ClsAcumuladores SqlDataAdapter("PA_Acum_FoliosGarantiaGet") With SqlAdapter.SelectCommand.Parameters - .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia + .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio + .Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio .Add("@Area", SqlDbType.Int).Value = Area End With @@ -526,7 +526,7 @@ Public Class ClsAcumuladores .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio - .Add("@Limite", SqlDbType.Int).Value = Limite + .Add("@Limite", SqlDbType.Int).Value = Limite .Add("@Area", SqlDbType.Int).Value = Area End With @@ -594,27 +594,27 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean - Dim Retorno As Boolean = False - SqlDataAdapter(String.Format("SELECT MAX(dbo.FNC_Numero(Consecutivo)) AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text) - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError(String.Format("Ocurrió un error al consultar un nuevo consecutivo para el folio {0}", CveFolioGarantia), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + End Function + + Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter(String.Format("SELECT MAX(dbo.FNC_Numero(Consecutivo)) AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError(String.Format("Ocurrió un error al consultar un nuevo consecutivo para el folio {0}", CveFolioGarantia), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region " GARANTÍAS MESES " - + Public Function GarantiasMesesGet(CveGarantiaMes As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveTipoUso As Integer = -1, Optional Mes As Integer = -1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -720,12 +720,12 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + #End Region - + #Region "GARANTIAS DETALLES" - + Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer, CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String, CveTipoDefecto As Integer, CodigoTD As String, TipoComprobante As Integer, Comprobante As String, Importe As Double, @@ -741,18 +741,18 @@ Public Class ClsAcumuladores .Add("@CodigoEnsamble", SqlDbType.VarChar).Value = CodigoEnsamble .Add("@CodigoLinea", SqlDbType.VarChar).Value = CodigoLinea .Add("@CodigoInspeccion", SqlDbType.VarChar).Value = CodigoInspeccion - .Add("@CveTipoDefecto", SqlDbType.Int).Value = CveTipoDefecto - .Add("@CodigoTD", SqlDbType.VarChar).Value = CodigoTD + .Add("@CveTipoDefecto", SqlDbType.Int).Value = CveTipoDefecto + .Add("@CodigoTD", SqlDbType.VarChar).Value = CodigoTD .Add("@TipoComprobante", SqlDbType.TinyInt).Value = TipoComprobante .Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante .Add("@Importe", SqlDbType.Float).Value = Importe - .Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo - .Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste + .Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo + .Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste .Add("@PorcentajeAjuste", SqlDbType.Float).Value = PorcentajeAjuste - .Add("@CveBCIAjuste", SqlDbType.Int).Value = CveBCIAjuste - .Add("@Etiqueta", SqlDbType.VarChar).Value = Etiqueta - .Add("@CveClienteDistribuidor", SqlDbType.Int).Value = CveClienteDistribuidor - .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto + .Add("@CveBCIAjuste", SqlDbType.Int).Value = CveBCIAjuste + .Add("@Etiqueta", SqlDbType.VarChar).Value = Etiqueta + .Add("@CveClienteDistribuidor", SqlDbType.Int).Value = CveClienteDistribuidor + .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto .Add("@Año", SqlDbType.VarChar).Value = Año End With Try @@ -762,9 +762,9 @@ Public Class ClsAcumuladores OnError("Ocurrió un al agregar la garantia detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - + End Function + + Public Function GetGarantiasDetalle(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasDetalleGet") @@ -778,7 +778,7 @@ Public Class ClsAcumuladores OnError("Ocurrió un al obtener la garantía detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function Public Function GetGarantiasPolizaVirtual(CveVenta As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet") @@ -793,8 +793,8 @@ Public Class ClsAcumuladores OnError("Ocurrió un al obtener la información de poliza virtual.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + Public Function UpdateGarantiasDetallePoliza(CveVenta As Integer, FolioPolizaVirtual As String) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasDetallePolizaUpdate") @@ -809,8 +809,8 @@ Public Class ClsAcumuladores OnError("Ocurrió un error a actualizar folio de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + Public Function EliminarGarantiasDetalle(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasDetallePolizaRemove") @@ -824,13 +824,13 @@ Public Class ClsAcumuladores OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - - + End Function + + + #End Region - -#Region "P O L I Z A - V I R T U A L" + +#Region "P O L I Z A - V I R T U A L" Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal, TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime, CvePSUsado As Integer, CveBCIUsado As Integer, CveMarcaUsado As Integer) As Boolean @@ -841,16 +841,16 @@ Public Class ClsAcumuladores .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@Cantidad", SqlDbType.Float).Value = Cantidad - .Add("@PU", SqlDbType.Money).Value = PU - .Add("@Descuento", SqlDbType.Money).Value = Descuento + .Add("@PU", SqlDbType.Money).Value = PU + .Add("@Descuento", SqlDbType.Money).Value = Descuento .Add("@Total", SqlDbType.Money).Value = Total - .Add("@TipoServicio", SqlDbType.Int).Value = TipoServicio - .Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza + .Add("@TipoServicio", SqlDbType.Int).Value = TipoServicio + .Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto .Add("@AnioVehiculo", SqlDbType.Int).Value = AnioVehiculo .Add("@TieneUsado", SqlDbType.Bit).Value = TieneUsado .Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado - .Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado + .Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado .Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado .Add("@CveMarcaUsado", SqlDbType.Int).Value = CveMarcaUsado End With @@ -861,7 +861,7 @@ Public Class ClsAcumuladores OnError("Ocurrió un al agregar la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function Public Function GetPolizasVirtuales(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualGet") @@ -875,14 +875,14 @@ Public Class ClsAcumuladores OnError("Ocurrió un al obtener la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + Public Function UpdatePolizaVirtual(CvePolizaVirtual As Integer, CveMarca As Integer, FechaUsado As DateTime) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualUpdate") With SqlAdapter.SelectCommand.Parameters - .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual - .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado End With Try @@ -892,15 +892,15 @@ Public Class ClsAcumuladores OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function Public Function UpdateEnvioPolizaVirtual(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime, CodigoUnico As String, RespuestaEnvio As String) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate") With SqlAdapter.SelectCommand.Parameters - .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual - .Add("@Envio", SqlDbType.TinyInt).Value = Envio - .Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio - .Add("@CodigoUnico", SqlDbType.VarChar).Value = CodigoUnico + .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual + .Add("@Envio", SqlDbType.TinyInt).Value = Envio + .Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio + .Add("@CodigoUnico", SqlDbType.VarChar).Value = CodigoUnico .Add("@RespuestaEnvio", SqlDbType.VarChar).Value = RespuestaEnvio End With Try @@ -910,8 +910,8 @@ Public Class ClsAcumuladores OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + Public Function EliminarPolizaVirtual(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualRemove") @@ -925,11 +925,12 @@ Public Class ClsAcumuladores OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function -#End Region - + End Function +#End Region + Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, - CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1) As Boolean + CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1, + Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -947,6 +948,8 @@ Public Class ClsAcumuladores .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + .Add("@CveVentaBonificacion", SqlDbType.Int).Value = CveVentaBonificacion + .Add("@FacturadoBonificacion", SqlDbType.Bit).Value = FacturadoBonificacion End With Try @@ -983,8 +986,8 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + Public Function GetMovimientosDistribuidorResumen(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -1076,8 +1079,8 @@ Public Class ClsAcumuladores OnError("Ocurrió un error al consultar el reporte de usados. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -1085,10 +1088,10 @@ Public Class ClsAcumuladores SqlDataAdapter("PA_Acum_EntradasUsadosClientesGet") With SqlAdapter.SelectCommand.Parameters - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@FechaInicio", SqlDbType.Date).Value = FechaI - .Add("@FechaFin", SqlDbType.Date).Value = FechaF - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@FechaFin", SqlDbType.Date).Value = FechaF + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveCliente", SqlDbType.Int).Value = CveCliente @@ -1104,8 +1107,8 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + Public Function EntradasUsadosClientesDetalleRep(EsDistribuidor As Boolean, CveCliente As Integer, CvePS As Integer, FechaInicio As Date, FechaFin As Date, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -1116,10 +1119,10 @@ Public Class ClsAcumuladores .Add("@EsDistribuidor", SqlDbType.Bit).Value = If(EsDistribuidor, 1, 0) .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With @@ -1133,25 +1136,25 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - - Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - - Dim Retorno As Boolean = False - + End Function + + + Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Acum_RepIndicadorDiarioGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With - Try - + Try + SqlAdapter.Fill(Data) Retorno = True @@ -1162,25 +1165,25 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - - Dim Retorno As Boolean = False - + End Function + + Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Acum_RepIndicadorDiarioDetalleGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With - Try - + Try + SqlAdapter.Fill(Data) Retorno = True @@ -1191,22 +1194,22 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - Public Function GetUsadosClasificacionVentas(CveCliente As Integer, CvePS As Integer, FechaInicio As String, FechaFin As String) As Boolean - - Dim Retorno As Boolean = False - - SqlDataAdapter("PA_Acum_UsadosClasificacionVentas") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + End Function + + Public Function GetUsadosClasificacionVentas(CveCliente As Integer, CvePS As Integer, FechaInicio As String, FechaFin As String) As Boolean + + Dim Retorno As Boolean = False + + SqlDataAdapter("PA_Acum_UsadosClasificacionVentas") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin End With - Try + Try SqlAdapter.Fill(Data) Retorno = True Catch ex As SqlException @@ -1214,15 +1217,15 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + Public Function GetFoliosGarantiasDetalle(CveFolioGarantia As Integer, Optional CveGarantiaDetalle As Integer = -1, Optional CveEstatusConsecutivo As Integer = -1, Optional Consec As Integer = -1) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasDetalleFolioGet") With SqlAdapter.SelectCommand.Parameters - .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia + .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia .Add("@CveGarantiaDetalle", SqlDbType.Int).Value = CveGarantiaDetalle .Add("@CveEstatusConsecutivo", SqlDbType.Int).Value = CveEstatusConsecutivo .Add("@Consec", SqlDbType.Int).Value = Consec @@ -1236,8 +1239,8 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - + End Function + Public Function UpdateGarantiaCancelacion(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False @@ -1255,17 +1258,17 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - + 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 + With SqlAdapter.SelectCommand.Parameters .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@Opcion", SqlDbType.Int).Value = CveOpcion + .Add("@Opcion", SqlDbType.Int).Value = CveOpcion .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With @@ -1278,19 +1281,19 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - + End Function + + Public Function GetPolizaVirtualRep(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualRepGet") - With SqlAdapter.SelectCommand.Parameters + With SqlAdapter.SelectCommand.Parameters .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario @@ -1304,20 +1307,20 @@ Public Class ClsAcumuladores End Try Return Retorno - End Function - - + End Function + + #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not disposedValue Then - If disposing Then - - If Not Data Is Nothing Then Data.Dispose() : Data = Nothing - If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing - If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing - If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If disposing Then + + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing End If @@ -1334,7 +1337,7 @@ Public Class ClsAcumuladores ConexionClose() Dispose(True) GC.SuppressFinalize(Me) - End Sub + End Sub #End Region - + End Class diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 06c40941f..6751ca1bf 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -379,7 +379,7 @@ Namespace Modelos 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, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True) + Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True, Optional VerificaAlmacen As Boolean = True) Me.UsuarioActual = UsuarioActual Me.CveVenta = CveVenta Me.CveEmpresa = CveEmpresa @@ -391,7 +391,7 @@ Namespace Modelos IniciaValores() Dim ObjVentas As New ClsVentas() - If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, CveEmpresa, VerificaAlmacen:=VerificaAlmacen) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then setValues(ObjVentas.DtResultados.Rows(0)) @@ -2101,21 +2101,34 @@ Namespace Modelos Case "Egs" CveConcepto = 6 End Select + 'SI ES FACTURA,NC,DEV O ES RNC DE CARGO, CANCELAR MOVIMIENTOS + If factura.TipoDocto.Contiene("Ing", "Dev", "Egs") OrElse factura.TipoDocto.Contiene("RNC") AndAlso factura.Num1 = 1 Then + If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then + Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") + If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then + For Each RowSalida As DataRow In DtMovimientos.Rows + Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1 - If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then - Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") - If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then - For Each RowSalida As DataRow In DtMovimientos.Rows - Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1 + Dim FacturadoBonificacion = False + Dim CveVentaBonificacion As Integer = -1 - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then - Retorno = False - Exit For - End If - Next - DtMovimientos.Dispose() + If factura.TipoDocto = "RNC" Then + CveVentaBonificacion = RowSalida("CveVentaBonificacion").ToString().ToEntero() + FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString()) + End If + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha, CveVentaBonificacion:=CveVentaBonificacion, FacturadoBonificacion:=FacturadoBonificacion) Then + Retorno = False + Exit For + End If + Next + DtMovimientos.Dispose() + End If End If + Else + End If + Return Retorno End Function @@ -2217,7 +2230,7 @@ Namespace Modelos End Function - Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Integer + Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, Optional GenerarPrePoliza As Boolean = True) As Integer Dim CveMovimiento As Integer = -1 Try Dim CveConceptoSalidaUsado As Integer = 45 @@ -2240,7 +2253,7 @@ Namespace Modelos End If Next - If CveMovimiento > 0 Then + If GenerarPrePoliza AndAlso CveMovimiento > 0 Then Dim Concepto As String = "Cancelación Usado" & factura.SerieFolio Dim CvePrePoliza = ObjConta.AddPrePolizas("Mod/CancSalUsados", 74, DtMovimientosEntrada.SUMD("Total"), DtMovimientosEntrada.SUMD("Total"), 1, tFecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero @@ -2498,7 +2511,7 @@ Namespace Modelos Dim TipoMovto68 = TipoMovimiento 'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS If ValorMultiplicador = -1 Then - CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta) + CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta, GenerarPrePoliza:=False) Else CveMovimientoReferencia = CveMovimiento End If @@ -5675,6 +5688,11 @@ Namespace Modelos If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10") CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero() + 'SI ES SERVICIO A DOMICILIO DEBE REGRESAR A ESTE TIPO DE ALMACEN + If Me.ServicioDomicilio Then + CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 29").ToString().ToEntero() + End If + CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero() CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 807fcfcd0..3385a7bfa 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2278,7 +2278,7 @@ Partial Class Inventarios_RecepcionUsados Me.ObjFactura = Nothing End If - Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False) + Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) If Me.ObjFactura IsNot Nothing Then From b56f9aa4ce5177c1f577cb55f26045abcf56c1cf Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 9 Jul 2022 00:23:58 -0700 Subject: [PATCH 12/16] Editar formatos de stimulsoft --- App_Code/ClsPaginas.vb | 88 ++++++++++++++++++-------------- Sistemas/ListadoReportes.aspx | 81 +++++++++++++++++++++++++++++ Sistemas/ListadoReportes.aspx.cs | 46 +++++++++++++++++ 3 files changed, 177 insertions(+), 38 deletions(-) create mode 100644 Sistemas/ListadoReportes.aspx create mode 100644 Sistemas/ListadoReportes.aspx.cs diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index d5147673d..1ed0e6bf2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4324,6 +4324,7 @@ Public Class ClsPaginas PaginaDict.Add("/OC/OCPendientes.aspx".ToUpper(), -1) PaginaDict.Add("/Sistemas/Registro.aspx".ToUpper(), -1) PaginaDict.Add("/Sistemas/WizardRegistro.aspx".ToUpper(), -1) + PaginaDict.Add("/Sistemas/ListadoReportes.aspx".ToUpper(), 702) PaginaDict.Add("/Ventas/VentasRene.aspx".ToUpper(), -1) PaginaDict.Add("/Contratos/Contrato2.aspx".ToUpper(), -1) PaginaDict.Add("/Flotillas/CatMantenimientos.aspx".ToUpper(), -1) @@ -6962,7 +6963,8 @@ Public Class ClsPaginas ' GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) ' End Try 'End Sub - Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte() + + Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing, Optional UsarStimulsoft As Boolean = False) As Byte() Dim retorno As Byte() = Nothing ' Dim ObjVentas As New ClsVentas @@ -7789,46 +7791,52 @@ Public Class ClsPaginas Next End If - Dim Archivo As New System.IO.FileInfo(RutaFormato) - If Archivo.Exists Then - 'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ' RutaFormato = RutaFormato.Replace(".rdlc", ".mrt") - ' retorno = StreamBytesStimulsoft("Facturas", RutaFormato, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF") - 'Else - ' retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing) - 'End If - retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData) + If Not UsarStimulsoft Then + Dim Archivo As New System.IO.FileInfo(RutaFormato) + If Archivo.Exists Then + 'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + ' RutaFormato = RutaFormato.Replace(".rdlc", ".mrt") + ' retorno = StreamBytesStimulsoft("Facturas", RutaFormato, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF") + 'Else + ' retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing) + 'End If + retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData) - Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) - If Guardar Then - If Not ArchivoPDF.Exists Then - Try - DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta)) - DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto)) - File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) - Catch ex As Exception - Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) - End Try - Else - Try - ArchivoPDF.Delete() - File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) - Catch ex As Exception - Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) - End Try + Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) + If Guardar Then + If Not ArchivoPDF.Exists Then + Try + DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta)) + DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto)) + File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) + Catch ex As Exception + Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + End Try + Else + Try + ArchivoPDF.Delete() + File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) + Catch ex As Exception + Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + End Try + End If End If + Else + params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC)) + 'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + ' RutaFormato = RutaFormato.Replace(".rdlc", ".mrt") + ' retorno = StreamBytesStimulsoft("Facturas", RutaFormatoDefault, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF") + 'Else + ' retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing) + 'End If + retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData) End If Else - params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC)) - 'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ' RutaFormato = RutaFormato.Replace(".rdlc", ".mrt") - ' retorno = StreamBytesStimulsoft("Facturas", RutaFormatoDefault, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF") - 'Else - ' retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing) - 'End If - retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData) + RutaFormato = RutaFormato.Replace(".rdlc", ".mrt") + retorno = StreamBytesStimulsoft("Facturas", RutaFormato, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF") End If + Catch ex As Exception GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) End Try @@ -7864,9 +7872,12 @@ Public Class ClsPaginas If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) End If - + Dim urlHost As String = "http://localhost:2202/" + If EsProduccion Then + urlHost = "http://sig.adssistemas.mx:6599/" + End If 'SITIO DE PRUEBA EN IIS - Dim Url = New Uri(String.Format("{0}{1}", "http://localhost:2202/", Opcion)) + Dim Url = New Uri(String.Format("{0}{1}", urlHost, Opcion)) Try Dim dataSourceArray As New JArray() @@ -7883,6 +7894,7 @@ Public Class ClsPaginas Dim payload As New JObject( New JProperty("formato", Formato), New JProperty("ruta", RutaReporte), + New JProperty("UsarFormatoCompilado", false), New JProperty("parametros", paramsArray), New JProperty("dataSource", dataSourceArray) ) diff --git a/Sistemas/ListadoReportes.aspx b/Sistemas/ListadoReportes.aspx new file mode 100644 index 000000000..04c7bdaa4 --- /dev/null +++ b/Sistemas/ListadoReportes.aspx @@ -0,0 +1,81 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ListadoReportes.aspx.cs" Inherits="Sistemas_ListadoReportes" %> + + + + + + + Listado de reportes de Stimulsoft + + + + + + + + + + +
+
+
+
+
+ Listado de formatos +
+
+
+
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+
+
+
+
+
+ + + + diff --git a/Sistemas/ListadoReportes.aspx.cs b/Sistemas/ListadoReportes.aspx.cs new file mode 100644 index 000000000..4ab288968 --- /dev/null +++ b/Sistemas/ListadoReportes.aspx.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using static Extensiones.ModExtensiones; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class Sistemas_ListadoReportes : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + string RutaReportes = string.Format("{0}/Formatos", UsuarioActual.Empresa.Ruta); + + string[] allfiles = Directory.GetFiles(RutaReportes, "*.mrt", SearchOption.AllDirectories); + + GvDatos.DataSource = (from Reporte in allfiles + let file = new FileInfo(Reporte) + select new { RutaReporte = file.FullName, Reporte = file.Name.Replace(".mrt","") }).QueryToDataTable(true); + GvDatos.DataBind(); + UPDatos.Update(); + } + + protected void BtnEditar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + var RutaReporteEncriptada = Encripta(GvRow.DataKey("RutaReporte")); + var hostURL = "https://localhost:7162"; + if (UsuarioActual.Empresa.FacturaProduccion) + { + hostURL = "http://sig.adssistemas.mx:6599"; + } + var strURL = $"{hostURL}/Designer/EditReport?P={RutaReporteEncriptada}"; + + RegistraScript($"openWindow('{strURL}');"); + } +} \ No newline at end of file From 9a56961b18fbca77acaa6b5326c28472d0882d3f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 9 Jul 2022 00:29:28 -0700 Subject: [PATCH 13/16] Cancelacion de RNC de bonificacion automaticamente, descarga de PDF de stimulsoft --- Compras/PopUpVerFactura.aspx.vb | 61 ++++++------ Ventas/Ventas.aspx | 47 +++++---- Ventas/Ventas.aspx.vb | 167 ++++++++++++++++++++++++++------ 3 files changed, 198 insertions(+), 77 deletions(-) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 3dbb9b2f6..34a145d8f 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1079,7 +1079,9 @@ Partial Class PopUpVerFactura Dim AplicaPagare As String = If(UrlParametros("PAG") IsNot Nothing AndAlso UrlParametros("PAG").ToString <> "", UrlParametros("PAG").ToString, "0") Dim Guardar As Boolean = UrlParametros("GUARDAR") IsNot Nothing AndAlso UrlParametros("GUARDAR").ToString() = "1" Dim RegenerarPDF As Boolean = UrlParametros("REGENERAR") IsNot Nothing AndAlso UrlParametros("REGENERAR").ToString() = "1" - imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF) + Dim STIMULSOFT As Boolean = UrlParametros("STIMULSOFT") IsNot Nothing AndAlso UrlParametros("STIMULSOFT").ToString() = "1" + + imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF, UsarStimulsoft:=STIMULSOFT) End If End If @@ -2694,7 +2696,7 @@ Partial Class PopUpVerFactura Archivo = Nothing End If End Sub - Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False) + Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False, Optional UsarStimulsoft As Boolean = False) Dim ObjVentas As New ClsVentas Dim Vta As Modelos.Factura = Nothing @@ -2723,7 +2725,7 @@ Partial Class PopUpVerFactura Dim Archivo As New System.IO.FileInfo(PathArchivo) 'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS - If Not Archivo.Exists OrElse RegenerarPDF Then + If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString 'se rellena la sucursal 'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel) @@ -3028,7 +3030,7 @@ Partial Class PopUpVerFactura Dim CveTimbreCartaPorteVenta As Integer = -1 Dim CartaPorte As Modelos.MSubReportData = Nothing 'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS - If Not Archivo.Exists OrElse RegenerarPDF Then + If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then If UsuarioActual.CveEmpresa = 13 AndAlso Vta.TipoDocto = "Ing" Then Using ObjGral As New ClsGenerales If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then @@ -3046,37 +3048,42 @@ Partial Class PopUpVerFactura End If End If - If Archivo.Exists Then - If RegenerarPDF Then - Archivo.Delete() + If UsarStimulsoft Then + ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte, UsarStimulsoft:=UsarStimulsoft), Vta.SerieFolio, "PDF") + Else + If Archivo.Exists Then + If RegenerarPDF Then + Archivo.Delete() + If UsuarioActual.Empresa.CvePlataforma = 2 Then + GeneraPDFVtaPyMe(Vta, "PDF") + Else + ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF") + Vta = Nothing + End If + Else + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf") + HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(PathArchivo) + 'HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + Archivo = Nothing + End If + Else + + '04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME If UsuarioActual.Empresa.CvePlataforma = 2 Then GeneraPDFVtaPyMe(Vta, "PDF") Else - ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF") + ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF") Vta = Nothing End If - Else - HttpContext.Current.Response.Clear() - HttpContext.Current.Response.ClearContent() - HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf") - HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name) - HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) - HttpContext.Current.Response.TransmitFile(PathArchivo) - 'HttpContext.Current.Response.Flush() - HttpContext.Current.Response.End() - Archivo = Nothing - End If - Else - - '04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME - If UsuarioActual.Empresa.CvePlataforma = 2 Then - GeneraPDFVtaPyMe(Vta, "PDF") - Else - ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF") - Vta = Nothing End If End If + End If End Sub diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 3801acf57..07dd3e8e0 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -200,6 +200,12 @@
  • Imprimir PDF
  • +
  • + Regenerar PDF +
  • +
  • + Imprimir PDF Stimulsoft +
  • Imprimir Acuse Cancelación
  • @@ -282,8 +288,8 @@ Retiro de Efectivo -
  • - +
  • +
  • @@ -7788,17 +7794,20 @@
  • +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    - + <%-- --%>
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    +
    ').prop('readonly', DisabledTxtTotal); - $('#C_Tab_TabComplementos_TxtFechaLlegadaCP').datetimepicker({ - dayOfWeekStart: 1, - lang: 'es', - format: 'd/m/Y H:i', - formatDate: 'd/m/Y H:i', - step: 30 + $('#C_Tab_TabComplementos_TxtFechaLlegadaCP').datetimepicker({ + dayOfWeekStart: 1, + lang: 'es', + format: 'd/m/Y H:i', + formatDate: 'd/m/Y H:i', + step: 30 }); - $('#C_Tab_TabComplementos_TxtFechaEntregaCP').datetimepicker({ - dayOfWeekStart: 1, - lang: 'es', - format: 'd/m/Y H:i', - formatDate: 'd/m/Y H:i', - step: 30 + $('#C_Tab_TabComplementos_TxtFechaEntregaCP').datetimepicker({ + dayOfWeekStart: 1, + lang: 'es', + format: 'd/m/Y H:i', + formatDate: 'd/m/Y H:i', + step: 30 }); } diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6e265c459..a9ce792cd 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8905,6 +8905,13 @@ Partial Class Ventas If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then HplDownPDF.Visible = True HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) + If UsuarioActual.CveRol = 1 Then + HplRenerarPDF.Visible = True + HplRenerarPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR=1", CveVenta))) + + HplImprimirPDFStimulsoft.Visible = True + HplImprimirPDFStimulsoft.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0&STIMULSOFT=1", CveVenta))) + End If End If 'NO DEBE IMPRIMIR PDF DE COTIZACION @@ -19242,22 +19249,28 @@ Partial Class Ventas End If If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ListaDescuentos IsNot Nothing AndAlso ListaDescuentos.Count > 0 Then - TxtObsFact.Text = "" + Dim Titulo As String = ListaDescuentos.FirstOrDefault().NombrePromo Dim strPromos As New StringBuilder If Not String.IsNullOrEmpty(Titulo) Then For Each Promo As Descuentos In ListaDescuentos - strPromos.AppendFormat("{0}, ", Promo.ObsDescuento) + If Not String.IsNullOrEmpty(Promo.ObsDescuento) Then + strPromos.AppendFormat("{0}, ", Promo.ObsDescuento) + End If Next If strPromos.Length > 2 Then strPromos.Remove(strPromos.Length - 2, 2) End If + If strPromos.Length > 0 Then + TxtObsFact.Text = "" + TxtObsFact.Text = String.Format("{0} {1}", Titulo, strPromos.ToString()) + End If + End If - TxtObsFact.Text = String.Format("{0} {1}", Titulo, strPromos.ToString()) End If UPObservaciones.Update() @@ -23793,7 +23806,36 @@ Partial Class Ventas ', "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta End If ObjVentas.Dispose() + ElseIf DdlTipoComprobante.SelectedValue.Contiene("RNC") Then + LblCancelarDocumento.Text = "¿Desea cancelar la remisión de nota de crédito?
    " + Dim sbExtra As New StringBuilder + + Using ObjAcum As New ClsAcumuladores + If ObjAcum.DistribuidorMovtosGet(Me.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=Me.CveVenta, CveConcepto:=1) Then + Dim DtBon As DataTable = ObjAcum.DtResultados.FiltraParametros("CveVentaBonificacion > 0", DistinctColumns:={"SerieFolioBonificacion", "CveVentaBonificacion"}) + If DtBon IsNot Nothing AndAlso DtBon.Rows.Count > 0 Then + sbExtra.Append("*Se cancelaran las siguientes remisiones de nota de crédito de bonificación.
    ") + For Each RowBon As DataRow In DtBon.Rows + sbExtra.AppendFormat("     {1}
    ", RowBon("CveVentaBonificacion"), RowBon("SerieFolioBonificacion")) + Next + DtBon.Dispose() + End If + End If + End Using + + LbCancelarDescripcion.Text = sbExtra.ToString() + DivRelacionadasCancelacion.Visible = False + BtnCancelarDocumento.Visible = True + DivMotivoCancelacion.Visible = False + DivMotivoCancelacionTxt.Visible = False + DivCanRem.Visible = False + DivDevAlm.Visible = False + + UpCancelarDocumento.Update() + + RegistraScript("$('#ModalCancelarDocumento').modal();") Else + CancelarDocumento() End If @@ -23963,7 +24005,7 @@ Partial Class Ventas Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True) Try Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing - + Dim strMensaje As New StringBuilder() If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then Dim SWatch As New Stopwatch SWatch.Start() @@ -23976,6 +24018,7 @@ Partial Class Ventas 'ObjE.Dispose() resp = ObjFacturaCancelacion.CancelarPorRefacturacion(DdlMotivoRefacturacion.SelectedValue.ToEntero(), TxtMotivoRefac.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) + strMensaje.Append(resp.Mensaje) Else Dim ListaRemisionesCancelar As New List(Of Integer) If ChkCanRem.Checked Then @@ -23993,6 +24036,41 @@ Partial Class Ventas End If resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) + strMensaje.Append(resp.Mensaje) + Dim DtBonificaciones As DataTable = Nothing + + 'SI ES RNC DE CARGO DEBE CANCELAR LAS BON + If Not resp.HuboError AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("RNC") AndAlso ObjFacturaCancelacion.Num1 = 1 Then + Using ObjAcum As New ClsAcumuladores + If ObjAcum.DistribuidorMovtosGet(ObjFacturaCancelacion.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=ObjFacturaCancelacion.CveVenta, CveConcepto:=1) Then + DtBonificaciones = ObjAcum.DtResultados.FiltraParametros("CveVentaBonificacion > 0", DistinctColumns:={"CveVentaBonificacion"}) + End If + End Using + + + If DtBonificaciones IsNot Nothing AndAlso DtBonificaciones.Rows.Count > 0 Then + For Each RowBon As DataRow In DtBonificaciones.Rows + Try + 'VERIFICA SI TIENE RNC DE BONIFICACION + Dim Bon = New Modelos.Factura(UsuarioActual, RowBon("CveVentaBonificacion").ToString().ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) + Dim respBon = Bon.CancelarFactura(False, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) + If respBon.HuboError Then + strMensaje.AppendFormat("
    Ocurrió un error al cancelar la remisión de NC de bonificación {0} .", Bon.SerieFolio) + Else + strMensaje.AppendFormat("
    La remisión de nota de credito de bonificación {0} fue cancelada correctamente.", Bon.SerieFolio) + End If + strMensaje.AppendFormat("
    {0}", resp.Mensaje) + Catch ex As Exception + OnError("Ocurrió un error al cancelar la bonificación", ex) + strMensaje.Append("
    Ocurrió un error al cancelar la bonificación") + End Try + + Next + DtBonificaciones.Dispose() + End If + + End If + End If SWatch.Stop() @@ -24005,10 +24083,10 @@ Partial Class Ventas End If If resp.HuboError Then - Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") + Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") Else If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then - Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") + Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") Else If EsRefacturacion Then If resp.CveEstatus = 20 Then @@ -24016,10 +24094,10 @@ Partial Class Ventas ElseIf resp.CveEstatus.Contiene(4, 5, 23) Then LigaRedirigir = $"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1" Else - Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") + Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") End If Else - Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") + Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") End If End If End If @@ -26891,14 +26969,15 @@ Partial Class Ventas End If GvDescNCCargos.DataBind() - Dim SaldoMaximoUtilizable As Decimal = 0 + Dim SaldoMaximoCliente As Decimal = 0 + Dim SaldoEntregado As Decimal = 0 If CargarSoloGarantias Then Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = SaldoMaximo + SaldoMaximoCliente = SaldoMaximo Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If Else Dim ObjAcum As New ClsAcumuladores @@ -26908,25 +26987,32 @@ Partial Class Ventas Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If - + Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1) + SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal() Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If ObjAcum.Dispose() End If Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then + If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then + SaldoMaximoUsadosFactura = SaldoMaximoCliente + End If + + Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + + If SaldoMaximoUtilizable > 0 Then HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) Else - HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString() - LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura) + HdnSaldoMaximoUsados.Value = "0" + LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0) End If Else @@ -27042,14 +27128,14 @@ Partial Class Ventas End If GvDescNCCargosDetalle.DataBind() - Dim SaldoMaximoUtilizable As Decimal = 0 - + Dim SaldoMaximoCliente As Decimal = 0 + Dim SaldoEntregado As Decimal = 0 If CargarSoloGarantias Then Dim SaldoMaximo As Decimal = TmpDTRNCDetalle.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = SaldoMaximo + SaldoMaximoCliente = SaldoMaximo Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If Else Dim ObjAcum As New ClsAcumuladores @@ -27059,27 +27145,36 @@ Partial Class Ventas Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If + Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1) + SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal() Else - SaldoMaximoUtilizable = 0 + SaldoMaximoCliente = 0 End If ObjAcum.Dispose() End If - Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - If SaldoMaximoUtilizable < SaldoMaximoUsados Then + If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then + SaldoMaximoUsadosFactura = SaldoMaximoCliente + End If + + Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + + If SaldoMaximoUtilizable > 0 Then HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) Else - HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() - LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados) + HdnSaldoMaximoUsados.Value = "0" + LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0) End If + UpDescNC.Update() End Sub Private Sub CargaRNCDetalleBonificacion(Optional CveVentaUsado As Integer = -1) @@ -27827,8 +27922,17 @@ Partial Class Ventas DtImpuestos = query.QueryToDataTable(False) DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False) + Dim TieneMultiplesSubProyectos As Boolean = False + 'VERIFICA SI EN LA FACTURA ACTUAL TUVO MULTIPLES SUBPROYECTOS, PARA CUADRAR AL FINAL EL IMPORTE ACUMULADO + If Not AplicaNCMasiva AndAlso AplicoNCFacturaActual Then + TieneMultiplesSubProyectos = TmpDT.FiltraParametros("", "", {"CveSubProyecto"}).COUNT("CveSubProyecto", "CveSubProyecto > 0") > 1 + If TieneMultiplesSubProyectos Then + AcumuladoNC = TxtNCImporte.Text.Trim.ToDecimal + End If + End If + 'ASUSTO LA DIFERENCIA EN EL ÚLTIMO CONCEPTO - If TipoDoctoNC = "Egs" AndAlso (Not AplicaNuevoDocumento) AndAlso AplicaNCMasiva AndAlso (Not NCDescuento) AndAlso AcumuladoNC > 0 Then + If TipoDoctoNC = "Egs" AndAlso (Not AplicaNuevoDocumento) AndAlso (AplicaNCMasiva OrElse TieneMultiplesSubProyectos) AndAlso (Not NCDescuento) AndAlso AcumuladoNC > 0 Then 'CODIGO PARA AJUSTE DE CENTAVO, SI EL IMPORTE TOTAL NO CUADRA CON LOS TOTALES Dim ImporteNC As Decimal = DtImpuestos.SUMD("ImporteTotal") + DtImpuestos.SUMD("ImporteIVA") + DtImpuestos.SUMD("ImporteIEPS") - DtImpuestos.SUMD("ImporteRetIVA") - DtImpuestos.SUMD("ImporteRetISR") @@ -28608,8 +28712,9 @@ Partial Class Ventas End If Dim AplicaRedondeo As Boolean = True + Dim TieneMultiplesSubProyectos As Boolean = TmpDT.FiltraParametros("", "", {"CveSubProyecto"}).COUNT("CveSubProyecto", "CveSubProyecto > 0") > 1 - If AplicaNCMasiva AndAlso Not NCDescuento Then + If AplicaNCMasiva AndAlso Not NCDescuento OrElse TieneMultiplesSubProyectos Then AplicaRedondeo = False End If From db5b6cc60e852953cb72939efb3bfcf912b41dd2 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 9 Jul 2022 00:29:50 -0700 Subject: [PATCH 14/16] quitar codigo incompleto --- Ashx/SIGWeb.ashx | 1 - 1 file changed, 1 deletion(-) diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index b47839ef4..0188639c9 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -1647,7 +1647,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If End While xtr.Close() - xtr. End Using If (System.IO.File.Exists(urfile)) Then Dim fechita As DateTime = fecha.ToDateTime() From a85b09d4bef429cc6da6da4265fe67ee2ad4048e Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 11 Jul 2022 08:59:54 -0700 Subject: [PATCH 15/16] -- --- Inventarios/EntradasSalidas.aspx.vb | 85 +++-- Inventarios/TraspasoAlmacen.aspx.vb | 541 ++++++++++++---------------- 2 files changed, 268 insertions(+), 358 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 94e2d5e33..ebc7303a3 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -721,9 +721,10 @@ Partial Class Inventarios_EntradasSalidas LbTipoCambio.Text = DtMov.Rows(0)("TipoCambio").ToString End If Dim TMDsTR = DtMov.Rows(0)("CveMtoRel").ToString - If DtMov.Rows(0)("CveMtoRel").ToString.Length > 0 Then + If TMDsTR.Length > 0 Then RowMtoRel.Visible = True - lnkMtoRelacionado.NavigateUrl = "/Inventarios/EntradasSalidas.aspx?CveMovimiento=" & DtMov.Rows(0)("CveMtoRel").ToString + lnkMtoRelacionado.NavigateUrl = "/Inventarios/EntradasSalidas.aspx?CveMovimiento=" & TMDsTR + CveMovimientoRelacionado = TMDsTR.ToEntero End If If Mov.CveMovimientoVirtual > 0 Then @@ -3725,6 +3726,7 @@ Partial Class Inventarios_EntradasSalidas Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & DdlConcepto.SelectedValue).ToEntero If OrigenMov = 1 Then MovAlmacen = False Else MovAlmacen = True + CveMovimientoRelacionado = ObjInventario.DtResultados.Rows(0)("CveMtoRel").ToString.ToEntero If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then DtCostos = ObjInventario.DtResultados @@ -3772,70 +3774,75 @@ Partial Class Inventarios_EntradasSalidas If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 205, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompra, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If + ElseIf ObjInventario.Modulo.Contiene("RE/G5", "EA/G5") Then + Contabilizable = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 331, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompra, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If Else - If ObjInventario.Modulo.Contiene("M/CU") Then + If ObjInventario.Modulo.Contiene("M/CU", "RU/G") Then Contabilizable = True - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 278, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompra, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, HplVenta.Text, 278, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveCompra:=CveCompra, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else If ObjInventario.Modulo.Contiene("TA/G1", "Recons") Then - Contabilizable = False - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 289, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then - ErrorMovInv = True - End If - Else + Contabilizable = False + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 289, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + Else If ObjInventario.Modulo.Contiene("Consig") Then Contabilizable = False If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 95, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else - If ObjInventario.Modulo = "ASA/G1" Then + If ObjInventario.Modulo.Contiene("ASA/G1", "Vta/E4", "ARMPAQ1", "RE/GSC3") Then Contabilizable = False If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else If DdlConcepto.SelectedValue.Contiene("6", "22", "23", "7", "16", "21", "24") Then - 'genero las prepolizas manuales - Dim tCveConcepto As Integer = 95 - Dim CveCuenta As Integer - If UsuarioActual.CveEmpresa = 119 Then CveCuenta = 55519 - IdCtaContable = 1 - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total"), Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total"), CveSubProyecto:=-1, CveCuenta:=CveCuenta, Contabilizable:=Contabilizable) Then - ErrorMovInv = True - - End If - - Else - - Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue.ToEntero}").ToEntero - Dim tCveConcepto As Integer = 69 - If DdlConcepto.SelectedValue = "30" Then - tCveConcepto = 181 - IdCtaContable = UsuarioActual.Empresa.Funcionalidad(342).ToEntero - End If - - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL - If tCveConcepto = 69 Then - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then + 'genero las prepolizas manuales + Dim tCveConcepto As Integer = 95 + Dim CveCuenta As Integer + If UsuarioActual.CveEmpresa = 119 Then CveCuenta = 55519 + IdCtaContable = 1 + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total"), Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total"), CveSubProyecto:=-1, CveCuenta:=CveCuenta, Contabilizable:=Contabilizable) Then ErrorMovInv = True - Exit For + End If - Next + Else + + Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue.ToEntero}").ToEntero + Dim tCveConcepto As Integer = 69 + If DdlConcepto.SelectedValue = "30" Then + tCveConcepto = 181 + IdCtaContable = UsuarioActual.Empresa.Funcionalidad(342).ToEntero + End If + + For Each RowInv As DataRow In tmpCostos.Rows + ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL + If tCveConcepto = 69 Then + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, Concepto, tCveConcepto, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario, CveSubProyecto:=tCveSubProyecto) Then + ErrorMovInv = True + Exit For + End If + + Next + End If End If End If End If End If End If End If - End If IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={DdlAlmacen.SelectedValue.ToEntero}").ToEntero If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, MovAlmacen, DtCostos.SUMD("Total").RoundSQL, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUMD("Total").RoundSQL, Contabilizable:=Contabilizable) Then diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 26376d8e0..03ae2fa79 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -979,11 +979,8 @@ Partial Class Inventarios_TraspasoAlmacen ErrorExistencia = True dr("EstatusExistencia") = "-1" dr("Cantidad") = Existencia - 'If Existencia <= 0 Then TextoExistencia.AppendFormat("- #{0} {1}
    ", dr("No").ToString, dr("PS").ToString) - 'Else - 'Alert(String.Format("Solo hay en existencia: {0}", Existencia), TipoMensaje.MsgError) - 'End If + End If Next Else @@ -1016,17 +1013,9 @@ Partial Class Inventarios_TraspasoAlmacen End If Dim TotalCantidad As Decimal = DtMovimientos.SUMD("Cantidad") - - ''[IPP-1Noviembre2018] SE COMENTA PORQUE NO TIENE NI PIES NI CABEZA. LE FALTA DESARROLLO - 'If (TipoAlmacenOrigen = 14 Or TipoAlmacenDestino = 14) And TipoAlmacenOrigen <> TipoAlmacenDestino Then - ' ObjInventario.Dispose() - ' 'es consumo interno - ' ConsumoInterno(TipoAlmacenOrigen, TipoAlmacenDestino) - 'End If - 'Inicia la transacción Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) - Dim CveMovimientoSalida = 0 + Dim CveMovimientoSalida As Integer = 0 Dim CveMovimientoEntrada = 0 Dim IDPoliza As Integer = 0 Dim FolioSalida = 0 @@ -1034,13 +1023,16 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveMovimientoVirtualSalida As Integer = 0 Dim FolioVirtualEntrada As Integer = 0 Dim FolioVirtualSalida As Integer = 0 - Dim FolioEntrada = 0 - Dim AlmacenEntrada = -1 + Dim FolioEntrada As Integer = 0 Dim Fecha As Date = TxtFecha.Text.ToDate Dim ErrorMovInv As Boolean = False Dim ErrorAC As Boolean = False Dim TextoError = "" - Dim TipoMovimientoSalida As Integer = 26 'If(ChkTransitorio.Checked, 26, If(TipoAlmacenOrigen = 24, 26, 26)) + Dim TipoMovimientoSalida As Integer = 26 + Dim CveAlmacenEntrada As Integer = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) + + Dim CveConceptoEntrada As Integer = 27 + If Not ChkTransitorio.Checked Then CveConceptoEntrada = 27 Else CveConceptoEntrada = 9 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, @@ -1066,15 +1058,69 @@ Partial Class Inventarios_TraspasoAlmacen Next End If + 'ENTRADA + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenEntrada, CveConceptoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, + Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), + CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3") + FolioEntrada = ObjInventario.Folio + If CveMovimientoEntrada <= 0 Then + TextoError = "Ocurrió un error al generar el movimiento de entrada" + ErrorMovInv = True + Else + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + Dim Cont As Integer = 0 + Dim dttSalida As DataTable = ObjInventario.DtResultados + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal()) + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" + Exit For + End If + Cont += 1 + Next - 'VIRTUAL SALIDA - If RealizarMovimientoVirtual AndAlso CveAlmacenVirtualSalida > 0 Then + Dim Concepto As String = TxtObservaciones.Text + If Concepto = "" Then Concepto = "Traspaso" - 'If TipoAlmacenOrigen = 27 Then - ' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 25).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyectoOrigen}").ToEntero() - 'Else - ' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyectoOrigen}").ToEntero() - 'End If + 'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO: + If Not ErrorMovInv Then + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + Dim importe As Decimal = dttSalida.SUMD("Total").RoundSQL + Dim Contabilizable As Boolean = False + + If TipoAlmacenOrigen = 26 AndAlso TipoAlmacenDestino <> 26 Then Contabilizable = True 'IdCtaContableOrigen = IdCtaContableDestino AndAlso + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then + ErrorMovInv = True + End If + + 'si el tipo de almacen de entrada es Almacen sin costo, se registra al costo, la salida. + If TipoAlmacenOrigen <> 26 AndAlso TipoAlmacenDestino = 26 Then + + Dim tCveClasificacion As Integer = DtMovimientos.MAX("CveClasificacion").ToEntero + Dim dr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=tCveClasificacion).FiltroPrimero("") + Dim IdCuentaCostos As Integer = -1 + If dr IsNot Nothing Then IdCuentaCostos = dr("IdCuentaCostos").ToString.ToEntero + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 69, TxtObservaciones.Text, Fecha, IdCuentaCostos, -1, CveClasificacion:=tCveClasificacion, CveSubProyecto:=CveSubProyectoOrigen, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then + ErrorMovInv = True + End If + Contabilizable = False + importe = 0 + End If + + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableDestino, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable, ImporteMX:=importe) Then + ErrorMovInv = True + End If + + End If + End If + End If + + 'VIRTUAL SALIDA/ENTRADA + If RealizarMovimientoVirtual AndAlso CveAlmacenVirtualSalida > 0 AndAlso Not ErrorMovInv Then Dim dtvirtual As DataTable = Nothing @@ -1085,157 +1131,72 @@ Partial Class Inventarios_TraspasoAlmacen If dtvirtual.Rows.Count > 0 Then CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V", CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenVirtualEntrada) FolioVirtualSalida = ObjInventario.Folio + Dim Contabilizable As Boolean = False + Dim Concepto As String = TxtObservaciones.Text - For Each RowVirtual As DataRow In dtvirtual.Rows - Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() - Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString.ToDecimal - Dim PU As Decimal = RowVirtual("Cargo").ToString().ToDecimal() - Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + If CveMovimientoVirtualSalida > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + For Each RowVirtual As DataRow In dtvirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString.ToDecimal + Dim PU As Decimal = RowVirtual("Cargo").ToString().ToDecimal() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + + 'SALIDA VIRTUAL + Dim importevirtual As Decimal = 0 + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S3", CveMovimientoRelacionado:=CveMovimientoEntrada, CveAlmacenDestino:=CveAlmacenVirtualEntrada) + FolioVirtualEntrada = ObjInventario.Folio + If CveMovimientoVirtualEntrada > 0 Then + Dim DtCostosVirtual As DataTable + If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtualSalida, UsuarioActual.CveEmpresa) Then + DtCostosVirtual = ObjInventario.DtResultados + importevirtual = DtCostosVirtual.SUMD("Total").RoundSQL + + For Each RowVirtual As DataRow In DtCostosVirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString.ToDecimal + Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + Else + ErrorMovInv = True + End If + Else + TextoError = "Ocurrió un error al generar el movimiento de salida virtual" ErrorMovInv = True - Exit For End If - Next + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TAVirt", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importevirtual, importevirtual, 68, TxtObservaciones.Text, TxtObservaciones.Text, IdCtaContableOrigen, CveMovimientoAlmacen:=CveMovimientoVirtualSalida, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importevirtual, importevirtual, 68, TxtObservaciones.Text, TxtObservaciones.Text, IdCtaContableDestino, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + Else + TextoError = "Ocurrió un error al generar el movimiento de salida virtual" + ErrorMovInv = True + End If End If Else ErrorMovInv = True End If End If - AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) - - Dim TipoMovimientoEntrada As Integer = 27 - If Not ChkTransitorio.Checked Then TipoMovimientoEntrada = 27 Else TipoMovimientoEntrada = 9 - - CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), - CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3") - FolioEntrada = ObjInventario.Folio - If CveMovimientoEntrada <= 0 Then - TextoError = "Ocurrió un error al generar el movimiento de entrada" - ErrorMovInv = True - Else - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - Dim Cont As Integer = 0 - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal()) - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - Cont += 1 - Next - End If - End If - - 'AGREGAMOS LA ENTRADA - If Not ChkTransitorio.Checked Then 'SI NO ES TRANSITORIO SE HACE LA RECEPCION DE INMEDIATO - If Not ErrorMovInv Then - - 'VIRTUAL ENTRADA - If RealizarMovimientoVirtual AndAlso CveAlmacenVirtualEntrada > 0 Then - - Dim dtvirtual As DataTable = Nothing - - If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - dtvirtual = ObjInventario.DtResultados - If dtvirtual.Rows.Count > 0 Then - ''hay que verificar que se se tengan movimeintos por registrar - CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtualEntrada, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/S3") - FolioVirtualEntrada = ObjInventario.Folio - - - For Each RowVirtual As DataRow In dtvirtual.Rows - Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() - Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() - Dim PU As Decimal = RowVirtual("Cargo").ToString().ToDecimal() - Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - ErrorMovInv = True - Exit For - End If - Next - End If - - Else - ErrorMovInv = True - End If - End If - - Dim Concepto As String = TxtObservaciones.Text - If Concepto = "" Then Concepto = "Traspaso" - 'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO: - If Not ErrorMovInv Then - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - - Dim resultado As DataTable = ObjInventario.DtResultados - Dim importe As Decimal = resultado.SUMD("Total").RoundAD - Dim Contabilizable As Boolean = False - - If TipoAlmacenOrigen = 26 AndAlso TipoAlmacenDestino <> 26 Then Contabilizable = True 'IdCtaContableOrigen = IdCtaContableDestino AndAlso - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then - ErrorMovInv = True - End If - - 'si el tipo de almacen de entrada es Almacen sin costo, se registra al costo, la salida. - If TipoAlmacenOrigen <> 26 AndAlso TipoAlmacenDestino = 26 Then - - Dim tCveClasificacion As Integer = DtMovimientos.MAX("CveClasificacion").ToEntero - Dim dr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=tCveClasificacion).FiltroPrimero("") - Dim IdCuentaCostos As Integer = -1 - If dr IsNot Nothing Then - IdCuentaCostos = dr("IdCuentaCostos").ToString.ToEntero - End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 69, TxtObservaciones.Text, Fecha, IdCuentaCostos, -1, CveClasificacion:=tCveClasificacion, CveSubProyecto:=CveSubProyectoOrigen, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then - ErrorMovInv = True - End If - Contabilizable = False - importe = 0 - End If - - If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableDestino, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable, ImporteMX:=importe) Then - ErrorMovInv = True - End If - End If - End If - End If - Else - If Not ErrorMovInv Then - Dim Concepto As String = TxtObservaciones.Text - If Concepto = "" Then Concepto = "Traspaso" - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen2", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - - Dim resultado As DataTable = ObjInventario.DtResultados - Dim importe As Decimal = resultado.SUMD("Total").RoundAD - Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorio.SelectedValue.ToEntero)).ToEntero - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then - ErrorMovInv = True - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then - ErrorMovInv = True - End If - End If - End If - End If - - - - ''[IPP-1Noviembre2018] SE COMENTA PORQUE NO TIENE NI PIES NI CABEZA. LE FALTA DESARROLLO - ''CONSUMO INTERNO - 'If Not ErrorMovInv Then - ' If (TipoAlmacenOrigen = 14 Or TipoAlmacenDestino = 14) And TipoAlmacenOrigen <> TipoAlmacenDestino Then - ' ConsumoInterno(TipoAlmacenOrigen, TipoAlmacenDestino) - ' End If - 'End If - Dim SerieInsertadaTimbre As String = "" Dim FolioInsertadoTimbre As Integer = -1 Dim CveTimbre As Integer = -1 @@ -1292,18 +1253,9 @@ Partial Class Inventarios_TraspasoAlmacen Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, "") - If ChkTransitorio.Checked AndAlso UsuarioActual.CveEmpresa.Contiene(72, 80) Then RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveMovimiento={0}',800,620);", CveMovimientoSalida)) End If - - 'If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - ' Dim Correo As String = "jorgegonzalez@compuproveedores.com" - ' If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {DdlAlmacenDestino.SelectedValue.ToEntero}").ToEntero = 16 Then - ' MandaCorreo(CveMovimientoSalida, Correo) - ' End If - 'End If - LimpiaMovimiento() Else @@ -1322,97 +1274,97 @@ Partial Class Inventarios_TraspasoAlmacen ObjInventario.Dispose() End Sub - Function ConsumoInterno(TipoAlmacenOrigen As Integer, TipoAlmacenDestino As Integer) As Boolean - Dim Retorno As Boolean = False - Dim ErrorMovInv As Boolean = False - Dim TextoError As String = "" - Dim Fecha As Date = TxtFecha.Text.ToDate + 'Function ConsumoInterno(TipoAlmacenOrigen As Integer, TipoAlmacenDestino As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' Dim ErrorMovInv As Boolean = False + ' Dim TextoError As String = "" + ' Dim Fecha As Date = TxtFecha.Text.ToDate - Dim ObjInventario As New ClsInventarios - Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) - Dim CveMovimiento As Integer = 0 - Dim TipoMovto = If(TipoAlmacenOrigen = 14, -1, 1) - Dim CveConceptoInventario As Integer = 8 + ' Dim ObjInventario As New ClsInventarios + ' Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) + ' Dim CveMovimiento As Integer = 0 + ' Dim TipoMovto = If(TipoAlmacenOrigen = 14, -1, 1) + ' Dim CveConceptoInventario As Integer = 8 - Dim CveAlmacenCI = If(TipoAlmacenOrigen = 14, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) - Dim DtCostos As DataTable = Nothing - Dim ValorInventario As Decimal = 0 + ' Dim CveAlmacenCI = If(TipoAlmacenOrigen = 14, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) + ' Dim DtCostos As DataTable = Nothing + ' Dim ValorInventario As Decimal = 0 - 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN - CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, CveConceptoInventario, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), - GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G4") - Dim FolioMov As Integer = ObjInventario.Folio + ' 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN + ' CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, CveConceptoInventario, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + ' Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), + ' GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G4") + ' Dim FolioMov As Integer = ObjInventario.Folio - If CveMovimiento <= 0 Then - TextoError = "No se pudo generar el movimiento de salida correctamente" - ErrorMovInv = True - Else + ' If CveMovimiento <= 0 Then + ' TextoError = "No se pudo generar el movimiento de salida correctamente" + ' ErrorMovInv = True + ' Else - For Each Dr As DataRow In DtMovimientos.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de salida" - Exit For - End If - Next - End If + ' For Each Dr As DataRow In DtMovimientos.Rows + ' If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate) Then + ' ErrorMovInv = True + ' TextoError = "Ocurrió un error al guardar los movimientos de salida" + ' Exit For + ' End If + ' Next + ' End If - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtCostos = ObjInventario.DtResultados - Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) - Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 + ' If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + ' DtCostos = ObjInventario.DtResultados + ' Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) + ' Dim IdCtaContable As Integer = 0 + ' Dim CveCuenta As Integer = 0 - If tmpCostos.Rows.Count > 0 Then - Dim Concepto As String = $"Consumo Interno: {ObjInventario.Folio} - {TxtObservaciones.Text}" - Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv/ConsumoInterno", 53, DtCostos.SUM("Total") * TipoMovto, DtCostos.SUM("Total") * TipoMovto, 1, TxtFecha.Text.ToDate, $"Consumo Interno: {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + ' If tmpCostos.Rows.Count > 0 Then + ' Dim Concepto As String = $"Consumo Interno: {ObjInventario.Folio} - {TxtObservaciones.Text}" + ' Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv/ConsumoInterno", 53, DtCostos.SUM("Total") * TipoMovto, DtCostos.SUM("Total") * TipoMovto, 1, TxtFecha.Text.ToDate, $"Consumo Interno: {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario * TipoMovto, Concepto, 181, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario * TipoMovto, CveCuenta:=CveCuenta) Then - ErrorMovInv = True - Exit For - End If - Next + ' For Each RowInv As DataRow In tmpCostos.Rows + ' ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal + ' IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + ' CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario * TipoMovto, Concepto, 181, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=ValorInventario * TipoMovto, CveCuenta:=CveCuenta) Then + ' ErrorMovInv = True + ' Exit For + ' End If + ' Next - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacenCI}").ToEntero + ' IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacenCI}").ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DtCostos.SUM("Total").ToDecimal * TipoMovto, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUM("Total").ToDecimal * TipoMovto) Then - ErrorMovInv = True - End If + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DtCostos.SUM("Total").ToDecimal * TipoMovto, Concepto, 68, Concepto, TxtFecha.Text.ToDate, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DtCostos.SUM("Total").ToDecimal * TipoMovto) Then + ' ErrorMovInv = True + ' End If - End If - End If + ' End If + ' End If - If Not ErrorMovInv Then + ' If Not ErrorMovInv Then - ObjInventario.Commit() - Dim Mensaje As StringBuilder = New StringBuilder + ' ObjInventario.Commit() + ' Dim Mensaje As StringBuilder = New StringBuilder - Mensaje.Append("Se realizó el consumo interno.") + ' Mensaje.Append("Se realizó el consumo interno.") - Mensaje.AppendFormat("
    Folio:
    {0}", FolioMov, CveMovimiento) + ' Mensaje.AppendFormat("
    Folio: {0}", FolioMov, CveMovimiento) - Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) - Mensaje.Clear() + ' Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) + ' Mensaje.Clear() - LimpiaMovimiento() + ' LimpiaMovimiento() - Else - ObjInventario.RollBack() - Alert(TextoError, TipoMensaje.MsgError) - RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") - End If + ' Else + ' ObjInventario.RollBack() + ' Alert(TextoError, TipoMensaje.MsgError) + ' RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") + ' End If - Return Retorno + ' Return Retorno - End Function + 'End Function #End Region @@ -2141,7 +2093,6 @@ Partial Class Inventarios_TraspasoAlmacen CveMovimientoSalidaTransitorio = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/G11") - If CveMovimientoSalidaTransitorio <= 0 Then TextoError = "No se pudo generar el movimiento de salida correctamente" ErrorMovInv = True @@ -2203,6 +2154,7 @@ Partial Class Inventarios_TraspasoAlmacen End If Cont += 1 Next + If Not ErrorMovInv Then Dim Concepto As String = TxtObservacionesRecepcion.Text If Concepto = "" Then Concepto = "Recepción Traspaso" @@ -2213,14 +2165,11 @@ Partial Class Inventarios_TraspasoAlmacen Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero Dim tCveConcepto As Integer = 68 - 'If CveMovimientoSalidaTransitorio = 0 Then - ' tCveConcepto = 289 - 'End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, tCveConcepto, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalidaTransitorio, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If End If @@ -2229,9 +2178,9 @@ Partial Class Inventarios_TraspasoAlmacen 'VIRTUAL ENTRADA - Dim CveMovimientoVirtualEntrada As Integer = 0 - Dim FolioVirtualEntrada As Integer = 0 - If RealizarMovimientoVirtual Then + Dim CveMovimientoVirtualEntrada, CveMovimientoVirtualSalida As Integer + Dim FolioVirtualEntrada, FolioVirtualSalida As Integer + If RealizarMovimientoVirtual AndAlso Not ErrorMovInv Then Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenEntrada).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero() @@ -2239,18 +2188,19 @@ Partial Class Inventarios_TraspasoAlmacen Dim dtvirtual As DataTable = Nothing - If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then dtvirtual = ObjInventario.DtResultados If dtvirtual.Rows.Count > 0 Then - CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/S2") - FolioVirtualEntrada = ObjInventario.Folio + + CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoSalidaTransitorio, Modulo:="TA/S22") + FolioVirtualSalida = ObjInventario.Folio For Each RowVirtual As DataRow In dtvirtual.Rows Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString().ToDecimal() Dim PU As Decimal = RowVirtual("Cargo").ToString().ToDecimal() Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True Exit For End If @@ -2260,17 +2210,31 @@ Partial Class Inventarios_TraspasoAlmacen Dim Concepto As String = TxtObservaciones.Text If Concepto = "" Then Concepto = "Traspaso" Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TA22", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtualEntrada, UsuarioActual.CveEmpresa) Then - + If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtualSalida, UsuarioActual.CveEmpresa) Then Dim resultado As DataTable = ObjInventario.DtResultados - Dim importe As Decimal = resultado.SUMD("Total").RoundAD + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/S23") + FolioVirtualEntrada = ObjInventario.Folio + + For Each RowVirtual As DataRow In resultado.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString().ToDecimal() + Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + + Dim importe As Decimal = resultado.SUMD("Total").RoundSQL Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorio.SelectedValue.ToEntero)).ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, ImporteMX:=importe, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoVirtualSalida, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, ImporteMX:=importe, Contabilizable:=False) Then + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If End If @@ -2288,67 +2252,6 @@ Partial Class Inventarios_TraspasoAlmacen End If End If - ''AGREGAMOS LA ENTRADA - 'If Not ErrorMovInv Then - ' CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 9, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - ' Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida) - ' Folio = ObjInventario.Folio - - ' If CveMovimientoEntrada <= 0 Then - ' TextoError = "No se pudo generar el movimiento de entrada correctamente" - ' ErrorMovInv = True - ' Else - - ' 'COSTO INDIRECTO - ' Dim GastoIndirectoTotal As Double = GvDatosRecepcion.Rows(0).DataKey("GastoIndirectoSalida").ToDouble - ' Dim Importe As Double = GvDatosRecepcion.Rows(0).DataKey("Importe").ToDouble - - ' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - ' Dim CostoIndirecto As Double - ' For Each Dr As DataRow In ObjInventario.DtResultados.Rows - - ' CostoIndirecto = 0 - ' If GastoIndirectoTotal > 0 Then - ' 'PRORRATEAMOS EL GASTO INDIRECTO - ' CostoIndirecto = ((Dr("Total").ToString.ToDouble * GastoIndirectoTotal) / Importe) / Dr("Cantidad").ToString.ToDouble - ' End If - - ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CostoIndirecto:=CostoIndirecto) Then - ' ErrorMovInv = 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 VIEJO - 'If Not ErrorMovInv Then - ' 'Folio = ObjInventario.GetFolioSiguiente(9, UsuarioActual.CveEmpresa) - ' CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 9, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) - - ' If CveMovimientoEntrada <= 0 Then - ' TextoError = "No se pudo generar el movimiento de entrada correctamente" - ' ErrorMovInv = True - ' Else - - ' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - - ' For Each Dr As DataRow In ObjInventario.DtResultados.Rows - ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de salida" - ' Exit For - ' End If - ' Next - - ' End If - - ' End If - 'End If If Not ErrorMovInv Then From 486f75ac0ab8f91735f00b9e16b7684292e2cbb7 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 11 Jul 2022 09:00:10 -0700 Subject: [PATCH 16/16] - --- Contabilidad/RegPrePoliza.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index c03c6c64e..a70561413 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -1188,7 +1188,7 @@ Partial Class ContabilidadC_RegPrePoliza Dim Concepto As String = row.FCTextBox("TxtConcepto").Text Dim CveSubProyecto As Integer = row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() Dim CtaContable As Integer = row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero() - Dim TipoMovto As Boolean = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, False, True) + Dim TipoMovto As Boolean = If(row.FCTextBox("TxtAbono").Text.ToDecimal() <> 0, True, False) Dim TipoMovtoOld As Boolean = (row.DataKey("TipoMovto").ToString = "True") Dim ImporteMN As Decimal = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()) Dim CveTipoGastonew As Integer = If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), row.DataKey("CveTipoGasto").ToEntero())