This commit is contained in:
janeth arvizu
2019-08-19 11:05:58 -07:00
20 changed files with 1156 additions and 1294 deletions

3
.gitignore vendored
View File

@@ -259,7 +259,6 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
*.sln.iml
# CodeRush
.cr/
@@ -267,4 +266,4 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/SIGGIT.sln
/Utilerias

View File

@@ -1618,7 +1618,7 @@ Public Class ClsCompras
#Region "F A C T U R A S "
Public Function GetFacturas(CveFactura As Integer, Folio As String, FechaFacturaI As Date, FechaFacturaF As Date, RFC As String, Proveedor As String, FueValidado As Integer, CveResponsable As Integer, CveProveedorClasificacion As Integer, CveTipoProveedor As Integer, CveEmpresa As Integer) As Boolean
Public Function GetFacturas(CveFactura As Integer, Folio As String, FechaFacturaI As Date, FechaFacturaF As Date, RFC As String, Proveedor As String, FueValidado As Integer, CveResponsable As Integer, CveProveedorClasificacion As Integer, CveTipoProveedor As Integer, TipoComprobante As String, CveEmpresa As Integer) As Boolean
Dim OnError As Boolean = False
'StrSQL.Clear()
@@ -1653,6 +1653,7 @@ Public Class ClsCompras
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveProveedorClasificacion", SqlDbType.Int).Value = CveProveedorClasificacion
.Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
.Add("@TipoComprobante", SqlDbType.VarChar).Value = TipoComprobante
End With
Try

View File

@@ -389,7 +389,17 @@ Public Class ClsPaginas
Property GlobalDTPSATUM() As DataTable
Get
GlobalDTPSATUM = DirectCast(Application("GlobalDTPSATUM"), DataTable)
'System.Data.EnumerableRowCollection
If Not IsNothing(Application("GlobalDTPSATUM")) Then
If Application("GlobalDTPSATUM").GetType().IsSubclassOf(GetType(EnumerableRowCollection)) Then
Return DirectCast(Application("GlobalDTPSATUM"), EnumerableRowCollection(Of DataRow)).CopyToDataTable()
Else
Return DirectCast(Application("GlobalDTPSATUM"), DataTable)
End If
Else
Return Nothing
End If
End Get
Set(value As DataTable)
Application("GlobalDTPSATUM") = value
@@ -3308,9 +3318,6 @@ Public Class ClsPaginas
'Protected Overridable Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
'End Sub
Private Function Obt_ClavePagina(Pagina As String) As Integer
Dim Retorno As Integer
@@ -3320,7 +3327,7 @@ Public Class ClsPaginas
PaginaDict = New System.Collections.Hashtable
PaginaDict.Add("/Inicio.aspx".ToUpper(), -1)
PaginaDict.Add("/Ventas/RepConciliacionEmitidosSat.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1)
@@ -4661,11 +4668,14 @@ Public Class ClsPaginas
Mensaje.Alert(Mensaje, pOpcion, JSBtnAceptar, TimeoutToast:=timeout)
End If
End Sub
Protected Overrides Sub SavePageStateToPersistenceMedium(pviewState As Object)
Protected Overridable Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
If Not IsNothing(ViewState("strToastMsglargonoreplace")) AndAlso ViewState("strToastMsglargonoreplace").ToString.Length > 0 Then
RegistraScript(ViewState("strToastMsglargonoreplace").ToString(), "esteseraunticklargoparaquenosesobrescribaconotro")
ViewState("strToastMsglargonoreplace") = Nothing
End If
End Sub
Protected Overrides Sub SavePageStateToPersistenceMedium(pviewState As Object)
'If Request.Form("__VIEWSTATE_KEY") IsNot Nothing Then Cache.Remove(Request.Form("__VIEWSTATE_KEY")) 'elimino la cachado anteriormente
Dim VSKey As String = String.Format("VIEWSTATE_{0}_{1}_{2}", Session.SessionID, Request.Path, Date.Now.Ticks)
'Cache.Add(VSKey, pviewState, Nothing, Date.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.Default, Nothing) 'Store the ViewState on Cache

View File

@@ -17,6 +17,8 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState
Select Case context.Request("metodo")
Case "getimginstalacion"
GetImgInstalacion(context)
Case "EjecutarNotificaciones"
EjecutarNotificaciones(context)
End Select
ElseIf context.Request.InputStream IsNot Nothing Then
Using reader As New StreamReader(context.Request.InputStream)
@@ -64,6 +66,14 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState
Return URLParametros
End Function
Private Sub EjecutarNotificaciones(ByVal context As HttpContext)
Dim Retorno As String = "[]"
Using ObjGPS As New ClsSisNotificaciones
ObjGPS.ObtenerNotificaciones()
End Using
context.Response.Write(Retorno)
End Sub
Private Sub GetImgInstalacion(ByVal context As HttpContext)
Dim params As String = Decripta(context.Request("r").ToString)
Dim Parametros = Me.Parametros(params)

View File

@@ -310,9 +310,9 @@ Partial Class Bancos_ProveedoresAbonar
ViewState("CveCuentaRetISR") = 0
End If
If UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 126, 119, 122) Then
rowComisiones.Visible = True
End If
'If UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 126, 119, 122,145) Then
' rowComisiones.Visible = True
'End If
IdCuenta = 0
CveCuentaB = 0
@@ -1506,16 +1506,16 @@ Partial Class Bancos_ProveedoresAbonar
'funcionalidad que toma el 100% del pago para acreditamiento de iva
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
importeMX = gvr.DataKey("IVA").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
@@ -1528,79 +1528,16 @@ Partial Class Bancos_ProveedoresAbonar
End If
Else
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago)
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago)
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago)
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
End If
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
Dim IdCtaIVAXAcreditar As Integer = 0
Dim IdCtaIVAAcreditable As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
End If
IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
End If
End If
Case 280 'Iva Acreditado No Deducible
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
'funcionalidad que toma el 100% del pago para acreditamiento de iva
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal
importeMX = gvr.DataKey("IVANoDeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
Else
ImporteMovimiento = 0
importeMX = 0
End If
Else
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago)
ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)

View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Compras_Default : ClsPaginas
{
protected void Page_Load(object sender, EventArgs e)
{
Alert(UsuarioActual.Nombre);
}
}

View File

@@ -1618,7 +1618,7 @@ Partial Class Compras_Compras
Private Function CargaFactura(CveFactura As Integer) As String
Dim ObjeFacturas As New ClsCompras
Dim RFC As String = ""
If ObjeFacturas.GetFacturas(CveFactura, "-1", Now.AddYears(-3), Now, "-1", "-1", -1, -1, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjeFacturas.DtResultados.Rows.Count > 0 Then
If ObjeFacturas.GetFacturas(CveFactura, "-1", Now.AddYears(-3), Now, "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) AndAlso ObjeFacturas.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) ' no toma la cero, porque es el totalizador
Dim XMLDoc As New XmlDocument

Binary file not shown.

View File

@@ -484,7 +484,7 @@ Partial Class Compras_Proveedores
Private Function CargadeFactura(CveFactura As Integer) As Integer
Dim ObjeFacturas As New ClsCompras
If ObjeFacturas.GetFacturas(CveFactura, "-1", Now.AddYears(-2), Now, "-1", "-1", -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
If ObjeFacturas.GetFacturas(CveFactura, "-1", Now.AddYears(-2), Now, "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) Then
Dim XMLDoc As New XmlDocument
Try

View File

@@ -154,6 +154,13 @@
<asp:ListItem Selected="False" Text="Ambos" Value="3"></asp:ListItem>
</asp:DropDownList>
</li>
<li>Tipo Comprobante
<asp:DropDownList ID="DdlTipoComprobante" runat="server" CssClass="form-control select2me input-sm" Width="150px">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Selected="False" Text="Ingresos" Value="I"></asp:ListItem>
<asp:ListItem Selected="False" Text="Egresos" Value="E"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
</div>

View File

@@ -673,7 +673,7 @@ Partial Class Compras_eFacturas
End If
Dim DtPagos As DataTable = Nothing
Dim ObjDatos As New ClsCompras
If ObjDatos.GetFacturas(-1, Folio, FechaI, FechaF, RFC, Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjDatos.GetFacturas(-1, Folio, FechaI, FechaF, RFC, Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, DdlTipoComprobante.SelectedValue.ToString, UsuarioActual.CveEmpresa) Then
If ObjDatos.DtResultados.Rows.Count > 0 Then
GvD.DataSource = ObjDatos.DtResultados.FiltraParametros("TipoComprobante <> 'P'") '.AsEnumerable().Take(100).CopyToDataTable()
DtPagos = ObjDatos.DtResultados.FiltraParametros("TipoComprobante = 'P'")
@@ -1246,7 +1246,7 @@ Partial Class Compras_eFacturas
Dim Folio = If(TxtFolio.Text.Trim.Length > 0, String.Format("%{0}%", TxtFolio.Text.Trim.ToUpper), "-1")
Dim Proveedor = If(TxtProveedor.Text.Trim.Length > 0, String.Format("%{0}%", TxtProveedor.Text.Trim.ToUpper.Replace(" ", "%")), "-1")
If ObjDatos.GetFacturas(-1, Folio, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, "-1", Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjDatos.GetFacturas(-1, Folio, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, "-1", Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, DdlTipoComprobante.SelectedValue.ToString, UsuarioActual.CveEmpresa) Then
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)

View File

@@ -117,6 +117,7 @@
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Folio" ControlStyle-Width="85px" />
<asp:BoundField HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetIVA" DataField="RetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />

View File

@@ -17,12 +17,12 @@ Partial Class SessionesActivas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim listacve As New List(Of String)
listacve.Add("1815")
Notificaciones.AlertaVentana("notificacion", listacve, timeoutseconds:=0)
' Dim listacve As New List(Of String)
' listacve.Add("1815")
' Notificaciones.AlertaVentana("notificacion", listacve, timeoutseconds:=0)
RCveUsuario = "0"
ClsSisNotificaciones.SendNotificacionERP(100, "Titulo", "Hola Mundo", 1)
' RCveUsuario = "0"
'ClsSisNotificaciones.SendNotificacionERP(100, "Titulo", "Hola Mundo", 1)
CargaDatos("")
End If
End Sub

View File

@@ -101,7 +101,8 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="LnkRegistrar" runat="server" data-toggle="tooltip" ToolTip="Registrar" CssClass="btn btn-circle btn-sm blue" OnClick="LnkRegistrar_Click"><i class="fa fa-plus"></i></asp:LinkButton>
<asp:HyperLink runat="server" NavigateUrl='<%# Eval("CveVenta","/Ventas/Ventas.aspx?CveVenta={0}") %>' CssClass="btn btn-circle btn-sm btn-success" Visible='<%# (Eval("CveVenta").ToString() =="" ? false :true) %>' ><i class="fa fa-info"></i>r</asp:HyperLink>
<asp:LinkButton ID="LnkRegistrar" Visible='<%# Eval("CveVenta").ToString() =="" %>' runat="server" data-toggle="tooltip" ToolTip="Registrar" CssClass="btn btn-circle btn-sm blue" OnClick="LnkRegistrar_Click"><i class="fa fa-plus"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View File

@@ -24,6 +24,7 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
DdlSubProyectoDatos.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ");
DdlSubProyectoDatos.DataBind();
DdlClasificacion.DataSource = get_GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion: 1).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby: "Clasificacion");
DdlClasificacion.DataBind();
@@ -50,91 +51,177 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
{
ClsVentas ObjV = new ClsVentas();
ObjV.ConciliacionemitidasSATGet(UsuarioActual.CveEmpresa);
GVConciliacionemitidasSAT.DataSource = ObjV.DtResultados;
GVConciliacionemitidasSAT.DataSource = ObjV.DtResultados.FiltraParametros("", "CveVenta");
ObjV.Dispose();
GVConciliacionemitidasSAT.DataBind();
UpDatosReporte.Update();
}
private void registrarventa(GridViewRow gvrow)
{
{
string ruta = gvrow.DataKey("RutaXml");
strErrores = new StringBuilder();
XmlSatCFDI objxml = null;
Modelos.Factura objfact = null;
bool continuar = true;
objxml = XmlSatCFDI.readXML(ruta);
continuar = continuar && (objxml != null);
if (continuar)
{
objfact = GetFacturaFromXML(objxml);
}
continuar = continuar && (objfact != null);
if (continuar)
{
// Dim As New (ObjVentas.IniciaTransacSQL())
// Dim As = Nothing
// Dim MensajeAlert = New StringBuilder
ClsVentas ObjVentas = new ClsVentas();
ClsInventarios ObjInventario = new ClsInventarios(ObjVentas.IniciaTransacSQL());
ClsContabilidad ObjConta = new ClsContabilidad(ObjVentas.IniciaTransacSQL());
ClsContratos ObjContr = new ClsContratos(ObjVentas.IniciaTransacSQL());
ClsOS ObjOS = new ClsOS(ObjVentas.IniciaTransacSQL());
ClsBancos ObjBancos = new ClsBancos(ObjVentas.IniciaTransacSQL());
ClsClientes ObjClientes = new ClsClientes(ObjVentas.IniciaTransacSQL());
ClsOIEventos ObjEventos = new ClsOIEventos(ObjVentas.IniciaTransacSQL());
ClsCGame ObjCGame = new ClsCGame(ObjVentas.IniciaTransacSQL());
ClsEdocumentacion ObjDocCliente = new ClsEdocumentacion(ObjVentas.IniciaTransacSQL());
ClsAcumuladores ObjAcum = new ClsAcumuladores(ObjVentas.IniciaTransacSQL());
ClsContPAQi ObjContPaq = null;
//StringBuilder MensajeAlert = new StringBuilder() ;
try
{
objfact.GuardarVenta(ref objfact, ref ObjVentas, ref ObjConta, ref ObjInventario, ref ObjContr, ref objfact.DtDetalle, objfact.CveNCaVincular, ref ObjContPaq, ref ObjBancos, ref ObjOS, ref ObjEventos, ref ObjCGame, ref ObjClientes, ObjAcum: ObjAcum);
}
catch (Exception)
{
objfact.CveVenta = -1;
}
if (ObjVentas.UpdateEstatusFactura(3, objxml.complemento.UUID, "", DateTime.ParseExact(objxml.comprobante.Fecha.Replace("T", " "), "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture), ObjVentas.CveVenta, CvePAC: 4))
if (objfact.CveVenta > 0 && objfact.ErrorList.Count == 0)
{
ObjVentas.Commit();
}
else
{
foreach (string item in objfact.ErrorList)
{
strErrores.AppendLine("<br/>");
strErrores.AppendLine(item);
}
objfact.CveVenta = -1;
ObjVentas.RollBack();
}
ObjVentas.Dispose();
ObjConta.Dispose();
ObjInventario.Dispose();
ObjCGame.Dispose();
ObjContr.Dispose();
ObjDocCliente.Dispose();
ObjClientes.Dispose();
ObjAcum.Dispose();
}
if (objfact != null && objfact.CveVenta > 0)
{
CargaConciliacionemitidasSATGet();
Alert($"se ha agregado la factura correctamente.<br/> <a href=\"/Ventas/Ventas.aspx?CveVenta={objfact.CveVenta}\" > Ver Factura </a>", ModExtensiones.TipoMensaje.ToastInformacion, timeout: 25);
}
else { continuar = false; }
if (!continuar)
{
Alert($"no se pudo agregar la factura {strErrores.ToString()}", ModExtensiones.TipoMensaje.MsgAdvertencia);
}
}
}
protected void LnkRegistrar_Click(object sender, EventArgs e)
{
GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
string ruta = gvrow.DataKey("RutaXml");
strErrores = new StringBuilder();
XmlSatCFDI objxml = null;
Modelos.Factura objfact = null;
bool continuar = true;
objxml = XmlSatCFDI.readXML(ruta);
continuar = continuar && (objxml != null);
if (continuar)
{
registrarventa(gvrow);
//string ruta = gvrow.DataKey("RutaXml");
//strErrores = new StringBuilder();
//XmlSatCFDI objxml = null;
//Modelos.Factura objfact = null;
//bool continuar = true;
//objxml = XmlSatCFDI.readXML(ruta);
//continuar = continuar && (objxml != null);
//if (continuar)
//{
objfact = GetFacturaFromXML(objxml);
}
continuar = continuar && (objfact != null);
if (continuar)
{
// objfact = GetFacturaFromXML(objxml);
//}
//continuar = continuar && (objfact != null);
//if (continuar)
//{
// Dim As New (ObjVentas.IniciaTransacSQL())
// Dim As = Nothing
// Dim MensajeAlert = New StringBuilder
ClsVentas ObjVentas = new ClsVentas();
ClsInventarios ObjInventario = new ClsInventarios(ObjVentas.IniciaTransacSQL());
ClsContabilidad ObjConta = new ClsContabilidad(ObjVentas.IniciaTransacSQL());
ClsContratos ObjContr = new ClsContratos(ObjVentas.IniciaTransacSQL());
ClsOS ObjOS = new ClsOS(ObjVentas.IniciaTransacSQL());
ClsBancos ObjBancos = new ClsBancos(ObjVentas.IniciaTransacSQL());
ClsClientes ObjClientes = new ClsClientes(ObjVentas.IniciaTransacSQL());
ClsOIEventos ObjEventos = new ClsOIEventos(ObjVentas.IniciaTransacSQL());
ClsCGame ObjCGame = new ClsCGame(ObjVentas.IniciaTransacSQL());
ClsEdocumentacion ObjDocCliente = new ClsEdocumentacion(ObjVentas.IniciaTransacSQL());
ClsAcumuladores ObjAcum = new ClsAcumuladores(ObjVentas.IniciaTransacSQL());
ClsContPAQi ObjContPaq = null;
//StringBuilder MensajeAlert = new StringBuilder() ;
try
{
objfact.GuardarVenta(ref objfact, ref ObjVentas, ref ObjConta, ref ObjInventario, ref ObjContr, ref objfact.DtDetalle, objfact.CveNCaVincular, ref ObjContPaq, ref ObjBancos, ref ObjOS, ref ObjEventos, ref ObjCGame, ref ObjClientes, ObjAcum: ObjAcum);
// // Dim As New (ObjVentas.IniciaTransacSQL())
// // Dim As = Nothing
// // Dim MensajeAlert = New StringBuilder
// ClsVentas ObjVentas = new ClsVentas();
// ClsInventarios ObjInventario = new ClsInventarios(ObjVentas.IniciaTransacSQL());
// ClsContabilidad ObjConta = new ClsContabilidad(ObjVentas.IniciaTransacSQL());
// ClsContratos ObjContr = new ClsContratos(ObjVentas.IniciaTransacSQL());
// ClsOS ObjOS = new ClsOS(ObjVentas.IniciaTransacSQL());
// ClsBancos ObjBancos = new ClsBancos(ObjVentas.IniciaTransacSQL());
// ClsClientes ObjClientes = new ClsClientes(ObjVentas.IniciaTransacSQL());
// ClsOIEventos ObjEventos = new ClsOIEventos(ObjVentas.IniciaTransacSQL());
// ClsCGame ObjCGame = new ClsCGame(ObjVentas.IniciaTransacSQL());
// ClsEdocumentacion ObjDocCliente = new ClsEdocumentacion(ObjVentas.IniciaTransacSQL());
// ClsAcumuladores ObjAcum = new ClsAcumuladores(ObjVentas.IniciaTransacSQL());
// ClsContPAQi ObjContPaq = null;
// //StringBuilder MensajeAlert = new StringBuilder() ;
// try
// {
// objfact.GuardarVenta(ref objfact, ref ObjVentas, ref ObjConta, ref ObjInventario, ref ObjContr, ref objfact.DtDetalle, objfact.CveNCaVincular, ref ObjContPaq, ref ObjBancos, ref ObjOS, ref ObjEventos, ref ObjCGame, ref ObjClientes, ObjAcum: ObjAcum);
}
catch (Exception )
{
objfact.CveVenta = -1;
}
if (ObjVentas.UpdateEstatusFactura(3, objxml.complemento.UUID, "", DateTime.ParseExact(objxml.comprobante.Fecha.Replace("T", " "), "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture), ObjVentas.CveVenta, CvePAC: 4))
if (objfact.CveVenta > 0 && objfact.ErrorList.Count == 0)
{
ObjVentas.Commit();
}
else
{
foreach (string item in objfact.ErrorList)
{
strErrores.AppendLine("<br/>");
strErrores.AppendLine(item);
}
objfact.CveVenta = -1;
ObjVentas.RollBack();
}
ObjVentas.Dispose();
ObjConta.Dispose();
ObjInventario.Dispose();
ObjCGame.Dispose();
ObjContr.Dispose();
ObjDocCliente.Dispose();
ObjClientes.Dispose();
ObjAcum.Dispose();
// }
// catch (Exception )
// {
// objfact.CveVenta = -1;
// }
// if (ObjVentas.UpdateEstatusFactura(3, objxml.complemento.UUID, "", DateTime.ParseExact(objxml.comprobante.Fecha.Replace("T", " "), "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture), ObjVentas.CveVenta, CvePAC: 4))
// if (objfact.CveVenta > 0 && objfact.ErrorList.Count == 0)
// {
// ObjVentas.Commit();
// }
// else
// {
// foreach (string item in objfact.ErrorList)
// {
// strErrores.AppendLine("<br/>");
// strErrores.AppendLine(item);
// }
// objfact.CveVenta = -1;
// ObjVentas.RollBack();
// }
// ObjVentas.Dispose();
// ObjConta.Dispose();
// ObjInventario.Dispose();
// ObjCGame.Dispose();
// ObjContr.Dispose();
// ObjDocCliente.Dispose();
// ObjClientes.Dispose();
// ObjAcum.Dispose();
}
if (objfact != null && objfact.CveVenta > 0)
{
CargaConciliacionemitidasSATGet();
Alert($"se ha agregado la factura correctamente.<br/> <a href=\"/Ventas/Ventas.aspx?CveVenta={objfact.CveVenta}\" > Ver Factura </a>", ModExtensiones.TipoMensaje.MsgInformacion);
}
else { continuar = false; }
if (!continuar)
{
Alert($"no se pudo agregar la factura {strErrores.ToString()}", ModExtensiones.TipoMensaje.MsgAdvertencia);
}
//}
//if (objfact != null && objfact.CveVenta > 0)
//{
// CargaConciliacionemitidasSATGet();
// Alert($"se ha agregado la factura correctamente.<br/> <a href=\"/Ventas/Ventas.aspx?CveVenta={objfact.CveVenta}\" > Ver Factura </a>", ModExtensiones.TipoMensaje.ToastInformacion,timeout:25);
//}
//else { continuar = false; }
//if (!continuar)
//{
// Alert($"no se pudo agregar la factura {strErrores.ToString()}", ModExtensiones.TipoMensaje.MsgAdvertencia);
//}
}
protected Modelos.Factura GetFacturaFromXML(XmlSatCFDI objxml)
@@ -388,11 +475,17 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
Row["CveTipoPS"] = DrPS["CveTipoPS"];
Row["CveTipoInvPS"] = DrPS["Inv_CveMetodoInventario"];
Row["CveTamaño"] = DrPS["CveTamaño"];
ADSistemaLibrary.SatXml.CFDIConceptoImpuesto impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "002" && x.Impuesto == "Traslado");
ADSistemaLibrary.SatXml.CFDIConceptoImpuesto impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "002" && x.Tipo == "Traslado");
decimal sumaimpuesto=0;
decimal PorcentajeIVA = 0;
if (impuesto != null)
{
Row["PorcentajeIVA"] = impuesto.TasaOCuota;
Row["ImporteIVA"] = impuesto.Importe;
decimal decimpuesto = 0;
decimal.TryParse(impuesto.TasaOCuota, out decimpuesto);
PorcentajeIVA = decimpuesto/100;
Row["PorcentajeIVA"] = decimpuesto / 100;
Row["ImporteIVA"] = decimpuesto / 100;// impuesto.Importe;//Math.Round(item.Importe * (decimpuesto/100), 2);
sumaimpuesto += impuesto.Importe;
}
else
{
@@ -400,12 +493,15 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
Row["ImporteIVA"] = 0;
}
Row["IVA"] = Row["PorcentajeIVA"];
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "003" && x.Impuesto == "Traslado");
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "003" && x.Tipo == "Traslado");
if (impuesto != null)
{
Row["PorcentajeIEPS"] = impuesto.TasaOCuota;
decimal decimpuesto = 0;
decimal.TryParse(impuesto.TasaOCuota, out decimpuesto);
Row["PorcentajeIEPS"] = decimpuesto / 100;
Row["ImporteIEPS"] = impuesto.Importe;
Row["IEPS"] = impuesto.Importe;
sumaimpuesto += impuesto.Importe;
}
else
{
@@ -413,22 +509,28 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
Row["ImporteIEPS"] = 0;
Row["IEPS"] = 0;
}
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "001" && x.Impuesto == "Retencion");
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "001" && x.Tipo == "Retencion");
if (impuesto != null)
{
decimal decimpuesto = 0;
decimal.TryParse(impuesto.TasaOCuota, out decimpuesto);
Row["PorcentajeRetISR"] = decimpuesto / 100;
Row["ImporteRetISR"] = impuesto.Importe;
Row["PorcentajeRetISR"] = impuesto.TasaOCuota;
sumaimpuesto -= impuesto.Importe;
}
else
{
Row["ImporteRetISR"] = 0;
Row["PorcentajeRetISR"] = 0;
}
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "002" && x.Impuesto == "Retencion");
impuesto = item.Impuestos.FirstOrDefault(x => x.Impuesto == "002" && x.Tipo == "Retencion");
if (impuesto != null)
{
decimal decimpuesto = 0;
decimal.TryParse(impuesto.TasaOCuota, out decimpuesto);
Row["PorcentajeRetIVA"] = decimpuesto / 100;
Row["ImporteRetIVA"] = impuesto.Importe;
Row["PorcentajeRetIVA"] = impuesto.TasaOCuota;
sumaimpuesto -= impuesto.Importe;
}
else
{
@@ -438,7 +540,8 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
Row["Descuento"] = item.Descuento;
Row["TipoDescuento"] = "2";
Row["Total"] = item.Importe;
//Row["Total"] = item.Importe - sumaimpuesto;
Row["Total"] = item.Importe /(1+ PorcentajeIVA);
Row["TotalImporte"] = item.Importe;
Row["SATClaveProdServ"] = item.ClaveProdServ;
@@ -468,6 +571,11 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
protected void LnkAceptarDefault_Click(object sender, EventArgs e)
{
RegistraScript("$('#DModalDefaults').modal('hide');");
//foreach (GridViewRow gvrow in GVConciliacionemitidasSAT.Rows)
//{
// registrarventa(gvrow);
//}
}
}
/*

View File

@@ -41,6 +41,8 @@ Partial Class Ventas_RepVentasUtilidad
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
If EsWS Then
DdlClientes.setEsWebService(True)
DdlClientes.SelectedValue = "-1"
DdlClientes.SelectedText = "Todos"
Else
DdlClientes.setEsWebService(False)
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)

View File

@@ -260,6 +260,16 @@
<asp:Label ID="LbSubTotalDolares" Visible="false" runat="server" Text="SubTotal"></asp:Label>
</td>
</tr>
<tr align="left">
<td><b>Dias Emision:</b>&nbsp;</td>
<td>
<asp:Label ID="LblDiasEmision" runat="server" Text="Dias Emision"></asp:Label>
</td>
<td><b>Dias Vencimiento:</b>&nbsp;</td>
<td>
<asp:Label ID="LblDiasVencimiento" runat="server" Text="Dias Vencimiento"></asp:Label>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -181,6 +181,8 @@ Partial Class Ventas_RepVentasUtilidadDetalle
If ObjVentas.DtResultados.Rows.Count > 0 Then
CveMovimiento = ObjVentas.DtResultados.Rows(1)("CveMovimiento").ToString.ToEntero
LblDiasVencimiento.Text = ObjVentas.DtResultados.Rows(1)("DiasVencimiento").ToString
LblDiasEmision.Text = ObjVentas.DtResultados.Rows(1)("DiasEmision").ToString
LblCostoFecha.Text = "$" + ObjVentas.Costo.ToString("N2")
HLCostoFolio.Text = ObjVentas.FolioCosto
LblFechaSalid.Text = ObjVentas.FechaSalidaCosto.ToDate.ToShortDateString

View File

@@ -44,8 +44,10 @@ Partial Class Ventas_RepVentasUtilidadPadre
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
'Carga Clientes
If UsuarioActual.CveEmpresa = 119 Then
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1" Then
DdlClientesWS.setEsWebService(True)
DdlClientesWS.SelectedValue = "-1"
DdlClientesWS.SelectedText = "Todos"
Else
DdlClientesWS.setEsWebService(False)
DdlClientesWS.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)

View File

@@ -5105,8 +5105,10 @@ Partial Class Ventas
If CveVenta <= 0 Then
CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString.ToEntero
DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString)
DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString)
DdlMetodoPago33_SelectedIndexChanged(DdlMetodoPago33, EventArgs.Empty)
DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString)
DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString)
End If
@@ -5133,8 +5135,10 @@ Partial Class Ventas
If CveVenta <= 0 Then
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
DdlMetodoPago33_SelectedIndexChanged(DdlMetodoPago33, EventArgs.Empty)
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
End If
@@ -6150,6 +6154,10 @@ Partial Class Ventas
End If
End If
If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 AndAlso ddlAlmacen.SelectedValue.ToEntero() <= 0 Then
Alert("Tiene que seleccionar un almacen", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
EmitirImprimirNew()
End Sub
@@ -8981,25 +8989,6 @@ Partial Class Ventas
End If
Next
End If
ElseIf AplicarVentaFacturada Then
'25/11/2017 SE VA A ELIMINAR, DIJO EL IPP
'If Not ObjVentas.UpdateVentaRemision(CveVenta, ObjFactura.CveVenta) Then
' ErrorList.Add("Ocurrió un error al actualizar la remisión")
'End If
'If Not ObjConta.TraspasarSaldosPrePolizas(CveVenta, ObjFactura.CveVenta, -1, ObjFactura.CvePrePoliza, 2) Then
' ErrorList.Add("Ocurrió un error al traspasar los saldos de la remisión")
'End If
''If Not ObjConta.CancelarPrePolizas(-1, CveVenta) Then
'' ErrorList.Add("Ocurrió un error al cancelar los saldos de la remisión")
''End If
'If Not TraspasoAlmacen(ObjInventario, CveVenta, ObjConta, True, 9) Then
' ErrorList.Add("Ocurrió un error al traspasar el almacen")
'End If
End If
End If
@@ -10251,147 +10240,152 @@ Partial Class Ventas
End Function
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
Dim OcurrioError As Boolean = False
Try
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
If RemisionesLista.Count > 0 Then
For Each CveRemision As Integer In RemisionesLista
'El almacen general es el Primer Almacen de Material en la Sucursal
If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then
OcurrioError = True
Exit For
End If
Next
End If
Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1)
If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
If CveMovimientoInventario <= 0 Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
Dim Mensaje As String = ""
Dim i As Integer = 0
Dim Cantidad As Double
Dim CveUnidad As Integer
Dim CveProducto As Integer
Dim Existencia As Double
'Dim Pu As Double
'DtInv.Clone()
Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1)
Dim DtEquivalencias As DataTable
If CveMovimientoInventario <= 0 Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
Dim Mensaje As String = ""
Dim i As Integer = 0
Dim Cantidad As Double
Dim CveUnidad As Integer
Dim CveProducto As Integer
Dim Existencia As Double
'Dim Pu As Double
'DtInv.Clone()
For Each Dr As DataRow In DtInv.Rows
If GvInv.Rows(i).FCCheckBox("cbInv").Checked Then
Dim DtEquivalencias As DataTable
CveProducto = Dr("CvePS").ToString.ToEntero
CveUnidad = Dr("CveUM").ToString.ToEntero
Cantidad = Dr("Cantidad").ToString.ToDouble
For Each Dr As DataRow In DtInv.Rows
If GvInv.Rows(i).FCCheckBox("cbInv").Checked Then
If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("SerieLote").ToString = "" Then
OcurrioError = True
ErrorList.Add("Se deben especificar las Series de los productos de almacén")
Exit For
End If
CveProducto = Dr("CvePS").ToString.ToEntero
CveUnidad = Dr("CveUM").ToString.ToEntero
Cantidad = Dr("Cantidad").ToString.ToDouble
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") Then
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
If Existencia < Cantidad Then
If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("SerieLote").ToString = "" Then
OcurrioError = True
ErrorList.Add($"No cuenta con la cantidad suficiente en inventario del producto {Dr("CodigoPS")} .Cuenta con {Existencia.FormatoNumero(2)}.")
ErrorList.Add("Se deben especificar las Series de los productos de almacén")
Exit For
End If
End If
If UsuarioActual.CveEmpresa = 1 Then
DtEquivalencias = New DataTable
DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1)
Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero
Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'")
'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE)
If CveUnidadBase <> CveUnidad Then
' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA
Cantidad = Dr("Cantidad").ToString.ToDouble * drUMBase("Cantidad").ToString.ToDouble / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDouble
CveUnidad = CveUnidadBase
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") Then
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
If Existencia < Cantidad Then
OcurrioError = True
ErrorList.Add($"No cuenta con la cantidad suficiente en inventario del producto {Dr("CodigoPS")} .Cuenta con {Existencia.FormatoNumero(2)}.")
Exit For
End If
End If
End If
If CveProducto > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
If UsuarioActual.CveEmpresa = 1 Then
DtEquivalencias = New DataTable
DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1)
Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero
Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'")
'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE)
If CveUnidadBase <> CveUnidad Then
' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA
Cantidad = Dr("Cantidad").ToString.ToDouble * drUMBase("Cantidad").ToString.ToDouble / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDouble
CveUnidad = CveUnidadBase
End If
End If
If CveProducto > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
End If
Else
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
End If
Else
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
End If
i = i + 1
Next
End If
i = i + 1
Next
'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN
If Not OcurrioError Then
Dim DtCostos As DataTable = Nothing
Dim ValorInventario As Decimal = 0
Dim TotalCosto As Decimal = 0
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
TotalCosto = DtCostos.SUMD("Total").RoundSQL
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim CveCuenta As Integer = 0
If tmpCostos.Rows.Count > 0 Then
Dim TotalCostoAcumulado As Decimal = 0
Dim cont As Integer = 1
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL
TotalCostoAcumulado += ValorInventario
'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN
If Not OcurrioError Then
Dim DtCostos As DataTable = Nothing
Dim ValorInventario As Decimal = 0
Dim TotalCosto As Decimal = 0
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
TotalCosto = DtCostos.SUMD("Total").RoundSQL
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim CveCuenta As Integer = 0
If tmpCostos.Rows.Count > 0 Then
Dim TotalCostoAcumulado As Decimal = 0
Dim cont As Integer = 1
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL
TotalCostoAcumulado += ValorInventario
'cuando es el último movimiento y hay diferencias en los importes
If cont = tmpCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
End If
'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString, Row2("SubProyecto").ToString)
IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
If ValorInventario <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
OcurrioError = True
'cuando es el último movimiento y hay diferencias en los importes
If cont = tmpCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
End If
End If
cont += 1
Next
End If
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero
If TotalCosto <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, True, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then
OcurrioError = True
'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString, Row2("SubProyecto").ToString)
IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
If ValorInventario <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
OcurrioError = True
End If
End If
cont += 1
Next
End If
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero
If TotalCosto <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, True, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then
OcurrioError = True
End If
End If
factura.Inv_CveMovimiento = CveMovimientoInventario
factura.Inv_ValorInventario = ValorInventario
End If
factura.Inv_CveMovimiento = CveMovimientoInventario
factura.Inv_ValorInventario = ValorInventario
End If
End If
End If
End If
End If
If RemisionesLista.Count > 0 Then
For Each CveRemision As Integer In RemisionesLista
'El almacen general es el Primer Almacen de Material en la Sucursal
If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then
OcurrioError = True
Exit For
End If
Next
End If
End If
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al guardar el inventario", ex)
End Try
Return OcurrioError
End Function
@@ -12498,221 +12492,7 @@ Partial Class Ventas
Return Not ErrorCancelar
End Function
'Protected Sub ImgGuardaEstatus_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgGuardaEstatus.Click
' 'La validacion de saldos cuando es refacturacion se hace antes asi que si es refacturacion ignoramos esta condicion, si es Anticipo verifica que no esté aplicado
' If DdlTipoComprobante.SelectedValue = "Ant" AndAlso (HdnPagado.Value.ToDecimal > 0 Or GvAntNC.Rows.Count > 0) Then
' Alert("La factura no se puede cancelar debido a que tiene pagos vinculados.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' 'La validacion de saldos cuando es refacturacion se hace antes asi que si es refacturacion ignoramos esta condicion
' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso HdnPagado.Value.ToDecimal > 0 Then
' Alert("La factura no se puede cancelar debido a que tiene pagos vinculados.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' ' si tiene movimientos en almacen, y sigue sin ser marcado como devuelto
' If (GvInv.Rows.Count > 0 AndAlso DevolucionAlmacen.Contiene(0, 1)) AndAlso DdlTipoComprobante.SelectedValue <> "Rem" Then
' Alert("La factura no se puede cancelar debido a que tiene movimientos de inventario.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' 'Si la remision esta facturada no se puede cancelar
' If DdlTipoComprobante.SelectedValue = "Rem" Then
' Dim ObjV As New ClsVentas
' If ObjV.VerificarRemisionFacturada(CveVenta) Then
' If ObjV.DtResultados.Rows.Count > 0 Then
' Alert("La remisión no se puede cancelar debido a que ya esta vinculada a una factura.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' End If
' ObjV.Dispose()
' End If
' Dim ObjVentas As New ClsVentas() : ObjVentas.IniciaTransacSQL()
' Dim ObjAC As ClsContPAQi = Nothing
' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
' Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
' Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
' Dim ObjContratos As New ClsContratos(ObjVentas.IniciaTransacSQL())
' Dim IDPoliza As Integer = -1
' Dim CvePrePoliza As Integer
' Dim CvePlantillaPoliza As Integer
' Dim ErrorCancelar As Boolean = False
' Dim Mensaje As String = ""
' CreaObjetosVenta()
' If UsuarioActual.Empresa.UsaAC Then
' ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
' End If
' If GvInv.Rows.Count > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
' If CveAlmacenTransitorio > 0 Then
' ErrorCancelar = Not TraspasoAlmacen(ObjInventario, CveVenta, ObjConta, False, 9)
' Else
' ErrorCancelar = Not SalidaEntradaAlmacen(ObjInventario, CveVenta, ObjConta)
' End If
' End If
' If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
' CvePlantillaPoliza = 7
' ElseIf ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant") Then
' CvePlantillaPoliza = 4
' Else
' CvePlantillaPoliza = 4
' End If
' ObjFactura.CveVenta = CveVenta
' If HplSaldoAuxiliar.Text.ToDecimal > 0 Then
' CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero, Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
' ObjFactura.CvePrePoliza = CvePrePoliza
' If Not ErrorCancelar Then
' ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
' End If
' If Not ErrorCancelar Then
' ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFactura, -1)
' Else
' Exit Sub
' End If
' End If
' 'Desvincular Remisiones
' '[IPP] COMENTADO PORQUE UNA REMISION USADA SE QUEMA - DETALLES CON INV - 30/ENERO/2018
' 'If DdlTipoComprobante.SelectedValue = "Ing" Then
' ' If Not ObjVentas.LiberarRemisionesFacturadas(CveVenta) Then
' ' ErrorCancelar = True
' ' Mensaje = "Ocurrió un error al desvincular las remisiones"
' ' End If
' 'End If
' 'Contratos
' ErrorList = New List(Of String)
' If ObjFactura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
' GuardarContratoAvanceEstimaciones(ObjContratos, ObjFactura, ErrorList, -1, True)
' If ErrorList.Count > 0 Then : ErrorCancelar = True : End If
' ElseIf ObjFactura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then
' GuardarContratoAvanceEstimaciones(ObjContratos, ObjFactura, ErrorList, 1, True)
' If ErrorList.Count > 0 Then : ErrorCancelar = True : End If
' End If
' If DdlEstatus.SelectedValue = "4" Then
' If ObjVentas.UpdateEstatusFactura(DdlEstatus.SelectedValue.ToEntero, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
' Mensaje = "El nuevo estatus se guardó correctamente"
' Else
' ErrorCancelar = True
' End If
' 'Si se está mandando a Cancelada SAT
' ElseIf DdlEstatus.SelectedValue = "5" Then
' Try
' Dim DT As DataTable = Nothing
' If FolioFiscal = "" Then
' Dim XmlDoc As New XmlDocument
' XmlDoc.Load(Ruta & "XML\" & DdlTipoComprobante.SelectedValue & "\" & VentaFolio & ".xml")
' ViewState("FolioFiscal") = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
' End If
' 'Si es cancelar en el SAT:
' 'Dim xmlDoc As New System.Xml.XmlDocument()
' 'xmlDoc.LoadXml(Encoding.UTF8.GetString(Convert.FromBase64String("PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8QWN1c2UgRmVjaGE9IjIwMTYtMTItMzBUMTg6Mjk6MjAuNTExOTg1NSIgUmZjRW1pc29yPSJNT1FKODUxMjE0SEs0IiB4bWxuczpuczI9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyMiIHhtbG5zOm5zMz0iaHR0cDovL2NhbmNlbGFjZmQuc2F0LmdvYi5teCI+CiAgICA8bnMzOkZvbGlvcz4KICAgICAgICA8bnMzOlVVSUQ+NjNBOEQxN0UtRDMxQi00QjVFLTkzMEEtMzdDNDJDRTFBM0M4PC9uczM6VVVJRD4KICAgICAgICA8bnMzOkVzdGF0dXNVVUlEPjIwMTwvbnMzOkVzdGF0dXNVVUlEPgogICAgPC9uczM6Rm9saW9zPgogICAgPG5zMjpTaWduYXR1cmUgSWQ9IlNlbGxvU0FUIj4KICAgICAgICA8bnMyOlNpZ25lZEluZm8+CiAgICAgICAgICAgIDxuczI6Q2Fub25pY2FsaXphdGlvbk1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnL1RSLzIwMDEvUkVDLXhtbC1jMTRuLTIwMDEwMzE1Ii8+CiAgICAgICAgICAgIDxuczI6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8wNC94bWxkc2lnLW1vcmUjaG1hYy1zaGE1MTIiLz4KICAgICAgICAgICAgPG5zMjpSZWZlcmVuY2UgVVJJPSIiPgogICAgICAgICAgICAgICAgPG5zMjpUcmFuc2Zvcm1zPgogICAgICAgICAgICAgICAgICAgIDxuczI6VHJhbnNmb3JtIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMTk5OS9SRUMteHBhdGgtMTk5OTExMTYiPgogICAgICAgICAgICAgICAgICAgICAgICA8bnMyOlhQYXRoPm5vdChhbmNlc3Rvci1vci1zZWxmOjoqW2xvY2FsLW5hbWUoKT0nU2lnbmF0dXJlJ10pPC9uczI6WFBhdGg+CiAgICAgICAgICAgICAgICAgICAgPC9uczI6VHJhbnNmb3JtPgogICAgICAgICAgICAgICAgPC9uczI6VHJhbnNmb3Jtcz4KICAgICAgICAgICAgICAgIDxuczI6RGlnZXN0TWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8wNC94bWxlbmMjc2hhNTEyIi8+CiAgICAgICAgICAgICAgICA8bnMyOkRpZ2VzdFZhbHVlPk8zNzJtbWlEMFZWWUdkcGE4WjJ5K3VPQXVVcTdZb3JURldicER3K2xnVG9CUng3c2RrREtlNDZKRjRaM01hZHZ2djh6bG9vZTYwRGtZUGZyRGNZMUZ3PT08L25zMjpEaWdlc3RWYWx1ZT4KICAgICAgICAgICAgPC9uczI6UmVmZXJlbmNlPgogICAgICAgIDwvbnMyOlNpZ25lZEluZm8+CiAgICAgICAgPG5zMjpTaWduYXR1cmVWYWx1ZT5IbEJVbHplZlZFKzFXNS9QKzRuVk9YbEFuOVZLQUladm0vK2tuSldSb2plTVI4Ung5bHBpTUdIOXBVZG5iVWtObTloOTZQSXQ4QzBFd0Z2UVptRjlCZz09PC9uczI6U2lnbmF0dXJlVmFsdWU+CiAgICAgICAgPG5zMjpLZXlJbmZvPgogICAgICAgICAgICA8bnMyOktleU5hbWU+MDAwMDEwODg4ODg4MDAwMDAwMTY8L25zMjpLZXlOYW1lPgogICAgICAgICAgICA8bnMyOktleVZhbHVlPgogICAgICAgICAgICAgICAgPG5zMjpSU0FLZXlWYWx1ZT4KICAgICAgICAgICAgICAgICAgICA8bnMyOk1vZHVsdXM+eG5MMnpEUHRINWpEc0FaRFRJZk1xYktHcnZlK0F0OEt5eDJFWnZiZlhicEs5dVZFeFdTODc0b01lbEZ6TnE2OS9ZcVNSZVQzSTdJOHdyK2pveTVPN291WkgrNEtXZElHcDRTaTZsSGUwa250eHpObXV1S3lPUGtKOXRNY250bkZtUTRiZnhGeGxnL1VkMmhDdHVveTNqMnhZa0lYdTVPNHBHTTk4Tno4cEFNPTwvbnMyOk1vZHVsdXM+CiAgICAgICAgICAgICAgICAgICAgPG5zMjpFeHBvbmVudD5BUUFCPC9uczI6RXhwb25lbnQ+CiAgICAgICAgICAgICAgICA8L25zMjpSU0FLZXlWYWx1ZT4KICAgICAgICAgICAgPC9uczI6S2V5VmFsdWU+CiAgICAgICAgPC9uczI6S2V5SW5mbz4KICAgIDwvbnMyOlNpZ25hdHVyZT4KPC9BY3VzZT4K")))
' Dim ObjCancelacion As New Timbrado
' Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
' Dim RFCReceptor As String = LblRFC.Text.Trim
' Dim CvePACCancelacion As Integer = UsuarioActual.Empresa.CvePAC
' ImprimeCancelacion(CveVenta)
' If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then
' 'Generamos el acuse y mandamos mail de con el acuse de cancelación - DF 13/01/2017
' ' ImprimeCancelacion(CveVenta)
' If UsuarioActual.Empresa.UsaAC Then
' IDPoliza = GenerarPolizaAC(ObjAC, True)
' If IDPoliza <= 0 Then
' Mensaje = "No se pudo generar la poliza"
' ErrorCancelar = True
' End If
' End If
' If Not ErrorCancelar Then
' If ObjVentas.UpdateEstatusFactura(DdlEstatus.SelectedValue.ToEntero, FolioFiscal, ObjCancelacion.CancelacionAcuse, ObjCancelacion.CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion) Then
' Mensaje = "El nuevo estatus se guardó correctamente"
' Else
' ErrorCancelar = True
' End If
' End If
' End If
' Catch ex As Exception
' Mensaje = "Ocurrio un error al Cancelar la factura"
' GuardaLog($"{ex.Message}")
' End Try
' ElseIf DdlEstatus.SelectedValue = "9" Then
' If UsuarioActual.Empresa.UsaAC Then
' IDPoliza = GenerarPolizaAC(ObjAC, True)
' If IDPoliza > 0 Then
' Mensaje = "Se canceló exitosamente el compromiso."
' Else
' Mensaje = "No se pudo generar la poliza de cancelación"
' ErrorCancelar = True
' End If
' End If
' If Not ErrorCancelar Then
' If Not ObjVentas.UpdateEstatusFactura(DdlEstatus.SelectedValue.ToEntero, "", "", TxtFecha.Text.ToDate, CveVenta, IDPoliza) Then
' ErrorCancelar = True
' End If
' End If
' ElseIf DdlEstatus.SelectedValue = "12" Then
' If ObjVentas.UpdateEstatusFactura(DdlEstatus.SelectedValue.ToEntero, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
' Mensaje = "Se canceló exitosamente la Remisión"
' Else
' ErrorCancelar = True
' End If
' Else
' If ObjVentas.UpdateEstatusFactura(DdlEstatus.SelectedValue.ToEntero, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
' 'Alert("El nuevo estatus se guardó correctamente", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & """;")
' Mensaje = "El nuevo estatus se guardó correctamente"
' Else
' ErrorCancelar = True
' End If
' End If
' If Not ErrorCancelar Then
' Alert(Mensaje, TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & """;")
' ObjVentas.Commit()
' If ObjAC IsNot Nothing Then ObjAC.Commit()
' Else
' Alert(Mensaje, TipoMensaje.MsgError)
' ObjVentas.RollBack()
' If ObjAC IsNot Nothing Then ObjAC.RollBack()
' End If
' ObjVentas.Dispose()
' ObjContratos.Dispose()
' ObjConta.Dispose()
' ObjBancos.Dispose()
' ObjInventario.Dispose()
' If ObjAC IsNot Nothing Then ObjAC.Dispose()
'End Sub
Protected Sub ImgBtnAddC_Click(sender As Object, e As ImageClickEventArgs) Handles ImgBtnAddC.Click
Dim Row As DataRow = Nothing
Row = DTmpC.NewRow
@@ -14841,106 +14621,120 @@ Partial Class Ventas
End Sub
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
Dim OcurrioError As Boolean = False
Dim DtMovimientos As DataTable
Dim DtMovimientosDetalles As DataTable
DtRemConceptosSurtidos = Nothing
Try
Dim DtMovimientos As DataTable
Dim DtMovimientosDetalles As DataTable
DtRemConceptosSurtidos = Nothing
'Obtenemos los movimientos detalle
If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then
'Obtenemos los movimientos detalle
If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"})
DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"})
'Si estamos facturando remisiones ajustamos por ventadetalle
If RemisionesLista.Count > 0 Then
Dim resultados = From DtRemisiones In DtRemisionesTmpDT
Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero
Select DtMovDet
Try
DtMovimientosDetalles = resultados.CopyToDataTable
Catch ex As Exception
GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count}")
DtMovimientosDetalles = New DataTable
End Try
Else
DtMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0")
End If
'Si estamos facturando remisiones ajustamos por ventadetalle
If RemisionesLista.Count > 0 Then
Dim resultados = From DtRemisiones In DtRemisionesTmpDT
Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero
Select DtMovDet
Try
DtMovimientosDetalles = resultados.CopyToDataTable
Catch ex As Exception
GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count}")
DtMovimientosDetalles = New DataTable
End Try
Else
DtMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0")
End If
For Each dr As DataRow In DtMovimientos.Rows
If DtMovimientos.Rows.Count > 0 Then
Dim GeneroMovimientoAlmacen As Boolean = False
'Obtenemos los Movimientos de salida
If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then
For Each dr As DataRow In DtMovimientos.Rows
If ObjInventario.DtResultados.Rows.Count > 0 AndAlso DtMovimientosDetalles.Rows.Count > 0 Then
'Obtenemos los Movimientos de salida
If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then
Dim CveAlmacenSalida As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero
Dim CveAlmacenEntrada As Integer = ObjInventario.DtResultados(0)("CveAlmacenRelacionado").ToString.ToEntero
Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero
Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados(0)("CveTipoAlmacen").ToString.ToEntero
If ObjInventario.DtResultados.Rows.Count > 0 AndAlso DtMovimientosDetalles.Rows.Count > 0 Then
Dim RowMovimiento As DataRow = ObjInventario.DtResultados(0)
If (CveAlmacenEntrada > 0 AndAlso CveTipoAlmacen <> 1) Or RemisionesLista.Count = 0 Then 'Con remisiones parciales ignoramos las surtidas ya realizadas
Dim CveAlmacenSalida As Integer = RowMovimiento("CveAlmacen").ToString.ToEntero()
Dim CveAlmacenEntrada As Integer = RowMovimiento("CveAlmacenRelacionado").ToString.ToEntero()
Dim CveMoneda As Integer = RowMovimiento("CveMoneda").ToString.ToEntero()
Dim CveTipoAlmacen As Integer = RowMovimiento("CveTipoAlmacen").ToString.ToEntero()
Dim MovDetalle As New DataTable
If RemisionesLista.Count > 0 Then
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND TieneSalidaxFactura IS NULL"))
Else
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
End If
If (CveAlmacenEntrada > 0 AndAlso CveTipoAlmacen <> 1) Or RemisionesLista.Count = 0 Then 'Con remisiones parciales ignoramos las surtidas ya realizadas
If ErrorList.Count = 0 Then
If MovDetalle.Rows.Count > 0 Then
Dim CveMovimientoSalidaPorTraspaso = -1
Dim MovDetalle As New DataTable
'Le damos salida de apartado por traspaso
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision)
If Not CveMovimientoSalidaPorTraspaso > 0 Then
OcurrioError = True
Exit For
If RemisionesLista.Count > 0 Then
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND TieneSalidaxFactura IS NULL"))
Else
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
End If
'Le damos entrada al general por traspaso
If Not OcurrioError Then
If Not GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso) > 0 Then
If ErrorList.Count = 0 AndAlso MovDetalle.Rows.Count > 0 Then
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
'Le damos salida de apartado por traspaso
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision)
If Not CveMovimientoSalidaPorTraspaso > 0 Then
OcurrioError = True
Exit For
End If
End If
If Not OcurrioError Then
If ConSalida Then
'Le damos salida normal
If Not GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 3, CveMoneda, ObjFactura.CveVenta, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0 Then
'Le damos entrada al general por traspaso
If Not OcurrioError Then
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso) > 0
If Not GeneroMovimientoAlmacen Then
OcurrioError = True
Exit For
End If
End If
'Le damos salida normal
If ConSalida AndAlso Not OcurrioError Then
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 3, CveMoneda, ObjFactura.CveVenta, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
If Not GeneroMovimientoAlmacen Then
OcurrioError = True
Exit For
End If
End If
Else
OcurrioError = True
End If
MovDetalle.Dispose()
End If
Else
OcurrioError = True
End If
MovDetalle.Dispose()
ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then
'Esquema viejo, evitamos que aparezca por surtir
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
OcurrioError = True
Exit For
End If
End If
Next
End If
ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then
'Esquema viejo, evitamos que aparezca por surtir
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
OcurrioError = True
Exit For
End If
OcurrioError = Not GeneroMovimientoAlmacen
End If
Next
End If
Else
OcurrioError = True
End If
End If
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al realizar el traspaso", ex)
End Try
Return Not OcurrioError
End Function
Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable
@@ -15737,7 +15531,6 @@ Partial Class Ventas
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Next
@@ -18836,8 +18629,6 @@ Partial Class Ventas
#End Region
#Region "D E V O L U C I O N D E P E D I D O "
Private Sub CargaFacturaDevolucionPedido()
Dim CveVenta As Integer = Me.CveVenta
@@ -23480,9 +23271,4 @@ Partial Class Ventas
#End Region
End Class