diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb
index 2422f98ee..2fa90b6e1 100644
--- a/App_Code/ClsClientes.vb
+++ b/App_Code/ClsClientes.vb
@@ -1676,7 +1676,8 @@ Public Class ClsClientes
End Function
Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, CveEstado As Integer,
RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer,
- NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1, Optional RegimenSociedad As String = "-1", Optional TipoPersona As Boolean = False) As Boolean
+ NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1, Optional RegimenSociedad As String = "-1",
+ Optional TipoPersona As Boolean = False, Optional CveRegimenFiscal As Integer = -1, Optional CveUsoCFDI As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_ClientesNoFrecuenteAdd")
@@ -1703,6 +1704,8 @@ Public Class ClsClientes
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
.Add("@RegimenSociedad", SqlDbType.VarChar).Value = RegimenSociedad
.Add("@TipoPersona", SqlDbType.Bit).Value = TipoPersona
+ .Add("@CveRegimenFiscal", SqlDbType.Int).Value = CveRegimenFiscal
+ .Add("@CveUsoCFDI", SqlDbType.Int).Value = CveUsoCFDI
End With
diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb
index eb4b801f9..56829dfa0 100644
--- a/App_Code/ClsMovimientos.vb
+++ b/App_Code/ClsMovimientos.vb
@@ -690,7 +690,7 @@ Public Class ClsMovimientos
Optional FechaVI As String = "-1", Optional FechaVF As String = "-1",
Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1,
Optional CveTipoProveedor As Integer = -1, Optional Comprobaciones As Integer = -1,
- Optional TipoDocto As String = "-1", Optional TipoAgrupacion As Integer = -1) As Boolean
+ Optional TipoDocto As String = "-1", Optional TipoAgrupacion As Integer = -1, Optional CveProyecto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
If FechaCorte = Nothing Then FechaCorte = Now
@@ -719,7 +719,8 @@ Public Class ClsMovimientos
.Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
.Add("@Comprobaciones", SqlDbType.Int).Value = Comprobaciones
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
- .Add("@TipoAgrupacion", SqlDbType.Int).Value = TipoAgrupacion
+ .Add("@TipoAgrupacion", SqlDbType.Int).Value = TipoAgrupacion
+ .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto
End With
@@ -1295,7 +1296,7 @@ Public Class ClsMovimientos
CveEstatusFactura As Integer, Fecha As String, Agrupador As Integer, Opcion As String, CveEmpresa As Integer, CveSucursal As Integer,
TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional FechaVI As String = "-1", Optional FechaVF As String = "1",
Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveTipoProveedor As Integer = -1,
- Optional Comprobaciones As Integer = -1, Optional AplicaNC As Integer = -1, Optional TipoDocto As String = "-1") As Boolean
+ Optional Comprobaciones As Integer = -1, Optional AplicaNC As Integer = -1, Optional TipoDocto As String = "-1", Optional CveProyecto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
If FechaCorte = Nothing Then FechaCorte = Now
@@ -1330,6 +1331,7 @@ Public Class ClsMovimientos
.Add("@Comprobaciones", SqlDbType.Int).Value = Comprobaciones
.Add("@AplicaNC", SqlDbType.Int).Value = AplicaNC
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
+ .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto
End With
Try
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 495f72b8c..d72be053a 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -6033,16 +6033,22 @@ Public Class ClsPaginas
Dim ds As New DataSet
For Each rpds As ReportDataSource In DataSource
- If rpds.Value.GetType().ToString() = "System.Data.DataTable" Then
- Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable)
- dt = dt.Copy()
- dt.TableName = rpds.Name
- ds.Tables.Add(dt)
+ If rpds.Value IsNot Nothing Then
+ If rpds.Value.GetType().ToString() = "System.Data.DataTable" Then
+ Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable)
+ dt = dt.Copy()
+ dt.TableName = rpds.Name
+ ds.Tables.Add(dt)
+ Else
+ Dim ojext As New WSRDLC2.ReportObjects
+ ojext.Name = rpds.Name
+ ojext.Value = rpds.Value
+ reportobjects.Add(ojext)
+ End If
Else
- Dim ojext As New WSRDLC2.ReportObjects
- ojext.Name = rpds.Name
- ojext.Value = rpds.Value
- reportobjects.Add(ojext)
+ Dim dt = New DataTable()
+ dt.TableName = If(String.IsNullOrEmpty(rpds.Name), "DataTable1", rpds.Name)
+ ds.Tables.Add(dt)
End If
Next
@@ -7146,7 +7152,10 @@ Public Class ClsPaginas
nRowCECabecera("Version") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("Version").InnerText
- nRowCECabecera("MotivoTraslado") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText
+ If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado") IsNot Nothing Then
+ nRowCECabecera("MotivoTraslado") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText
+ End If
+
nRowCECabecera("TipoOperacion") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoOperacion").InnerText
nRowCECabecera("ClaveDePedimento") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("ClaveDePedimento").InnerText
nRowCECabecera("CertificadoOrigen") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("CertificadoOrigen").InnerText
@@ -7181,8 +7190,10 @@ Public Class ClsPaginas
End Try
+ If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado") IsNot Nothing Then
+ CEMotivoTraslado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText
+ End If
- CEMotivoTraslado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText
CETipoCambio = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoCambioUSD").InnerText
@@ -7378,7 +7389,7 @@ Public Class ClsPaginas
params.Add(New ReportParameter("CEIncoterm", RCEIncoterm))
params.Add(New ReportParameter("CEId", CEId))
params.Add(New ReportParameter("CEMotivoTraslado", RCEMotivoTraslado))
- params.Add(New ReportParameter("CETipoCamvio", CETipoCambio))
+ params.Add(New ReportParameter("CETipoCambio", CETipoCambio))
End If
diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb
index 8f2cafafa..6fee37f4c 100644
--- a/App_Code/LogicNominas.vb
+++ b/App_Code/LogicNominas.vb
@@ -19,7 +19,7 @@ Public Class LogicNominas
sw.Start()
End If
- Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual, False) 'CvePersonal, CvePeriodo,
+ Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual, False, CvePAC) 'CvePersonal, CvePeriodo,
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
If Not cfdi.Timbrado Then
Dim ObjTimbrado As New Timbrado
@@ -81,7 +81,7 @@ Public Class LogicNominas
Return Retorno
End Function
Dim hasfiniquito As Boolean
- Public Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario, TimbreIndemnizacion As Boolean) As CFDITimbre
+ Public Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario, TimbreIndemnizacion As Boolean, Optional CvePAC As Integer = 4) As CFDITimbre
Dim continuar As Boolean = True
hasfiniquito = False
Dim CvePersonal As Integer = -1
@@ -439,7 +439,7 @@ Public Class LogicNominas
cfdi.Comprobante.TipoComprobante = "N"
cfdi.Comprobante.TipoDocto = "Egs"
cfdi.Comprobante.MetodoPago = "PUE"
- cfdi.Comprobante.CondicionesdePago = "" '"CONTADO"
+ cfdi.Comprobante.CondicionesdePago = If(CvePAC < 4, "CONTADO", "") '"" '""
cfdi.Comprobante.FormadePago = If(UsuarioActual.Empresa.Funcionalidad(350).Contiene("1"), "", "99")
cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString() ' AHORITA SOLO SE REQUIERE ESPECIFICAR EL CODIGO POSTAL
cfdi.Comprobante.NumCuentaPago = "" 'objPersonal.BancoNumCuenta
diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb
index ee58149a8..38687b3e8 100644
--- a/App_Code/modExtensiones.vb
+++ b/App_Code/modExtensiones.vb
@@ -59,14 +59,14 @@ Namespace Extensiones
#End Region
- Public Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
+ Public Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean, Optional curRow As Integer = 0) As DataTable
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excelFile As GemBox.Spreadsheet.ExcelFile = GemBox.Spreadsheet.ExcelFile.Load(flatFilePath)
Dim unnamed As Integer = 0
Dim cols As Integer
Dim columns As String()
- Dim curRow As Integer = 0
+ 'Dim curRow As Integer = 0
Dim curCol As Integer = 0
Dim dataTable As DataTable = New DataTable()
Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0)
@@ -75,8 +75,8 @@ Namespace Extensiones
If firstRowHasHeaders Then
- If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
- dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
+ If worksheet.Rows(curRow).Cells(cols).Value IsNot Nothing Then
+ dataTable.Columns.Add(worksheet.Rows(curRow).Cells(cols).Value.ToString())
Else
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
End If
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index 822c37cf4..95e4fa60c 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -2952,6 +2952,10 @@ Partial Class PopUpVerFactura
End If
End If
+ If Vta.Version.ToEntero() = 4 AndAlso dr1("CodigoObjetoImpuesto").ToString() = "02" AndAlso Now.Date >= New DateTime(2022, 11, 1) AndAlso dr1("Descuento").ToString().ToDecimal().RoundSQL(2) = dr1("Total").ToString().ToDecimal().RoundSQL(2) Then
+ dr1("CodigoObjetoImpuesto") = "04"
+ End If
+
Next
Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC")
@@ -4277,7 +4281,12 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
- ImprimirPDF(String.Format("Empresas/Grales/Formatos/Traslado.rdlc", UsuarioActual.Empresa.Ruta), DtMovimientos, params, String.Format("Aviso de Traslado - {0}", Folio), RDSName:="DsInventarios")
+ If UsuarioActual.CveEmpresa.Contiene(172, 173) Then
+ ImprimirPDFStimulsoft(String.Format("Empresas/Grales/Formatos/Traslado.mrt", UsuarioActual.Empresa.Ruta), DtMovimientos, params, String.Format("Aviso de Traslado - {0}", Folio), RDSName:="DsInventarios")
+ Else
+ ImprimirPDF(String.Format("Empresas/Grales/Formatos/Traslado.rdlc", UsuarioActual.Empresa.Ruta), DtMovimientos, params, String.Format("Aviso de Traslado - {0}", Folio), RDSName:="DsInventarios")
+ End If
+
End If
diff --git a/Compras/RepCxP.aspx b/Compras/RepCxP.aspx
index 118bd0604..643599192 100644
--- a/Compras/RepCxP.aspx
+++ b/Compras/RepCxP.aspx
@@ -1,777 +1,797 @@
-<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepCxP.aspx.vb" Inherits="Compras_RepCxP" %>
-
-<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
-
-
-
-
-
-
-
TodosSi
diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb
index df2c98fa7..21fc6d4cb 100644
--- a/Ventas/RepVentas.aspx.vb
+++ b/Ventas/RepVentas.aspx.vb
@@ -156,7 +156,8 @@ Partial Class Ventas_RepVentas
DdlGrupo.Items.Insert(12, New ListItem("Año/Mes Ejec.", "13"))
DdlGrupo.Items.Insert(13, New ListItem("Fecha Ejec.", "14"))
DdlGrupo.Items.Insert(13, New ListItem("Tipo Cliente", "20"))
- DdlGrupo.Items.Insert(13, New ListItem("Vendedor/Cliente", "21"))
+ DdlGrupo.Items.Insert(13, New ListItem("Vendedor/Cliente", "21"))
+ DdlGrupo.Items.Insert(13, New ListItem("Giro", "22"))
DdlGrupo.DataBind()
DdlGrupo.SelectedValueExist("3")
End Sub
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index bd1dddfbe..1ac9a835a 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -7616,53 +7616,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
FísicaMoral
-
-
-
-
- <%--
-
-
-
-
--%>
-
@@ -7701,12 +7680,30 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -7714,18 +7711,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -7747,26 +7732,16 @@
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -7774,12 +7749,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index f29d85d84..aae7589be 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -2315,6 +2315,7 @@ Partial Class Ventas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
+
If Not IsPostBack Then
If IfNull(Request("Opcionx"), "").ToString = "Saldar" And UsuarioActual.CveUsuario = 100 Then
@@ -3166,6 +3167,10 @@ Partial Class Ventas
BrSubProyecto.Visible = DdlProyecto.Visible
divProyectoPyME.Visible = DdlProyecto.Visible
+ If UsuarioActual.CveEmpresa.Contiene(172, 173) Then
+ LnkAddVenta.Visible = True
+ End If
+
'MOSTRAR LA OPCION DE AGREGAR PS EN BDH
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta <= 0 Then
ImgOtrosConceptos.Visible = False
@@ -7630,7 +7635,6 @@ Partial Class Ventas
#End Region
#Region "G R I D V I E W S"
-
#Region "GvPS"
Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -7686,33 +7690,36 @@ Partial Class Ventas
e.Row.FCTextBox("TxtDescuento").Enabled = False
End If
- 'Si es una devolucion
- If NuevaFactura = 0 Then
- e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
- e.Row.FCDropDownList("DdlClasificacion").Enabled = False
- e.Row.FCDropDownLost("DdlPS").Enabled = False
- e.Row.FCDropDownList("DdlProyecto").Enabled = False
- e.Row.FCDropDownList("DdlSubProyecto").Enabled = False
- e.Row.FCTextBox("TxtPrecio").Enabled = False
- ElseIf NuevaFactura = 1 Or CveContrato > 0 Then
- e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
- e.Row.FCDropDownList("DdlClasificacion").Enabled = False
- e.Row.FCDropDownLost("DdlPS").Enabled = False
- e.Row.FCTextBox("TxtCantidad").Enabled = False
- e.Row.FCTextBox("TxtPrecio").Enabled = False
- e.Row.FCTextBox("TxtDescuento").Enabled = False
- If TieneAlmacen Then e.Row.FCLinkButton("imgD").Visible = False
+ If Not EsCreaApartirDe Then
+ 'Si es una devolucion
+ If NuevaFactura = 0 Then
+ e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
+ e.Row.FCDropDownList("DdlClasificacion").Enabled = False
+ e.Row.FCDropDownLost("DdlPS").Enabled = False
+ e.Row.FCDropDownList("DdlProyecto").Enabled = False
+ e.Row.FCDropDownList("DdlSubProyecto").Enabled = False
+ e.Row.FCTextBox("TxtPrecio").Enabled = False
+ ElseIf NuevaFactura = 1 Or CveContrato > 0 Then
+ e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
+ e.Row.FCDropDownList("DdlClasificacion").Enabled = False
+ e.Row.FCDropDownLost("DdlPS").Enabled = False
+ e.Row.FCTextBox("TxtCantidad").Enabled = False
+ e.Row.FCTextBox("TxtPrecio").Enabled = False
+ e.Row.FCTextBox("TxtDescuento").Enabled = False
+
+ If TieneAlmacen Then e.Row.FCLinkButton("imgD").Visible = False
+
+ If UsuarioActual.TienePermisoProceso(222) Then
+ e.Row.FCDropDownList("DdlUnidadMedida").Enabled = True
+ e.Row.FCDropDownList("DdlClasificacion").Enabled = True
+ e.Row.FCDropDownLost("DdlPS").Enabled = True
+ e.Row.FCTextBox("TxtCantidad").Enabled = True
+ e.Row.FCTextBox("TxtPrecio").Enabled = True
+ e.Row.FCTextBox("TxtDescuento").Enabled = True
+ End If
- If UsuarioActual.TienePermisoProceso(222) Then
- e.Row.FCDropDownList("DdlUnidadMedida").Enabled = True
- e.Row.FCDropDownList("DdlClasificacion").Enabled = True
- e.Row.FCDropDownLost("DdlPS").Enabled = True
- e.Row.FCTextBox("TxtCantidad").Enabled = True
- e.Row.FCTextBox("TxtPrecio").Enabled = True
- e.Row.FCTextBox("TxtDescuento").Enabled = True
End If
-
End If
'Si es facturacion de OC o Contrato
@@ -8564,6 +8571,43 @@ Partial Class Ventas
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
+
+ If DdlUsoCFDI.SelectedValue.ToEntero() <= 0 Then
+ Alert("No se ha seleccionado el Uso CFDI o el cliente no tiene asignado el correcto.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
+ If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then
+
+ If LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente <> "616" Then
+ Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue <> "23" Then
+ Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente = "616" Then
+ Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue = "23" Then
+ Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Dim EsPersonaMoral As Boolean = Me.TipoPersona
+ Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
+
+ If DtUsosCFDI.Rows.Count = 0 Then
+ Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
End If
If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
@@ -12117,7 +12161,7 @@ Partial Class Ventas
' If drr("ImporteIVA").ToString().ToDouble > 0 Then
'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero
- If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then
+ If Timbre.Comprobante.Total > 0 AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0) Then
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(6), .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal})
End If
@@ -12133,6 +12177,11 @@ Partial Class Ventas
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal})
End If
+ 'si el codigo objeto impuesto es 02 y no tiene desglose de impuestos por el descuento, debe asignar el valor 04 - Si objeto de impuesto y no causa impuesto
+ If concepto.Impuestos.Count = 0 AndAlso concepto.ObjetoImpuesto = "02" AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(2) = 0.00D Then
+ concepto.ObjetoImpuesto = "04"
+ End If
+
Timbre.Conceptos.Add(concepto)
i += 1
Next
@@ -12153,7 +12202,11 @@ Partial Class Ventas
Timbre.Complementos.ComercioExterior11.Incoterm = GlobalDTIncoterm.FiltroPrimeroValor("ClaveSATIncoterm", $"CveIncoterm={DdlIncoterm.SelectedValue}")
Timbre.Complementos.ComercioExterior11.Subdivision = "0"
Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString().ToDecimal)
- Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}")
+ If Timbre.Comprobante.TipoComprobante = "T" Then
+ Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}")
+ Else
+ Timbre.Complementos.ComercioExterior11.MotivoTraslado = ""
+ End If
@@ -14867,7 +14920,7 @@ Partial Class Ventas
Next
End If
- If factura.TipoDocto.Contiene("Ing", "Dev") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Dev") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
Dim Filtro As String = ""
Select Case factura.TipoDocto
@@ -14995,7 +15048,7 @@ Partial Class Ventas
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
@@ -15008,23 +15061,19 @@ Partial Class Ventas
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, TipoMovto69, 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
+ If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, 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) 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, TipoMovto68, 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
+ If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveSubProyecto:=factura.CveSubProyecto) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al guardar movimiento de almacen. Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
@@ -15052,6 +15101,92 @@ Partial Class Ventas
End If
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Rem") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
+
+ Dim DebeGenerarMovimiento As Boolean = TmpDTDetalle.COUNT("CvePS", "CveTipoPS = 2") > 0
+
+ If DebeGenerarMovimiento Then
+
+ Dim CveAlmacenSalida As Integer = ddlAlmacen.SelectedValue.ToEntero()
+ Dim CveAlmacenExA As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={DdlSubProyecto.SelectedValue}").ToEntero()
+
+ Dim CveRemision As Integer = factura.CveVenta
+ Dim CveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero()
+
+ Dim DtProductos As DataTable = TmpDTDetalle.FiltraParametros("CveTipoPS = 2")
+
+ Dim MovDetalle As DataTable = New DataTable()
+ MovDetalle.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
+ MovDetalle.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
+ MovDetalle.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
+ MovDetalle.Columns.Add(New DataColumn("PU", GetType(Decimal)))
+ MovDetalle.Columns.Add(New DataColumn("Serie", GetType(String)))
+ MovDetalle.Columns.Add(New DataColumn("Lote", GetType(String)))
+ MovDetalle.Columns.Add(New DataColumn("FechaCaducidad", GetType(DateTime)))
+ MovDetalle.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer)))
+
+ For Each RowPS As DataRow In DtProductos.Rows
+ Dim RowInv = MovDetalle.NewRow
+
+ RowInv("Cantidad") = RowPS("Cantidad").ToString().ToDecimal()
+ RowInv("CveUM") = RowPS("CveUM").ToString().ToEntero()
+ RowInv("CvePS") = RowPS("CvePS").ToString().ToEntero()
+ RowInv("PU") = 0
+ RowInv("Serie") = ""
+ RowInv("Lote") = ""
+ RowInv("FechaCaducidad") = MinFecha
+ RowInv("CveVentaDetalle") = RowPS("CveVentaDetalle").ToString().ToEntero()
+
+ MovDetalle.Rows.Add(RowInv)
+ Next
+
+ 'Le damos salida de apartado por traspaso
+ Dim CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, CveAlmacenDestino:=CveAlmacenExA, MovimientoPrePoliza:=False)
+
+ If Not CveMovimientoSalidaPorTraspaso > 0 Then
+ OcurrioError = True
+ End If
+
+ Dim CveMovimientoEntrada As Integer = -1
+
+ Dim TotalPrePoliza As Decimal = 0
+
+ 'Le damos entrada al general por traspaso
+ If Not OcurrioError Then
+
+ If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaPorTraspaso, UsuarioActual.CveEmpresa) Then
+ MovDetalle = ObjInventario.DtResultados.Copy()
+ TotalPrePoliza = MovDetalle.SUMD("Total").RoundSQL(2)
+ End If
+
+ If Not OcurrioError Then
+ CveMovimientoEntrada = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenExA, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, MovimientoPrePoliza:=False)
+
+ If CveMovimientoEntrada <= 0 Then
+ OcurrioError = True
+ End If
+ End If
+
+ End If
+
+ 'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
+ If Not OcurrioError Then
+ If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
+ OcurrioError = True
+ ErrorList.Add("Ocurrió un error al verificar inventario. Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
+ End If
+ End If
+
+ If Not OcurrioError Then
+ If ContabilizaMovimientoAlmacen(ObjConta, Now, ObjFactura.SerieFolio, "Ventas/Rem", CveMovimientoSalidaPorTraspaso, CveMovimientoEntrada, TotalPrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then
+ OcurrioError = True
+ End If
+ End If
+
+ End If
+
+ End If
+
End If
Catch ex As Exception
@@ -16283,6 +16418,7 @@ Partial Class Ventas
End Function
#End Region
+
#Region " BTN ELIMINAR "
Protected Sub BtnEmitir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEmitir.Click
@@ -19766,7 +19902,7 @@ Partial Class Ventas
If TieneMovimientosContrato Then
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
Else
- MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
+ MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (SaldoAlmacen > 0 AND CantidadDisponible > 0)"))
End If
End If
@@ -19981,7 +20117,8 @@ Partial Class Ventas
Return Not OcurrioError
End Function
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = True,
- Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional ObjContPaq As ClsContPAQi = Nothing) As Integer
+ Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional ObjContPaq As ClsContPAQi = Nothing,
+ Optional CveAlmacenDestino As Integer = -1) As Integer
Dim OcurrioError As Boolean = False
Dim ContadorMovtosDetalles = 0
@@ -19994,7 +20131,7 @@ Partial Class Ventas
'Creamos el movimiento
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, ConceptoEntrada, CveMoneda, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
- CveMovimientoRelacionado:=CveMovimientoRelacionado, Modulo:="Vta/E4")
+ CveMovimientoRelacionado:=CveMovimientoRelacionado, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="Vta/E4")
If CveMovimientoInventario > 0 Then
@@ -20075,6 +20212,7 @@ Partial Class Ventas
If Not OcurrioError Then
If MovimientoPrePoliza AndAlso CveMovimientoInventario > 0 Then
'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
+
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim DtCostos = ObjInventario.DtResultados.Copy
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
@@ -20125,6 +20263,7 @@ Partial Class Ventas
Else
OcurrioError = True
End If
+
End If
End If
@@ -20151,7 +20290,6 @@ Partial Class Ventas
Dim DtCostos As DataTable = Nothing
Dim DtCostosDistinct As DataTable = Nothing
Dim IdCtaContable As Integer = 0
- Dim CveCuenta As Integer = 0
Dim ValorInventario As Decimal = 0D
Dim TotalCostoAcumulado As Decimal = 0D
Dim Cont As Integer = 1
@@ -20183,7 +20321,6 @@ Partial Class Ventas
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
- CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario
'cuando es el último movimiento y hay diferencias en los importes
@@ -20193,7 +20330,7 @@ Partial Class Ventas
Try
'If ValorInventario <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
OcurrioError = True
Exit For
End If
@@ -20207,7 +20344,7 @@ Partial Class Ventas
If Not OcurrioError Then
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero()
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
OcurrioError = True
End If
End If
@@ -20413,7 +20550,6 @@ Partial Class Ventas
Dim DtCostos = ObjInventario.DtResultados.Copy
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
- Dim CveCuenta As Integer = 0
Dim ValorInventario As Decimal
Dim TotalCostoAcumulado As Decimal = 0D
Dim Cont As Integer = 1
@@ -20422,7 +20558,6 @@ Partial Class Ventas
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
- CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario
'cuando es el último movimiento y hay diferencias en los importes
@@ -20432,7 +20567,7 @@ Partial Class Ventas
Try
'If ValorInventario <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
OcurrioError = True
Exit For
End If
@@ -20446,7 +20581,7 @@ Partial Class Ventas
If Not OcurrioError Then
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero()
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
OcurrioError = True
End If
End If
@@ -21399,9 +21534,14 @@ Partial Class Ventas
'REGENERAR EL PDF
If Not OcurrioError Then
Try
+ Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
+ Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
+
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
- Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST))
- Hilo.Start()
+ RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
+ '
+ 'Dim Hilo As New System.Threading.Thread(Sub() )
+ 'Hilo.Start()
Catch ex As Exception
OnError("Ocurrió un error al regenerar el PDF", ex)
End Try
@@ -22416,12 +22556,13 @@ Partial Class Ventas
DivDireccionCliente.Visible = False
DivNumeroCPCliente.Visible = False
- DivColoniaTelefonoCliente.Visible = False
+ 'DivColoniaTelefonoCliente.Visible = False
DivCiudadLocalidadCliente.Visible = False
DivEstadoPaisCliente.Visible = False
DivCorreoCuentaCliente.Visible = False
DivBotonesAgregarCliente.Visible = False
DivFormaCliente.Visible = False
+ divRegimenCliente.Visible = False
UpAgregarCliente.Update()
CargaEstados()
@@ -22435,7 +22576,7 @@ Partial Class Ventas
DivTipoPersona.Visible = True
DivDireccionCliente.Visible = True
DivNumeroCPCliente.Visible = True
- DivColoniaTelefonoCliente.Visible = True
+ 'DivColoniaTelefonoCliente.Visible = True
DivCiudadLocalidadCliente.Visible = True
DivEstadoPaisCliente.Visible = True
DivCorreoCuentaCliente.Visible = True
@@ -22448,9 +22589,16 @@ Partial Class Ventas
RFVCiudadC.Visible = False
RFVLocalidadC.Visible = False
RFVSATPais.Visible = False
+ divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
+
+ RdTipoPersona.SelectedValue = "0"
DdlMetodoCliente.SelectedValueExist(1)
DdlFormaCliente.SelectedValueExist(1)
+
+ DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
+ DdlRegimenFiscalCliente.DataBind()
+ CargaComboCFDICliente()
Else
Dim ObjCliente As New ClsClientes
If ObjCliente.ValidaClienteRFC(TxtRFCCliente.Text, UsuarioActual.CveEmpresa) Then
@@ -22465,12 +22613,13 @@ Partial Class Ventas
DivTipoPersona.Visible = True
DivDireccionCliente.Visible = True
DivNumeroCPCliente.Visible = True
- DivColoniaTelefonoCliente.Visible = True
+ 'DivColoniaTelefonoCliente.Visible = True
DivCiudadLocalidadCliente.Visible = True
DivEstadoPaisCliente.Visible = True
DivCorreoCuentaCliente.Visible = True
DivBotonesAgregarCliente.Visible = True
DivFormaCliente.Visible = True
+ divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
End If
End If
ObjCliente.Dispose()
@@ -22485,12 +22634,94 @@ Partial Class Ventas
DdlMetodoCliente.SelectedValueExist(-1)
DdlFormaCliente.SelectedValueExist(-1)
+ DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales()
+ DdlRegimenFiscalCliente.DataBind()
+ CargaComboCFDICliente()
+
End If
End Sub
+ Private Sub CargaComboCFDICliente()
+ If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI().FiltraParametros("CveUsoCFDI = 23")
+ DdlUsoCFDICliente.DataBind()
+ Else
+ Dim RegimenFiscalCliente As String = "-1"
+
+ If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {DdlRegimenFiscalCliente.SelectedValue.ToEntero()}")
+ End If
+
+ DdlUsoCFDICliente.Items.Clear()
+ If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
+ Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
+ Else
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
+ End If
+
+ DdlUsoCFDICliente.DataBind()
+ DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ End If
+ Else
+ DdlUsoCFDICliente.Items.Clear()
+ DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ End If
+
+ UpAgregarCliente.Update()
+ End Sub
+
+ Protected Sub DdlRegimenFiscalCliente_SelectedIndexChanged(sender As Object, e As EventArgs)
+ CargaComboCFDICliente()
+ End Sub
+
Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click
Dim CvePrecioLista As Integer = -1
+ Dim CveRegimenFiscal As Integer = -1
+ Dim CveUsoCFDI As Integer = 3
+
+ If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
+ CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
+ CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
+
+ Dim RegimenFiscalCliente As String = "-1"
+
+ If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}")
+ End If
+
+ If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue <> "11" Then
+ Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then
+ Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
+ Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
+ Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
+ Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
+
+ If DtUsosCFDI.Rows.Count = 0 Then
+ Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ End If
+
If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa).Rows(0)
If Dr IsNot Nothing Then
@@ -22508,7 +22739,7 @@ Partial Class Ventas
TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, DdlEstadoSAT.SelectedValue.ToEntero,
TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim,
DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista,
- RegimenSociedad:=TxtRegimenSociedad.Text, TipoPersona:=TipoPersona) Then
+ RegimenSociedad:=TxtRegimenSociedad.Text, TipoPersona:=TipoPersona, CveRegimenFiscal:=CveRegimenFiscal, CveUsoCFDI:=CveUsoCFDI) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
RegistraScript("hideDivEC();")
@@ -22680,6 +22911,10 @@ Partial Class Ventas
LBAplicaDevolucion.Visible = False
End If
+ If DdlTipoComprobante.SelectedValue = "Dev" AndAlso VentaSaldoAlmacen <> 0 Then
+ LiDevolucionAlmacen.Visible = False
+ End If
+
End If
UpnTools.Update()
@@ -30828,25 +31063,6 @@ Partial Class Ventas
Exit Sub
End If
- 'VERIFICA QUE LAS FACTURAS TENGAN EL MISMO ESTATUS EN ALMACEN (NO MEZCLAR REMISIONES 'SURTIDAS' CON 'NO SURTIDAS')
- 'If dtSeleccionadas.COUNT("Surtido", "Surtido = 'Si'") > 0 AndAlso dtSeleccionadas.COUNT("Surtido", "Surtido = 'No'") > 0 Then
- ' Dim SbRem As New StringBuilder
- ' SbRem.Append("Solo debe seleccionar remisiones con el mismo estatus de almacen. Por favor verifique y vuelva a intentar.")
-
- ' SbRem.Append("Remisiones Surtidas:")
- ' For Each RowSurtida As DataRow In dtSeleccionadas.FiltraParametros("Surtido = 'Si'", DistinctColumns:={"Folio"}).Rows
- ' SbRem.AppendFormat("{0}", RowSurtida("Folio"))
- ' Next
-
- ' SbRem.Append("Remisiones No Surtidas:")
- ' For Each RowSurtida As DataRow In dtSeleccionadas.FiltraParametros("Surtido = 'No'", DistinctColumns:={"Folio"}).Rows
- ' SbRem.AppendFormat("{0}", RowSurtida("Folio"))
- ' Next
-
- ' Alert(SbRem.ToString(), TipoMensaje.MsgAdvertencia)
- ' Exit Sub
- 'End If
-
DdlMoneda.SelectedValue = GlobalDTMonedas.FiltroPrimeroValor("CveMoneda", $"Abreviatura = '{dtSeleccionadas.FiltroPrimeroValor("Abreviatura")}'")
DdlMoneda.Enabled = False
CambiaMoneda()
@@ -31067,6 +31283,11 @@ Partial Class Ventas
BtnEmitirImprimir.Visible = False
End If
+ 'SI HAY REMISIONES SURTIDAS, NO GENERAR EL MOVIMIENTO AUTOMATICO
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso dtSeleccionadas.COUNT("Surtido", "Surtido = 'Si'") > 0 Then
+ DivAlmacen.Visible = False
+ End If
+
End If
TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text)
@@ -31077,8 +31298,9 @@ Partial Class Ventas
UpParametros.Update()
UPEstimaciones.Update()
UPCondicionesPago.Update()
- HuboCambioRemi = Not HuboCambioRemi
+ UpINV.Update()
+ HuboCambioRemi = Not HuboCambioRemi
RegistraScript("$('#DivRemisiones').modal('hide');", "DivRemisionesHide")
End Sub
@@ -33422,9 +33644,13 @@ Partial Class Ventas
'REGENERAR EL PDF
Try
+ Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
+ Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
+
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
- Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST))
- Hilo.Start()
+ RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
+ 'Dim Hilo As New System.Threading.Thread(Sub() )
+ 'Hilo.Start()
Catch ex As Exception
OnError("Ocurrió un error al regenerar el PDF", ex)
End Try
@@ -34383,11 +34609,38 @@ Partial Class Ventas
DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12")
- If RdTipoPersona.SelectedValue.ToEntero = 1 And UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
+ If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
+ If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
+ DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
+ DdlRegimenFiscalCliente.DataBind()
+ Else
+ Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal")
+ Dim Val As String
+
+ If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
+ 'verifico que sino existe el valor. lo limpie
+ Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue)
+ If Val = "" Then 'sino encuentra valor, lo limpia
+ DdlRegimenFiscalCliente.Items.Clear()
+ DdlRegimenFiscalCliente.SelectedValue = Nothing
+ End If
+ End If
+
+ DdlRegimenFiscalCliente.DataSource = dt
+ DdlRegimenFiscalCliente.DataBind()
+ DdlRegimenFiscalCliente.SelectedValueExist(Val)
+
+ End If
+
+ DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ DdlUsoCFDICliente.Items.Clear()
+ DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
End If
UpAgregarCliente.Update()
diff --git a/vwd.webinfo b/vwd.webinfo
index fdbdd590d..74e16e7d3 100644
--- a/vwd.webinfo
+++ b/vwd.webinfo
@@ -576,6 +576,8 @@
+
+