Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -6263,6 +6263,13 @@
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function httpGet() {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.open("GET", "http://localhost:85/ashx/SIGWeb.ashx?metodo=GetTokenAngular", false); // false for synchronous request
|
||||
xmlHttp.send(null);
|
||||
return xmlHttp.responseText;
|
||||
}
|
||||
|
||||
function CargaGraficaCompratamientoSaldoMensual(data, graph) {
|
||||
var chart = AmCharts.makeChart("chartdiv4", {
|
||||
"type": "serial",
|
||||
|
||||
@@ -7,7 +7,14 @@ Imports System.IO
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
Imports System.Globalization
|
||||
|
||||
Imports System.Net.Http
|
||||
Imports Newtonsoft.Json
|
||||
Imports System.Threading.Tasks
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports System.Net
|
||||
Imports System.Collections.Generic
|
||||
Imports Newtonsoft.Json.Serialization
|
||||
|
||||
Partial Class Clientes
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -1797,22 +1804,27 @@ Partial Class Clientes
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1)
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
||||
Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1)
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
'Carga Grid
|
||||
DTHistorialVentas = ObjClientes.DtResultados
|
||||
GVHistorial.DataSource = ObjClientes.DtResultados
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
GVHistorial.DataBind()
|
||||
DTHistorialVentas = ObjClientes.DtResultados
|
||||
GVHistorial.DataSource = ObjClientes.DtResultados
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
Else
|
||||
GVHistorial.DataSource = Nothing
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
GVHistorial.DataBind()
|
||||
|
||||
'DTHistorialVentas = ConsultarHistorial()
|
||||
'GVHistorial.DataSource = DTHistorialVentas
|
||||
'GVHistorial.DataBind()
|
||||
|
||||
End Sub
|
||||
Private Function CargaCxC(Optional CveClienteSucursal As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
@@ -10348,5 +10360,125 @@ Partial Class Clientes
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
End Sub
|
||||
|
||||
Public Function ConsultarHistorial2(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) As DataTable
|
||||
Dim retorno As DataTable = Nothing
|
||||
|
||||
Using cliente As New HttpClient()
|
||||
cliente.Timeout = New TimeSpan(0, 0, 15)
|
||||
cliente.DefaultRequestHeaders.Add("Accept", "application/json")
|
||||
|
||||
Try
|
||||
|
||||
Dim Parametros As JObject = New JObject(
|
||||
New JProperty("CveCliente", CveCliente),
|
||||
New JProperty("SelectTop", SelectTop),
|
||||
New JProperty("CveClienteSucursal", CveClienteSucursal),
|
||||
New JProperty("TipoDocto", "-1")
|
||||
)
|
||||
|
||||
Dim Url = New Uri(String.Format("{0}api/cliente/GetHistorialVentas?CveCliente={1}&SelectTop={2}&CveClienteSucursal={3}&TipoDocto={4}", "https://localhost:5001/", CveCliente, SelectTop, CveClienteSucursal, "-1"))
|
||||
|
||||
Dim response = cliente.GetAsync(Url).Result
|
||||
|
||||
If response.StatusCode = 200 Then
|
||||
Dim json = response.Content.ReadAsStringAsync().Result
|
||||
retorno = Newtonsoft.Json.JsonConvert.DeserializeObject(Of DataTable)(json)
|
||||
End If
|
||||
|
||||
Url = Nothing
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el historial de ventas", ex)
|
||||
End Try
|
||||
End Using
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
Public Function ConsultarHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) As DataTable
|
||||
Dim retorno As DataTable = Nothing
|
||||
|
||||
Using cliente As New HttpClient()
|
||||
cliente.Timeout = New TimeSpan(0, 0, 15)
|
||||
cliente.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", GetTokenAngular()))
|
||||
Try
|
||||
|
||||
Dim Parametros As JObject = New JObject(
|
||||
New JProperty("CveCliente", CveCliente),
|
||||
New JProperty("SelectTop", SelectTop),
|
||||
New JProperty("CveClienteSucursal", CveClienteSucursal),
|
||||
New JProperty("TipoDocto", "-1")
|
||||
)
|
||||
System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, SecurityProtocolType)
|
||||
|
||||
Dim Url = New Uri(String.Format("{0}api/cliente/GetHistorialVentas", "http://localhost:5000/"))
|
||||
|
||||
Dim response = cliente.PostAsync(Url, New StringContent(Parametros.ToString(), Encoding.UTF8, "application/json")).Result
|
||||
|
||||
If response.StatusCode = 200 Then
|
||||
Dim json = response.Content.ReadAsStringAsync().Result
|
||||
|
||||
Dim result = JsonConvert.DeserializeObject(Of MResult)(json)
|
||||
|
||||
If result.isSuccess Then
|
||||
|
||||
'Dim contractResolver = New DefaultContractResolver With
|
||||
'{
|
||||
' .NamingStrategy = New KebabCaseNamingStrategy()
|
||||
'}
|
||||
'Dim options = New JsonSerializerSettings() With
|
||||
'{
|
||||
' .ContractResolver = contractResolver,
|
||||
' .Formatting = Formatting.Indented
|
||||
'}
|
||||
|
||||
retorno = JsonConvert.DeserializeObject(Of DataTable)(result.result.ToString())
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
response.Dispose()
|
||||
|
||||
Url = Nothing
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el historial de ventas", ex)
|
||||
End Try
|
||||
End Using
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
Public Property Token As String = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDdmVQbGF0YWZvcm1hIjoiMSIsIkN2ZVVzdWFyaW8iOiIxNTM4IiwiQ3ZlRW1wcmVzYSI6IjIiLCJDdmVSb2wiOiIxIiwiRmVjaGEiOiJzw6FiYWRvLCAyMCBkZSBtYXJ6byBkZSAyMDIxIiwibmJmIjoxNjE2MjYzMzg2LCJleHAiOjE2MTYyNzQxODYsImlhdCI6MTYxNjI2MzM4Nn0.N_4yHZ0J41GgcXbAFfvyLvXiV-U8nRm85LoZhG1riNc"
|
||||
|
||||
Public Class MResult
|
||||
Public Property isSuccess As Boolean
|
||||
Public Property message As String
|
||||
Public Property result As JArray
|
||||
End Class
|
||||
|
||||
Public Function GetTokenAngular() As String
|
||||
Dim retorno As String = ""
|
||||
|
||||
Using cliente As New HttpClient()
|
||||
|
||||
cliente.Timeout = New TimeSpan(0, 0, 15)
|
||||
cliente.DefaultRequestHeaders.Add("Accept", "text/json")
|
||||
|
||||
Try
|
||||
Dim Url = New Uri(String.Format("{0}ashx/SIGWeb.ashx?metodo=GetTokenAngular", "http://localhost:85/"))
|
||||
|
||||
Dim response = cliente.GetAsync(Url).Result
|
||||
|
||||
If response.StatusCode = 200 Then
|
||||
retorno = response.Content.ReadAsStringAsync().Result
|
||||
End If
|
||||
|
||||
Url = Nothing
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el token", ex)
|
||||
End Try
|
||||
End Using
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
@@ -1950,14 +1950,13 @@
|
||||
<td colspan="1">
|
||||
<asp:Label runat="server" Text="Código de Acceso:" Font-Bold="true" Width="120px" />
|
||||
</td>
|
||||
<td colspan="1">
|
||||
<td colspan="1" style="text-align:center">
|
||||
<asp:TextBox ID="TxtCodigoAcceso" runat="server" type="password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVCodigoAcceso" runat="server" ControlToValidate="TxtCodigoAcceso" Display="None" ErrorMessage="<span class='has-error'><span id='username-error' class='help-block'>El campo <b>''Código de Acceso''</b> es necesario.</span></span>" ValidationGroup="GrpValidarCodigo"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1"> </td>
|
||||
<td colspan="1"> </td>
|
||||
<td colspan="2" > <span class='has-error'><span id='username-error' class='help-block'><asp:Literal ID="LtlMensajeBloqueo" runat="server" Text=""></asp:Literal></span></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<asp:Button ID="BtnCambiar" runat="server" CssClass="btn btn-success btn-sm" Text="Desbloquear" ValidationGroup="GrpValidarCodigo" OnClick="BtnCambiar_Click" />
|
||||
|
||||
@@ -1017,15 +1017,16 @@ Partial Class PV
|
||||
DivBloqueo.Visible = False
|
||||
Dim strScript As New StringBuilder
|
||||
strScript.Append("window.onload = function MuestraBloqueo() { document.getElementById(""C_BtnShowBloqueo"").click(); setTimeout(function(){ $('#C_TxtCodigoAcceso').focus(); ")
|
||||
'If UsuarioActual.ErrorDesbloqueo Then
|
||||
If UsuarioActual.ErrorDesbloqueo Then
|
||||
LtlMensajeBloqueo.Text = UsuarioActual.MsgErrorDesbloqueo
|
||||
'strScript.AppendFormat("alert('{0}');", UsuarioActual.MsgErrorDesbloqueo)
|
||||
'End If
|
||||
End If
|
||||
strScript.Append("}, 500); }")
|
||||
RegistraScript(strScript.ToString())
|
||||
|
||||
UsuarioActual.SesionBloqueada = True
|
||||
'UsuarioActual.ErrorDesbloqueo = False
|
||||
'UsuarioActual.MsgErrorDesbloqueo = ""
|
||||
UsuarioActual.ErrorDesbloqueo = False
|
||||
UsuarioActual.MsgErrorDesbloqueo = ""
|
||||
|
||||
BtnEmitirImprimir.Visible = False
|
||||
Exit Sub
|
||||
@@ -7449,13 +7450,13 @@ Partial Class PV
|
||||
End Sub
|
||||
Protected Sub BtnCambiar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
'UsuarioActual.ErrorDesbloqueo = False
|
||||
'UsuarioActual.MsgErrorDesbloqueo = ""
|
||||
UsuarioActual.ErrorDesbloqueo = False
|
||||
UsuarioActual.MsgErrorDesbloqueo = ""
|
||||
|
||||
If String.IsNullOrEmpty(TxtCodigoAcceso.Text.Trim) Then
|
||||
UsuarioActual.SesionBloqueada = True
|
||||
'UsuarioActual.ErrorDesbloqueo = True
|
||||
'UsuarioActual.MsgErrorDesbloqueo = "Es necesario un código de acceso"
|
||||
UsuarioActual.ErrorDesbloqueo = True
|
||||
UsuarioActual.MsgErrorDesbloqueo = "Es necesario un código de acceso"
|
||||
|
||||
Response.Redirect($"~/Ventas/PV.aspx")
|
||||
Exit Sub
|
||||
@@ -7527,8 +7528,8 @@ Partial Class PV
|
||||
Response.Redirect($"~/Ventas/PV.aspx")
|
||||
Else
|
||||
UsuarioActual.SesionBloqueada = True
|
||||
'UsuarioActual.ErrorDesbloqueo = True
|
||||
'UsuarioActual.MsgErrorDesbloqueo = "El código de acceso no es correcto"
|
||||
UsuarioActual.ErrorDesbloqueo = True
|
||||
UsuarioActual.MsgErrorDesbloqueo = "El código de acceso no es correcto"
|
||||
|
||||
Response.Redirect($"~/Ventas/PV.aspx")
|
||||
End If
|
||||
|
||||
@@ -3946,7 +3946,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Dim ObjUsados As New ClsVentas
|
||||
|
||||
If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
DtUsados = ObjUsados.DtResultados
|
||||
End If
|
||||
ObjUsados.Dispose()
|
||||
@@ -4308,7 +4308,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
If CveEmpresaCRM > 0 And Not CveCliente > 0 Then
|
||||
If CveEmpresaCRM > 0 Then
|
||||
CargaEmpresaCRM(CveEmpresaCRM)
|
||||
Else
|
||||
CveEmpresaCRM = IIf(CveEmpresaCRM > 0, CveEmpresaCRM, 0).ToString().ToEntero()
|
||||
@@ -11299,6 +11299,9 @@ Partial Class Ventas
|
||||
Dim CveCuentaIVAxTrasladar As Integer = 0
|
||||
Dim CveCuentaIVATrasladado As Integer = 0
|
||||
Dim SeContabiliza As Boolean = True
|
||||
|
||||
Dim SimplificarPrePoliza As Boolean = False
|
||||
|
||||
If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Or (ChkAntEspecial.Checked AndAlso ObjFactura.TipoDocto = "Ant") Then
|
||||
SeContabiliza = False
|
||||
End If
|
||||
@@ -12614,7 +12617,7 @@ Partial Class Ventas
|
||||
If CveIEPago > 0 Then
|
||||
|
||||
importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL
|
||||
IdCtaContable = 0
|
||||
CveCuenta = 0
|
||||
CveSubProyectoContabilizar = CveSubProyectoVenta
|
||||
@@ -12633,20 +12636,61 @@ Partial Class Ventas
|
||||
' CuentasContablesInvalidasSIG.AppendFormat("<br> {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero())
|
||||
' CveCuentaContabilizacion = 0
|
||||
'End If
|
||||
'MONEDA EXTRANJERA
|
||||
If ObjFactura.CveMoneda > 1 Then
|
||||
'BANCOS
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If UsaComplementariaClientes Then
|
||||
Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL
|
||||
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 204, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 204, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
'PAGO CLIENTES
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'PAGO CLIENTES COMPLEMENTARIA
|
||||
If UsaComplementariaClientes Then
|
||||
Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL
|
||||
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 207, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, 0, Referencia, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
SimplificarPrePoliza = True
|
||||
|
||||
Else
|
||||
'BANCOS
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'PAGO CLIENTES
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'BANCOS
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'CLIENTES
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
If ObjFactura.IVA <> 0 Then
|
||||
@@ -12795,7 +12839,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'Simplificacion de PrePolizas
|
||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") OrElse SimplificarPrePoliza Then
|
||||
If Not ObjConta.PrePolizaSimplificacion(ObjFactura.CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
||||
End If
|
||||
@@ -27328,11 +27372,29 @@ Partial Class Ventas
|
||||
|
||||
RemisionesLista.Clear()
|
||||
|
||||
Dim MsgUsados As New StringBuilder
|
||||
Dim UsadosValidados As Boolean = True
|
||||
|
||||
If dtSeleccionadas.Rows.Count > 0 Then
|
||||
Select Case RblTipo.SelectedValue
|
||||
Case "1" 'T O T A L G E N E R A L
|
||||
For Each row As DataRow In dtSeleccionadas.Rows
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Using ObjUsados As New ClsVentas
|
||||
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||
UsadosValidados = False
|
||||
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
If UsadosValidados Then
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
End If
|
||||
|
||||
Next
|
||||
IsTotalxConcepto = False
|
||||
Dim PU As Decimal = dtSeleccionadas.SUM("SubTotal").ToDecimal
|
||||
@@ -27347,7 +27409,22 @@ Partial Class Ventas
|
||||
CalculaTotalesVenta()
|
||||
Case "2" 'T O T A L X R E M I S I O N
|
||||
For Each row As DataRow In dtSeleccionadas.Rows
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Using ObjUsados As New ClsVentas
|
||||
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||
UsadosValidados = False
|
||||
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
If UsadosValidados Then
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
End If
|
||||
|
||||
Next
|
||||
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
|
||||
Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0)
|
||||
@@ -27368,17 +27445,51 @@ Partial Class Ventas
|
||||
For Each row As DataRow In dtSeleccionadas.Rows
|
||||
sb.Append($"{row("CveVentaDetalle").ToString()},")
|
||||
Next
|
||||
For Each row As DataRow In dtSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
For Each row As DataRow In dtSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta", "Fecha", "Folio"}).Rows
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Using ObjUsados As New ClsVentas
|
||||
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||
UsadosValidados = False
|
||||
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
If UsadosValidados Then
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
For Each row As DataRow In dtSeleccionadas.Rows
|
||||
sb.Append($"{row("CveVenta").ToString()},")
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Using ObjUsados As New ClsVentas
|
||||
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||
UsadosValidados = False
|
||||
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
If UsadosValidados Then
|
||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
sb.Remove(sb.Length - 1, 1)
|
||||
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
|
||||
|
||||
If UsadosValidados Then
|
||||
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
|
||||
End If
|
||||
|
||||
sb.Clear()
|
||||
End Select
|
||||
|
||||
@@ -27430,6 +27541,15 @@ Partial Class Ventas
|
||||
ObsPedido.Clear()
|
||||
ObsInv.Clear()
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not UsadosValidados Then
|
||||
If MsgUsados.Length > 0 Then
|
||||
MsgUsados.Remove(MsgUsados.Length - 1, 1)
|
||||
End If
|
||||
Alert($"Las siguientes remisiones no se pueden facturar porque no se ha recibido el usado correspondiente:<br/><b>{MsgUsados.ToString()}<b/>", TipoMensaje.MsgAdvertencia)
|
||||
BtnEmitirImprimir.Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text)
|
||||
@@ -28570,7 +28690,10 @@ Partial Class Ventas
|
||||
Else
|
||||
Row("PorcentajeIVA") = DrPS("IVA")
|
||||
End If
|
||||
Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal) - Row("Descuento").ToString().ToDecimal
|
||||
|
||||
Dim PU = Row("PU").ToString().ToDecimal().RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * PU) - Row("Descuento").ToString().ToDecimal
|
||||
Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal)
|
||||
|
||||
Row("IVA") = Row("PorcentajeIVA").ToString().ToDouble
|
||||
|
||||
Reference in New Issue
Block a user