From 78d30107d5e35fcd5405dfa7902abf8af482f541 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 16 Jan 2025 20:48:50 -0700 Subject: [PATCH 01/11] --FIX autorizaciones con ixc --- Ventas/CatAutorizacionLimites.aspx | 13 +++++++-- Ventas/CatAutorizacionLimites.aspx.vb | 10 +++++++ Ventas/Clientes.aspx.vb | 40 +++++++++++++-------------- Ventas/PVCobranza.aspx.vb | 16 ++++------- 4 files changed, 46 insertions(+), 33 deletions(-) diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index 141f85fc6..59ec3b6f7 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -127,26 +127,35 @@ EmptyDataText="No se encontraron autorizaciones" ToolTip="" CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None"> + <%-- 0--%> + <%-- 1--%> + <%-- 2--%> + <%-- 3--%> - <%-- 30--%> + <%-- 4--%> - + + Folio + + + + <%-- 45--%> diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb index 944b72d84..1af186047 100644 --- a/Ventas/CatAutorizacionLimites.aspx.vb +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -62,6 +62,10 @@ Partial Class Ventas_CatAutorizacionLimites DdlEstatus.SelectedValue = "0" + If UsuarioActual.Empresa.Funcionalidad(595) = "3" Then + LnkAgregar.Visible = False + End If + UpModal.Update() End Sub Private Sub CargaDatos() @@ -190,6 +194,12 @@ Partial Class Ventas_CatAutorizacionLimites e.Row.FCLabel("LblTipoAuto").CssClass = "badge badge-secondary" End If + If e.Row.DBCampo("CveIEAplicado").ToString().ToEntero() > 0 Then + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveIEAplicado"), e.Row.DBCampo("FolioIEAplicado")) + Else + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVentaAplicada"), e.Row.DBCampo("FacturaAplicada")) + End If + 'If e.Row.DBCampo("Estatus") = "True" Then ' e.Row.Cells(1).ForeColor = Drawing.Color.Green ' e.Row.Cells(1).Font.Bold = True diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 9bc9f135d..dc24d778c 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -3031,27 +3031,27 @@ Partial Class Clientes End If - If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) AndAlso CType(sender, GridView).ID = "GVAnticipos" Then - If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant") Then - If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then - e.Row.FCLinkButton("LnkAutorizar").Visible = True - e.Row.FCLinkButton("LnkCancelar").Visible = False - Else - e.Row.FCLinkButton("LnkAutorizar").Visible = False - e.Row.FCLinkButton("LnkCancelar").Visible = True - End If - End If + 'If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) AndAlso CType(sender, GridView).ID = "GVAnticipos" Then + ' If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant") Then + ' If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then + ' e.Row.FCLinkButton("LnkAutorizar").Visible = True + ' e.Row.FCLinkButton("LnkCancelar").Visible = False + ' Else + ' e.Row.FCLinkButton("LnkAutorizar").Visible = False + ' e.Row.FCLinkButton("LnkCancelar").Visible = True + ' End If + ' End If - If e.Row.DBCampo("CveIE").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("IxC") Then - If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then - e.Row.FCLinkButton("LnkAutorizar").Visible = True - e.Row.FCLinkButton("LnkCancelar").Visible = False - Else - e.Row.FCLinkButton("LnkAutorizar").Visible = False - e.Row.FCLinkButton("LnkCancelar").Visible = True - End If - End If - End If + ' If e.Row.DBCampo("CveIE").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("IxC") Then + ' If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then + ' e.Row.FCLinkButton("LnkAutorizar").Visible = True + ' e.Row.FCLinkButton("LnkCancelar").Visible = False + ' Else + ' e.Row.FCLinkButton("LnkAutorizar").Visible = False + ' e.Row.FCLinkButton("LnkCancelar").Visible = True + ' End If + ' End If + 'End If End If End Sub diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index b870252cf..bb5a2f124 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -978,12 +978,10 @@ Partial Class Ventas_PVCobranza Dim Actualizo As Boolean = False If Tipo.Contiene("NC", "Ant") Then If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then - Alert("El anticipo se desautorizó correctamente") Actualizo = True End If ElseIf Tipo.Contiene("IxC") Then If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then - Alert("El anticipo se desautorizó correctamente") Actualizo = True End If End If @@ -2130,6 +2128,7 @@ Partial Class Ventas_PVCobranza Dim gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) Dim Folio As String = gvr.DataKey("Folio") Dim Importe As Decimal = gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal + Dim Saldo As Decimal = gvr.DataKey("Saldo").ToDecimal() Dim dtt As DataTable = Nothing Dim ObjProceso As New ClsSisProcesos @@ -2156,22 +2155,17 @@ Partial Class Ventas_PVCobranza Arr.Add(NombreCliente) Arr.Add(Folio) Arr.Add($"$ {Importe}") + EnvioMsg = EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_anticipo", Arr, $"https://grupodiaz.adssistemas.mx.com/Clientes/Clientes.aspx?CveCliente={CveCliente}") - 'EnvioMsg = ModExtensiones.EnviarNotificacionWhatsApp2(NumeroTelefono, "", $"Solicitud de activación de anticipo.\\nFolio: {Folio}.\\nCliente: {NombreCliente}.") - ClsSisNotificaciones.EnviarAlerta("Solicitud de Anticipo", $"Solicitud de activación de anticipo Folio: {Folio}
Ir Activar", dr("CveUsuario").ToString, Tipo:=TipoNotificacion.ToastInformacionB) + Next - If EnvioMsg Then - Alert("Se envió una solicitud de autorización", TipoMensaje.ToastInformacion) - 'Else - ' Alert("No se envió la solicitud de autorización", TipoMensaje.MsgAdvertencia) - End If End If Dim CveVenta As Integer = gvr.DataKey("CveVenta").ToEntero() Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero() Dim ObjVta As New ClsVentas - If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, gvr.DataKey("CveCliente").ToEntero(), CveVendedor, Importe, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, gvr.DataKey("CveCliente").ToEntero(), CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then Dim msgAlert = "La autorización se agregó correctamente." If EnvioMsg Then msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios" @@ -2181,7 +2175,7 @@ Partial Class Ventas_PVCobranza ObjVta.Dispose() - UpAnticipos.Update() + CargaAnticipos(CveVenta) End Sub From ffe21d7034b9a74a6f11409a999ad1966000125b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 16 Jan 2025 20:49:09 -0700 Subject: [PATCH 02/11] --Update acuse de cancelacion en solo cfdi --- Ventas/Ventas.aspx.vb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6d425a0e2..61e7f21b3 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -39949,9 +39949,19 @@ Partial Class Ventas Dim FolioFiscal As String = RowVenta("FolioFiscal").ToString().Trim() Dim Total As Decimal = RowVenta("Total").ToString().ToDecimal() Dim RFCReceptor As String = RowVenta("RFCReceptor").ToString() + Dim CvePACCancelacion As Integer = 5 Dim ObjTimbrado As New Timbrado - Dim resp = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion:=5, ValidaFactura:=False, CveSATMotivoCancelacion:=2) + Dim resp = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion:=CvePACCancelacion, ValidaFactura:=False, CveSATMotivoCancelacion:=2) If resp IsNot Nothing Then + If resp.Verificado Then + Dim CancelacionAcuse = resp.CancelacionAcuse + Using ObjVentas As New ClsVentas + If Not ObjVentas.UpdateCancelaVenta(CveVenta, Now, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, -1, EstadoCancelacion:="", CveEstadoCancelacion:=-1) Then + Alert("Ocurrió un error al guardar el estatus de cancelación") + End If + End Using + + End If Alert(resp.Estado) End If From 1fa6dba94c03a44eaec6a02262ad65645263db6f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 16 Jan 2025 21:26:34 -0700 Subject: [PATCH 03/11] --FIX Num telefono --- Ventas/PVCobranza.aspx.vb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index bb5a2f124..f4e24585b 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -2150,13 +2150,16 @@ Partial Class Ventas_PVCobranza If EsProduccion Then NumeroTelefono = String.Format("52{0}", dr("Celular").ToString()) End If + Dim Arr As New ArrayList Arr.Add(DdlSucursalCorte.SelectedItem.Text) Arr.Add(NombreCliente) Arr.Add(Folio) Arr.Add($"$ {Importe}") - EnvioMsg = EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_anticipo", Arr, $"https://grupodiaz.adssistemas.mx.com/Clientes/Clientes.aspx?CveCliente={CveCliente}") + If NumeroTelefono.Length = 12 Then + EnvioMsg = EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_anticipo", Arr, $"https://grupodiaz.adssistemas.mx.com/Clientes/Clientes.aspx?CveCliente={CveCliente}") + End If Next End If @@ -2170,12 +2173,11 @@ Partial Class Ventas_PVCobranza If EnvioMsg Then msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios" End If - Alert(msgAlert, TipoMensaje.MsgInformacion) + Alert(msgAlert, TipoMensaje.ToastInformacionB) End If ObjVta.Dispose() - - CargaAnticipos(CveVenta) + UpAnticipos.Update() End Sub From 499ed6392933c13f4a2be406157648dc8b21ecdf Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 17 Jan 2025 08:59:01 -0700 Subject: [PATCH 04/11] 1 Conta: Prorrateo gasolina, como admin, pedir a rene que te lo explique --- Compras/Compras.aspx | 129 +++++++++++++++++++++- Compras/Compras.aspx.vb | 239 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 367 insertions(+), 1 deletion(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index a267bb624..962040392 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -128,6 +128,20 @@ + + + <%--2021-04-15 contratos de obra--%> + + + +
  • + + Prorrateo Gasolina + +
  • +
    + +
    @@ -4576,7 +4590,6 @@ -
    @@ -5703,6 +5716,120 @@
    + + + +
    diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index d1582c878..779925009 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1667,6 +1667,12 @@ Partial Class Compras_Compras End If + + If Not CveCompra > 0 Then + LnkProrrateoGasolina.Visible = True + InicializaDTProrrateoGasolina() + End If + End If 'SE OCUPAN AFUERA DEL POSTBACK ?? @@ -22326,6 +22332,239 @@ Partial Class Compras_Compras End Sub + +#Region "PRORRATEO GASOLINA" + + + Property DTProrrateoGasolina As DataTable + Get + If ViewState("DTProrrateoGasolina") Is Nothing Then + ViewState("DTProrrateoGasolina") = New DataTable + End If + Return DirectCast(ViewState("DTProrrateoGasolina"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTProrrateoGasolina") = value + End Set + End Property + + Private Sub InicializaDTProrrateoGasolina() + Dim TmpDTProrrateoGasolina As New DataTable + TmpDTProrrateoGasolina.Columns.Add("CvePS", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("SubProyecto", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("SubTotal", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("IVA", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetIVA", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("RetISR", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("Total", GetType(Decimal)) + TmpDTProrrateoGasolina.Columns.Add("PorcentajeIVA", GetType(Decimal)) + + TmpDTProrrateoGasolina.Columns.Add("CveUM", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDTProrrateoGasolina.Columns.Add("UM", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("Clasificacion", GetType(String)) + TmpDTProrrateoGasolina.Columns.Add("PS", GetType(String)) + + + DTProrrateoGasolina = TmpDTProrrateoGasolina + End Sub + + Protected Sub LnkProrrateoGasolina_Click(sender As Object, e As EventArgs) + + InicializaDTProrrateoGasolina() + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoProrrateoGasolina) + + DdlSubProyectoProrrateoGasolina.Items.Clear() + DdlSubProyectoProrrateoGasolina.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveProyecto:=-1)) + DdlSubProyectoProrrateoGasolina.DataBind() + DdlSubProyectoProrrateoGasolina.Items.Insert(0, New ListItem("Seleccione", "-1")) + + LblTotalProrrateoGasolina.Text = TxtTotal.Text + + CargaProrratePS(-1) + + RegistraScript("$('#DVModalProrrateoGasolina').modal();") + UpModalProrrateoGasolina.Update() + + End Sub + + + Private Sub CargaProrratePS(CveClasificacion As Integer) + + DdlPSProrrateoGasolina.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPSProrrateoGasolina.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue) + DdlPSProrrateoGasolina.SelectedText = "" + DdlPSProrrateoGasolina.SelectedValue = "-1" + Else + DdlPSProrrateoGasolina.ddl.Items.Clear() + + 'DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion) + + If UsuarioActual.TienePermisoProceso(300) Or UsuarioActual.TienePermisoProceso(301) Then + + Dim DTTemp As New DataTable + DTTemp.Columns.Add("CvePS", GetType(Integer)) + DTTemp.Columns.Add("PSCodigo", GetType(String)) + DTTemp.Columns.Add("CveClasificacion", GetType(Integer)) + + For Each dRow As DataRow In GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).Rows + For Each drowCla As DataRow In DTClasificacionesComprobaciones.Rows + + If drowCla("CveClasificacion").ToString.ToEntero = dRow("CveClasificacion").ToString.ToEntero Then + + Dim InRow As DataRow = DTTemp.NewRow + InRow("CvePS") = dRow("CvePS").ToString.ToEntero + InRow("PSCodigo") = dRow("PSCodigo").ToString + InRow("CveClasificacion") = dRow("CveClasificacion").ToString.ToEntero + DTTemp.Rows.Add(InRow) + + End If + Next + Next + DdlPSProrrateoGasolina.DataSource = If(CveClasificacion > 0, DTTemp.FiltraParametros($"CveClasificacion = {CveClasificacion}"), DTTemp) + Else + DdlPSProrrateoGasolina.DataSource = If(CveClasificacion > 0, GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros($"CveClasificacion = {CveClasificacion}"), GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)) + End If + + DdlPSProrrateoGasolina.ddl.DataBind() + DdlPSProrrateoGasolina.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + + End Sub + + Private Sub GvProrrateoGasolinaBind() + GvProrrateoGasolina.DataSource = DTProrrateoGasolina + GvProrrateoGasolina.DataBind() + UpModalProrrateoGasolina.Update() + End Sub + + Protected Sub LnkEliminarProrrateoGasolina_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + DTProrrateoGasolina.Rows.RemoveAt(GvRow.RowIndex) + DTProrrateoGasolina.AcceptChanges() + ProrateoCalculaRestante() + GvProrrateoGasolinaBind() + + End Sub + + + + Protected Sub LnkAgregarProrrateoGasolina_Click(sender As Object, e As EventArgs) + + Dim CvePs As Integer = DdlPSProrrateoGasolina.SelectedValue.ToEntero + + If Not CvePs > 0 Then + Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim PsRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePs).FiltroPrimero("") + + If PsRow Is Nothing Then + Alert("No se encontro el producto", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveUM As Integer = PsRow("CveUM").ToString.ToEntero + Dim UM As String = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("UnidadMedida", $" CveUnidadMedida = {CveUM} ") + + Dim CveClasificacion As Integer = PsRow("CveClasificacion").ToString.ToEntero + Dim Clasificacion As String = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $" CveClasificacion = {CveClasificacion} ") + + + Dim SubTotalOriginal As Decimal = TxtSubTotal.Text.ToDecimal + Dim IVAOriginal As Decimal = TxtIVA.Text.ToDecimal + Dim RetISROriginal As Decimal = TxtRetISR.Text.ToDecimal + Dim RetIVAOriginal As Decimal = TxtRetIVA.Text.ToDecimal + Dim TotalOriginal As Decimal = TxtTotal.Text.ToDecimal + + Dim totalParcialDeseado As Decimal = TxtPrecioProrrateoGasolina.Text.ToDecimal + + Dim PorcentajeCalculado As Decimal = totalParcialDeseado / TotalOriginal + + Dim subtotalParcial As Decimal = SubTotalOriginal * PorcentajeCalculado + Dim ivaParcial As Decimal = IVAOriginal * PorcentajeCalculado + Dim retIsrParcial As Decimal = RetISROriginal * PorcentajeCalculado + Dim retIvaParcial As Decimal = RetIVAOriginal * PorcentajeCalculado + + Dim nRow As DataRow = DTProrrateoGasolina.NewRow + + nRow("CvePS") = DdlPSProrrateoGasolina.SelectedValue.ToEntero + nRow("CveSubProyecto") = DdlSubProyectoProrrateoGasolina.SelectedValue.ToEntero + nRow("SubProyecto") = DdlSubProyectoProrrateoGasolina.SelectedItem.Text + nRow("SubTotal") = subtotalParcial + + If CveFactura > 0 Then + nRow("IVA") = ivaParcial + nRow("RetIVA") = retIvaParcial + nRow("RetISR") = retIsrParcial + Else + nRow("IVA") = (ivaParcial / subtotalParcial) + nRow("RetIVA") = (retIvaParcial / subtotalParcial) + nRow("RetISR") = (retIsrParcial / subtotalParcial) + End If + + nRow("Total") = totalParcialDeseado + nRow("PorcentajeIVA") = (ivaParcial / subtotalParcial) + + nRow("CveUM") = CveUM + nRow("UM") = UM + nRow("CveClasificacion") = CveClasificacion + nRow("Clasificacion") = Clasificacion + nRow("PS") = DdlPSProrrateoGasolina.txtText.Value + + DTProrrateoGasolina.Rows.Add(nRow) + + DdlSubProyectoProrrateoGasolina.SelectedValueExist(-1) + TxtPrecioProrrateoGasolina.Text = "" + ProrateoCalculaRestante() + GvProrrateoGasolinaBind() + + End Sub + + + Private Sub ProrateoCalculaRestante() + LblRestoProrrateoGasolina.Text = (TxtTotal.Text.ToDecimal - DTProrrateoGasolina.SUM("Total")).ToString("###,###,###.00") + End Sub + + + + Protected Sub BtnGuardarProrrateoGasolina_Click(sender As Object, e As EventArgs) + + If DTProrrateoGasolina.Rows.Count > 0 Then + TmpDT.Rows.Clear() + For Each dRow As DataRow In DTProrrateoGasolina.Rows + + AddPS(1, dRow("CveUM").ToString.ToEntero, dRow("UM").ToString, dRow("CveClasificacion").ToString.ToEntero, dRow("Clasificacion").ToString, dRow("CvePS").ToString.ToEntero, dRow("PS").ToString, 1, dRow("CveSubProyecto").ToString, dRow("SubProyecto").ToString, "", + "-1", "", dRow("SubTotal").ToString.ToDecimal, dRow("Total").ToString.ToDecimal, dRow("PorcentajeIVA").ToString.ToDecimal, dRow("RetIVA").ToString.ToDecimal, dRow("RetISR").ToString.ToDecimal, 0, 0, 0, PorcentajeIVA:=dRow("PorcentajeIVA").ToString.ToDecimal) + + + Next + + AddPS2() + End If + + RegistraScript("$('#DVModalProrrateoGasolina').modal('hide');") + + + End Sub + + +#End Region + + + + + + + + + + End Class From 59cc42345915cb153fc6aca832442421ed46766f Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 17 Jan 2025 09:02:40 -0700 Subject: [PATCH 05/11] correcion 1 Conta: Prorrateo gasolina, como admin --- Compras/Compras.aspx.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 779925009..9fe4edcb0 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -22546,9 +22546,11 @@ Partial Class Compras_Compras Next AddPS2() + + RegistraScript("$('#DVModalProrrateoGasolina').modal('hide');") End If - RegistraScript("$('#DVModalProrrateoGasolina').modal('hide');") + End Sub From c7cd0b03a32aa5757e059e8d08f8230ae2bdc5b7 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 17 Jan 2025 21:40:58 -0700 Subject: [PATCH 06/11] --FIX varios --- App_Code/Modelos.vb | 26 +-- App_Code/Timbrado.vb | 7 +- Empresas/189/Formatos/Factura.mrt | 10 +- Ventas/CatAutorizacionLimites.aspx.vb | 8 + Ventas/Clientes.aspx.vb | 4 +- Ventas/PVCobranza.aspx.vb | 283 ++++++++++++++++++++------ 6 files changed, 243 insertions(+), 95 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index f242730dd..1b88ed2c4 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3574,21 +3574,6 @@ Namespace Modelos End If Next - If ObjConta.ValidacionesPrePoliza(ObjFactura.CvePrePoliza, UsuarioActual, Opcion:=5) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - ErrorPrepoliza = True - GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas") - - 'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA - 'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then - ' Dim DtTest = ObjConta.DtResultados - 'End If - End If - - importeMovimiento = 0 - importeMX = 0 - End If - If ErrorPrepoliza Then Exit For End If @@ -3651,15 +3636,12 @@ Namespace Modelos End If End If - If ObjConta.ValidacionesPrePoliza(ObjFactura.CvePrePoliza, UsuarioActual, Opcion:=5) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - ErrorPrepoliza = True - GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas") - End If - End If - End If End If + + importeMovimiento = 0 + importeMX = 0 + End If End If diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index cdfff5558..19b3bbb23 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -352,7 +352,7 @@ Public Class Timbrado Dim UsuarioServicio As String = If(CvePACCancelacion = 2, Empresa.RFC, "rene.molina@adsistemas.mx") Dim ClaveServicio As String = If(CvePACCancelacion = 2, Empresa.RFC.ToLower, "rene2018") Dim Clave As String = Empresa.ContraseñaKey - Dim UrlServicio As String = "https://servicios.gofac.com.mx/cancelacion.asmx" ' Produccion + Dim UrlServicio As String = "https://cfdi.gofac.com.mx/timbrado.asmx" ' Produccion If Not Empresa.FacturaProduccion Then ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key" @@ -360,6 +360,7 @@ Public Class Timbrado UsuarioServicio = "UserTest" ClaveServicio = "1234567890" + UrlServicio = "https://servicios.gofac.com.mx/cancelacion.asmx" ' Produccion End If #Region "Valida" If Not File.Exists(ArchivoCertificado) Then @@ -2877,7 +2878,7 @@ concep.DescripcionesEspecificas.NumeroSerie) Dim TimbraProduccion As Boolean = True If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) - UrlServicio = "https://pruebas.gofac.com.mx/timbrado.asmx?WSDL" + UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL" If Not ClsPaginas.EsProduccion AndAlso (Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then EmisorRFC = "EKU9003173C9" @@ -2897,6 +2898,8 @@ concep.DescripcionesEspecificas.NumeroSerie) UsuarioServicio = "UserTest" ClaveServicio = "1234567890" UsuarioActual.Empresa.CodigoRegimenFiscal = "601" + + UrlServicio = "https://pruebas.gofac.com.mx/timbrado.asmx?WSDL" End If #Region "Valida" diff --git a/Empresas/189/Formatos/Factura.mrt b/Empresas/189/Formatos/Factura.mrt index 1b3733a19..c576c96ae 100644 --- a/Empresas/189/Formatos/Factura.mrt +++ b/Empresas/189/Formatos/Factura.mrt @@ -593,7 +593,7 @@ iigAooooAKKKKAP/2Q== True Transparent True - 0.12,2.4,9.62,2.28 + 0.12,2.4,9.62,2.48 Myriad Pro,9,Regular,Point,False,0 @@ -601,8 +601,8 @@ iigAooooAKKKKAP/2Q== Textbox20 - <div><b>Facturado a:&nbsp;</b></div><div><b>Cliente: </b>{ClienteCodigo} - {ClienteNombre}&nbsp;</div><div><b>RFC:</b> {ClienteRFC} -<b>Colonia: </b> {ClienteColonia}&nbsp;</div><div><b>Ciudad: </b>{ClienteCiudad} <b>Estado: </b> {ClienteEstado}</div><div><b>Municipio y/o Delegación: </b>{ClienteMunicipio}&nbsp;</div><div><b>Pais:</b> {ClientePais} <b> CP: </b>{ClienteCP}</div> + <div><font size="8"><b>Facturado a:&nbsp;</b></font></div><div><font size="8"><b>Cliente: </b>{ClienteCodigo} - {ClienteNombre}&nbsp;</font></div><div><font size="8"><b>RFC:</b> {ClienteRFC} +<b>Colonia: </b> {ClienteColonia}&nbsp;</font></div><div><font size="8"><b>Ciudad: </b>{ClienteCiudad} <b>Estado: </b> {ClienteEstado}</font></div><div><font size="8"><b>Municipio y/o Delegación: </b>{ClienteMunicipio}&nbsp;</font></div><div><font size="8"><b>Pais:</b> {ClientePais} <b> CP: </b>{ClienteCP}</font></div><div><font face="Myriad Pro" style="" size="8"><b>Régimen Fiscal:</b> {ClienteRegimenFiscal}</font></div> Black Wysiwyg Expression @@ -6326,8 +6326,8 @@ FUERO DE MI DOMICILIO. LA CANTIDAD DE $ {Total} SON: {(ImporteLetra)}. Factura 12/30/2024 5:44:19 PM 7/11/2022 2:49:19 PM - C:\inetpub\WWWSigGit\Empresas\189\Formatos\Factura.mrt - e8b162183e2340d1bbaad55d91fb8962 + Factura.mrt + e849bb4463e44732ae40e92228d31a35 Factura Centimeters 2022.4.5.0 diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb index 1af186047..44e55bb52 100644 --- a/Ventas/CatAutorizacionLimites.aspx.vb +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -37,6 +37,14 @@ Partial Class Ventas_CatAutorizacionLimites DdlCliente.setEsWebService(True) DdlClienteFiltro.setEsWebService(True) + If Request("CveCliente") IsNot Nothing AndAlso Request("CveCliente").ToString().ToEntero() > 0 Then + Dim CveCliente As Integer = Request("CveCliente").ToString().ToEntero() + Dim Cliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial") + + DdlClienteFiltro.SelectedValue = CveCliente.ToString() + DdlCliente.SelectedText = Cliente + End If + 'Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) 'If EsWS Then ' DdlCliente.setEsWebService(True) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index dc24d778c..682877531 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -4908,8 +4908,8 @@ Partial Class Clientes If Not TieneError Then If IVA > 0 Then - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -IVA, -IVA, 13, "Traspaso de saldos de anticipos.IVA", "Traspaso de saldos de anticipos.IVA", CveCliente:=Gvr.DataKey("CveCliente").ToEntero(), CveIE:=Gvr.DataKey("CveIE").ToEntero(), PorcentajeImpuesto:=Gvr.DataKey("PorcentajeIVA").ToDecimal, Contabilizable:=False) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, IVA, 13, "Traspaso de saldos de anticipos. IVA", "Traspaso de saldos de anticipos.IVA", CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToEntero(), PorcentajeImpuesto:=Gvr.DataKey("PorcentajeIVA").ToDecimal, Contabilizable:=False) Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -IVA, -IVA, 13, "Traspaso de saldos de anticipos.IVA", "Traspaso de saldos de anticipos.IVA", CveCliente:=Gvr.DataKey("CveCliente").ToEntero(), CveIE:=Gvr.DataKey("CveIE").ToEntero(), PorcentajeImpuesto:=Gvr.DataKey("PorcentajeIVA").ToDecimal, CveVenta:=CveVenta, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, IVA, 13, "Traspaso de saldos de anticipos. IVA", "Traspaso de saldos de anticipos.IVA", CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToEntero(), PorcentajeImpuesto:=Gvr.DataKey("PorcentajeIVA").ToDecimal, CveVenta:=CveVenta, Contabilizable:=False) Then TieneError = True End If Else diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index f4e24585b..4aa31d642 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -853,94 +853,108 @@ Partial Class Ventas_PVCobranza If MsgError = "" Then ObjVentas2.Commit() Dim msBuild As New StringBuilder() - Dim MsgTimbrado As String = "" - Dim DebeTimbrar As Boolean = True + Try - Dim SeTimbro As Boolean = False - Dim SeTimbroNC As Boolean = False + Dim MsgTimbrado As String = "" + + Dim DebeTimbrar As Boolean = True + + Dim SeTimbro As Boolean = False + Dim SeTimbroNC As Boolean = False + + 'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO + If DebeTimbrar AndAlso respFactura IsNot Nothing Then + Try + 'VERIFICA SI SE GENERO NC + If respNC IsNot Nothing Then + AjustarTimbre(respFactura.Factura, respNC.Factura) + MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura, SeTimbro, SeTimbroNC) + Else + AjustarTimbre(respFactura.Factura, Nothing) + MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing, SeTimbro, SeTimbroNC) + End If + + If Not String.IsNullOrEmpty(MsgTimbrado) Then + Dim StrEr As String = $"
    Comprobante no emitido :
    {MsgTimbrado}
    Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.
    " + MsgTimbrado = StrEr + End If + Catch ex As Exception + GuardaLogAD(ex.ToString()) + msBuild.AppendFormat("
    {0}
    ", MsgTimbrado) + End Try - 'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO - If DebeTimbrar AndAlso respFactura IsNot Nothing Then - 'VERIFICA SI SE GENERO NC - If respNC IsNot Nothing Then - AjustarTimbre(respFactura.Factura, respNC.Factura) - MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura, SeTimbro, SeTimbroNC) - Else - AjustarTimbre(respFactura.Factura, Nothing) - MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing, SeTimbro, SeTimbroNC) End If - If Not String.IsNullOrEmpty(MsgTimbrado) Then - Dim StrEr As String = $"
    Comprobante no emitido :
    {MsgTimbrado}
    Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.
    " - MsgTimbrado = StrEr - End If + If respFactura IsNot Nothing Then + If RegistrarPago Then + msBuild.Append("Pago Registrado correctamente.

    ") + End If - End If + msBuild.AppendFormat(" La factura {1} se genero correctamente.
    ", respFactura.CveVenta, respFactura.SerieFolio) - If respFactura IsNot Nothing Then - If RegistrarPago Then - msBuild.Append("Pago Registrado correctamente.

    ") - End If - - msBuild.AppendFormat(" La factura {1} se genero correctamente.
    ", respFactura.CveVenta, respFactura.SerieFolio) - - If SeTimbro Then - Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto))) - msBuild.AppendFormat("{0}", xml) - End If - - Dim pdf = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta))) - msBuild.AppendFormat("{0}", pdf) - - If respFactura.Factura.Inv_CveMovimiento > 0 Then - msBuild.AppendFormat("Movimiento de Almacén
    ", respFactura.Factura.Inv_CveMovimiento) - End If - - If respNC IsNot Nothing Then - msBuild.AppendFormat(" La nota de crédito {1} se genero correctamente.
    ", respNC.CveVenta, respNC.SerieFolio) - If SeTimbroNC Then - Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto))) + If SeTimbro Then + Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto))) msBuild.AppendFormat("{0}", xml) End If - Dim pdfNC = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta))) - msBuild.AppendFormat("{0}", pdfNC) - End If + Dim pdf = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta))) + msBuild.AppendFormat("{0}", pdf) + + If respFactura.Factura.Inv_CveMovimiento > 0 Then + msBuild.AppendFormat("Movimiento de Almacén
    ", respFactura.Factura.Inv_CveMovimiento) + End If + + If respNC IsNot Nothing Then + msBuild.AppendFormat(" La nota de crédito {1} se genero correctamente.
    ", respNC.CveVenta, respNC.SerieFolio) + If SeTimbroNC Then + Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto))) + msBuild.AppendFormat("{0}", xml) + End If + + Dim pdfNC = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta))) + msBuild.AppendFormat("{0}", pdfNC) + End If - If respNC IsNot Nothing Then - If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then - For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows - msBuild.AppendLine($"
    Imprimir Saldo Aplicado {dr("Folio").ToString}
    ") - Next - End If + Next + End If - Else - If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then - For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows - msBuild.AppendLine($"
    Imprimir Saldo Aplicado {dr("Folio").ToString}
    ") - Next + Next + End If End If + + If Not String.IsNullOrEmpty(MsgTimbrado) Then + msBuild.AppendFormat("
    {0}
    ", MsgTimbrado) + End If + + Else + msBuild.Append($"Pago Registrado correctamente.

    Imprimir ticket") End If - If Not String.IsNullOrEmpty(MsgTimbrado) Then - msBuild.AppendFormat("
    {0}
    ", MsgTimbrado) - End If + Catch ex As Exception + GuardaLogAD(ex.ToString()) + msBuild.Append("Ocurrio un error posterior al pago") + End Try - Else - msBuild.Append($"Pago Registrado correctamente.

    Imprimir ticket") - End If Alert(msBuild.ToString(), TipoMensaje.MsgInformacion) Else @@ -958,6 +972,19 @@ Partial Class Ventas_PVCobranza If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then ImpresionDirectaPDF(CveVenta) End If + + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + 'ENVIO DE CORREO + Try + If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing Then + Dim EnviarMail As Boolean = respFactura.Factura.Cliente.EnviarFactura = "Si" + Dim Hilo As New System.Threading.Thread(Sub() EnviarMailFactura(EnviarMail, respFactura.Factura, UsuarioActual)) + Hilo.Start() + End If + Catch ex As Exception + GuardaLogAD(ex.ToString()) + End Try + End If LimpiarDatos() CargaDatos() @@ -2123,9 +2150,11 @@ Partial Class Ventas_PVCobranza End Sub Protected Sub LnkSolicitarActivarAnticipo_Click(sender As Object, e As EventArgs) - Dim CveCliente As Integer = -1 + 'falta sacar a los usuarios a notificar. Dim gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + + Dim CveCliente As Integer = gvr.DataKey("CveCliente").ToEntero() Dim Folio As String = gvr.DataKey("Folio") Dim Importe As Decimal = gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal Dim Saldo As Decimal = gvr.DataKey("Saldo").ToDecimal() @@ -2158,7 +2187,8 @@ Partial Class Ventas_PVCobranza Arr.Add($"$ {Importe}") If NumeroTelefono.Length = 12 Then - EnvioMsg = EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_anticipo", Arr, $"https://grupodiaz.adssistemas.mx.com/Clientes/Clientes.aspx?CveCliente={CveCliente}") + EnvioMsg = EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_anticipo", Arr, $"https://grupodiaz.adssistemas.mx.com/Ventas/CatAutorizacionLimites.aspx?CveCliente={CveCliente}") + ClsSisNotificaciones.EnviarAlerta("Solicitud de Anticipo", $"Solicitud de activación de anticipo Folio: {Folio}
    Ir Activar", dr("CveUsuario").ToString, Tipo:=TipoNotificacion.ToastInformacionB) End If Next @@ -2168,7 +2198,7 @@ Partial Class Ventas_PVCobranza Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero() Dim ObjVta As New ClsVentas - If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, gvr.DataKey("CveCliente").ToEntero(), CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then Dim msgAlert = "La autorización se agregó correctamente." If EnvioMsg Then msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios" @@ -2775,6 +2805,131 @@ Partial Class Ventas_PVCobranza #End Region + Private Sub EnviarMailFactura(EnviaCorreo As Boolean, Factura As Modelos.Factura, UsuarioActual As Usuario) + 'GUARDA PDF + Dim LocalSerieFolio As String = Factura.SerieFolio + Dim LocalTipoDocto As String = Factura.TipoDocto + + Dim ArchivoPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + + 'TIMBRADO NUEVO + Try + If Not File.Exists(ArchivoPDF) Then + GenerarPDFVenta(Factura.CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False) + End If + Catch ex As Exception + GuardaLogAD(ex.ToString()) + End Try + + Dim ErrorCorreo As Boolean = False + + If EnviaCorreo Then + If Factura IsNot Nothing Then + Dim ArchivoXML As String = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + + Try + Dim FIXML As New FileInfo(ArchivoXML) + Dim FIPDF As New FileInfo(ArchivoPDF) + If FIXML.Exists AndAlso FIPDF.Exists Then + MandaMails(UsuarioActual, Factura, Factura.TipoDocto, LocalSerieFolio, EnviaCorreo, ArchivoXML, ArchivoPDF) + Else + ErrorCorreo = True + End If + Catch ex As Exception + ErrorCorreo = True + End Try + Else + ErrorCorreo = True + End If + + If ErrorCorreo Then + Dim ObjVentas As New ClsVentas(UsuarioActual:=UsuarioActual) + If EnviaCorreo Then + ObjVentas.UpdateVentaMail(3, Factura.CveVenta) + Else + ObjVentas.UpdateVentaMail(0, Factura.CveVenta) + End If + ObjVentas.Dispose() + End If + End If + + End Sub + + + Private Sub MandaMails(UsuarioActual As Usuario, ObjFactura As Modelos.Factura, TipoDocto As String, SerieFolio As String, EnviarFactura As Boolean, XML As String, PDF As String) + + Dim ObjMail As New ClsSisMail() + Dim ResultadoMail As Integer = 0 + + Dim CorreoDestino As String = ObjFactura.Cliente.Mail + + Try + + Dim Asunto As String = String.Empty + Dim Cuerpo As String = String.Empty + + Dim TipoComprobante As String = "" + + If TipoDocto = "Ing" Then TipoComprobante = "Factura" + If TipoDocto = "Egs" Then TipoComprobante = "Nota de Crédito" + + If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then + Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta + Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Cuerpo = Cuerpo.Replace("{""NombreCliente""}", ObjFactura.Cliente.NombreComercial) + Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""Fecha""}", ObjFactura.Fecha.ToString("dd/MM/yyyy")) + Cuerpo = Cuerpo.Replace("{""Total""}", ObjFactura.Total.ToString("N2")) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", ObjFactura.FechaVencimiento.ToString("dd/MM/yyyy")) + Cuerpo = Cuerpo.Replace("{""SerieFolio""}", SerieFolio) + Asunto = Asunto.Replace("{""AtencionA""}", ObjFactura.AtencionA) + Asunto = Asunto.Replace("{""Sucursal""}", ObjFactura.SubProyecto.SubProyecto) + Asunto = Asunto.Replace("{""DescripcionVenta""}", ObjFactura.DescripcionVenta) + Asunto = Asunto.Replace("{""FolioFactura""}", ObjFactura.SerieFolio) + End If + + If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then + Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta + Asunto = Asunto.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Asunto = Asunto.Replace("{""NombreCliente""}", ObjFactura.Cliente.NombreComercial) + Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""Fecha""}", ObjFactura.Fecha.ToString("dd/MM/yyyy")) + Cuerpo = Cuerpo.Replace("{""Total""}", ObjFactura.Total.ToString("N2")) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", ObjFactura.FechaVencimiento.ToString("dd/MM/yyyy")) + Asunto = Asunto.Replace("{""SerieFolio""}", SerieFolio) + Asunto = Asunto.Replace("{""AtencionA""}", ObjFactura.AtencionA) + Asunto = Asunto.Replace("{""Sucursal""}", ObjFactura.SubProyecto.SubProyecto) + Asunto = Asunto.Replace("{""DescripcionVenta""}", ObjFactura.DescripcionVenta) + Asunto = Asunto.Replace("{""FolioFactura""}", ObjFactura.SerieFolio) + End If + + If Not EnviarFactura Then + ResultadoMail = 0 + End If + + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) + + Dim DisplayName As String = "" + + If ObjMail.SendMail(UsuarioActual.Empresa, CorreoDestino, Asunto, Cuerpo, "", LSRutasMail, Displayname:=DisplayName) Then + ResultadoMail = 1 + Else + ResultadoMail = 3 + End If + + Catch ex As Exception + OnError("Ocurrió error al mandar el Mail", ex) + ResultadoMail = 3 + Finally + Dim ObjVentas As New ClsVentas(UsuarioActual:=UsuarioActual) + ObjVentas.UpdateVentaMail(ResultadoMail, ObjFactura.CveVenta) + ObjVentas.Dispose() + End Try + + End Sub + End Class Public Class MRespuestaSAT From 0cbefbd71c7742dca4b98e4da33c436564dfe5df Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 17 Jan 2025 11:56:46 -0700 Subject: [PATCH 07/11] 1 Conta: Prorrateo gasolina, como admin, pedir a rene que te lo explique --- Compras/Compras.aspx | 22 +++++++---- Compras/Compras.aspx.vb | 82 ++++++++++++++++++++++++++++------------- 2 files changed, 72 insertions(+), 32 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 962040392..a9ca68b14 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -130,13 +130,13 @@
    - <%--2021-04-15 contratos de obra--%> +
  • - - Prorrateo Gasolina + + Prorrateo
  • @@ -5723,7 +5723,15 @@