This commit is contained in:
2024-02-19 20:04:43 -07:00
11 changed files with 399 additions and 96 deletions

View File

@@ -204,9 +204,28 @@ Public Class ClsTransportes
Return Retorno
End Function
#End Region
End Function
Public Function GetRemisionBoleto(CveViajePasajero As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Trans_ViajesPasajerosVentaGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener la remisión del boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
#Region "Destinos"
Public Function GetDestinos(Optional CveSubProyecto As Integer = 0) As Boolean
Dim Retorno As Boolean = False

View File

@@ -880,6 +880,25 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function UpdateBoletosVenta(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasBoletosUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al cancelar los boletos de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer,
Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0,
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1",
@@ -1428,7 +1447,7 @@ Public Class ClsVentas
Optional CveContratoDetalle As Integer = -1, Optional PorcentajeIVA As Decimal = 0, Optional IEPS As Decimal = -1, Optional PorcentajeIEPS As Double = 0, Optional CvePromocionDetalle As Integer = -1,
Optional CveMovimientoDetallePedido As Integer = -1, Optional ImporteRetIVA As Decimal = 0, Optional PorcentajeRetIVA As Double = 0,
Optional ImporteRetISR As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional CuentaPredial As String = "", Optional CvePrecioLista As Integer = -1, Optional CveActivoFijo As Integer = -1,
Optional NumTurnos As Decimal = 0D, Optional EstatusAlmacen As Integer = 0, Optional CantidadConversion As Decimal = 0) As Boolean
Optional NumTurnos As Decimal = 0D, Optional EstatusAlmacen As Integer = 0, Optional CantidadConversion As Decimal = 0, Optional CveViajePasajero As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasDetalleAdd")
@@ -1463,6 +1482,7 @@ Public Class ClsVentas
.Add("@NumTurnos", SqlDbType.Decimal).Value = NumTurnos
.Add("@EstatusAlmacen", SqlDbType.Int).Value = EstatusAlmacen
.Add("@CantidadConversion", SqlDbType.Decimal).Value = CantidadConversion
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
End With
Try

View File

@@ -1274,7 +1274,7 @@ Namespace Modelos
ObjFactura.FechaEjecucion = DateTime.Today
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
ObjFactura.CondicionesPago = 0
ObjFactura.TipoDocumento = "Factura"
ObjFactura.TipoDocumento = ObjFactura.TipodeComprobante
'Totales, Y se llena TmpDTImpuestos
'CLIENTE
@@ -1445,6 +1445,9 @@ Namespace Modelos
TmpDT.Columns.Add("NumTurnos", GetType(Decimal))
TmpDT.Columns("NumTurnos").DefaultValue = 0
TmpDT.Columns.Add("CveViajePasajero", GetType(Integer))
TmpDT.Columns("CveViajePasajero").DefaultValue = -1
Return TmpDT
End Function
@@ -1452,7 +1455,8 @@ Namespace Modelos
Optional CveUM As Integer = -1, Optional CveProyecto As Integer = -1, Optional Proyecto As String = "",
Optional CveSubProyecto As Integer = -1,
Optional SubProyecto As String = "", Optional PorcentajeIVA As Decimal = -1,
Optional CuentaPredial As String = "", Optional CveVentaDetallePadre As Integer = -1, Optional CveVentaDetalleRemision As Integer = -1) As Boolean
Optional CuentaPredial As String = "", Optional CveVentaDetallePadre As Integer = -1,
Optional CveVentaDetalleRemision As Integer = -1, Optional CveViajePasajero As Integer = -1) As Boolean
If Not CvePS > 0 Then
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
@@ -1649,6 +1653,7 @@ Namespace Modelos
Row("AFValorInicial") = 0
Row("NumTurnos") = 0
Row("CveViajePasajero") = CveViajePasajero
Me.DtDetalle.Rows.Add(Row)
@@ -1661,6 +1666,7 @@ Namespace Modelos
Me.RetIVA = Me.DtDetalle.SUMD("ImporteRetIVA")
Me.RetISR = Me.DtDetalle.SUMD("ImporteRetISR")
Me.IEPS = Me.DtDetalle.SUMD("ImporteIEPS")
Me.Descuento = Me.DtDetalle.SUMD("Descuento")
Me.Total = Me.SubTotal + Me.IVA + Me.IEPS - (Me.RetIVA + Me.RetISR)
End Sub
@@ -2202,6 +2208,14 @@ Namespace Modelos
'Se agregan los PS
For Each Row As DataRow In TmpDTDetalle.Rows
Dim CveViajePasajero As Integer = -1
'VERIFICA QUE EXISTA LA COLUMNA
If TmpDTDetalle.Columns("CveViajePasajero") IsNot Nothing Then
CveViajePasajero = Row("CveViajePasajero").ToString().ToEntero()
End If
If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("CveUM").ToString.ToEntero,
Row("PU").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
Row("Obs").ToString, Row("Descuento").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero,
@@ -2210,7 +2224,7 @@ Namespace Modelos
IEPS:=Row("ImporteIEPS").ToString.ToDecimal, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero,
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDecimal, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDecimal,
PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDecimal, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDecimal, CuentaPredial:=Row("CuentaPredial").ToString,
PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal) Then
PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, CveViajePasajero:=CveViajePasajero) Then
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Exit For
Else
@@ -5209,6 +5223,77 @@ Namespace Modelos
End If
End Function
Public Function CancelarBoleto(CveViajePasajero As Integer) As Boolean
Dim TieneError As Boolean = False
If Me.CveVenta > 0 Then
Dim ObjVentas As New ClsVentas()
Dim ObjTransportes As New ClsTransportes(ObjVentas.IniciaTransacSQL())
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Try
Dim Row As DataRow = Me.DtDetalle.Select($"CveViajePasajero={CveViajePasajero}").FirstOrDefault()
If Row IsNot Nothing Then
Row("Descuento") = Row("Total")
Row("Obs") = "CANCELADO"
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Descuento").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then
TieneError = True
End If
If Not TieneError Then
If Not ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, Activar:=False, Estatus:=False) Then
TieneError = True
End If
End If
Me.CalculaTotales()
If Not TieneError Then
If Not ObjVentas.UpdateVentas(Me.SubTotal, Me.Descuento, Me.IVA, Me.IEPS, Me.Total, Me.CveMoneda, Me.TipoCambio, Me.Fecha, Me.Observaciones,
UsuarioActual.CveEmpresa, Me.CveVenta, TipoDocto:=Me.TipoDocto) Then
TieneError = True
End If
End If
If Not TieneError Then
TieneError = Not RegenerarPrePolizas(ObjVentas.IniciaTransacSQL())
End If
If Not TieneError Then
If ObjConta.ValidacionesPrePoliza(-1, UsuarioActual, Opcion:=2, CveVenta:=CveVenta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
If ObjConta.ValorPolizaDescuadre = 2 Then
TieneError = True
Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError)
End If
End If
End If
End If
End If
Catch ex As Exception
TieneError = True
GuardaLog(ex.ToString())
End Try
If TieneError Then
ObjVentas.RollBack()
Else
ObjVentas.Commit()
End If
ObjVentas.Dispose()
ObjTransportes.Dispose()
ObjConta.Dispose()
End If
Return Not TieneError
End Function
Private Shared Function DecodeBase64(ByVal strXMLCodificado As String) As String
Try
Dim decbuff As Byte() = Convert.FromBase64String(strXMLCodificado)
@@ -5246,8 +5331,8 @@ Namespace Modelos
''' Cancela la factura para poder realizar la refacturacion
''' </summary>
''' <returns></returns>
Public Function CancelarPorRefacturacion(CveMotivoCancelacion As Integer, Motivo As String, Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = False, Optional CveEstadoCancelacion As Integer = 0, Optional CveEstatusFacturaAsignado As Integer = -1) As MCancelacionVentaMensaje
Return CancelarVenta(Me, Me.UsuarioActual, EsRefacturacion:=True, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, FolioSustitucion:=FolioSustitucion, ValidarSAT:=ValidarSAT, CveEstadoCancelacion:=CveEstadoCancelacion, CveEstatusFacturaAsignado:=CveEstatusFacturaAsignado)
Public Function CancelarPorRefacturacion(CveMotivoCancelacion As Integer, Motivo As String, Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = False, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
Return CancelarVenta(Me, Me.UsuarioActual, EsRefacturacion:=True, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, FolioSustitucion:=FolioSustitucion, ValidarSAT:=ValidarSAT, CveEstadoCancelacion:=CveEstadoCancelacion)
End Function
''' <summary>
''' Cancela la factura y realiza las operaciones correspondientes
@@ -5255,15 +5340,15 @@ Namespace Modelos
''' <param name="RealizarDevolucionAlmacen"></param>
''' <param name="ListaRemisionesCancelar"></param>
''' <returns></returns>
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje
'Comprobante emitido con errores sin relación
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion)
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos)
End Function
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False,
Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveEstatusFacturaAsignado As Integer = -1, Optional FechaCancelacion As String = "-1",
Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "",
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje
Dim Retorno As New MCancelacionVentaMensaje()
Dim ErrorList As New List(Of String)
@@ -6434,6 +6519,13 @@ Namespace Modelos
End If
End If
If CancelarBoletos Then
If Not ObjVentas.UpdateBoletosVenta(CveVenta, UsuarioActual.CveEmpresa) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cancelar los boletos."
End If
End If
If CancelarRemisiones Then
If SeCancelaRemisionProceso Then
@@ -8055,7 +8147,7 @@ Namespace Modelos
Public Property Giro As String
Public Property CvePrecioLista As Integer
Public Property EnviarFactura As String
Public Property CveSucursal As Integer
Public Property CveSubProyecto As Integer
Public Property RetIVA As Decimal
Public Property RetISR As Decimal
Public Property IEPS As Decimal

View File

@@ -163,8 +163,8 @@
<label for="<%= TxtNumeroRegistro.ClientID.ToString()%>">Número de Registro:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlProveedor" CssStyle="width: 100%;" CssClassDdl="select2me " DataTextField="NombreCortoProveedor" DataValueField="CveProveedor" />
<label for="<%= DdlProveedor.ClientID.ToString()%>">Proveedor:</label>
<label style=" margin-bottom: 0;font-size: 13px;color: #888888; opacity: 1;">Proveedor:</label>
<ADS:Dropdownlost runat="server" ID="DdlProveedor" CssStyle="width: 100%;" CssClassDdl="select2me " DataTextField="NombreCortoProveedor" DataValueField="CveProveedor" />
</div>
<div class="form-group form-md-line-input input-iconright ocultar">
<asp:DropDownList ID="DdlTipoCobro" CssClass="form-control select2me" runat="server" AppendDataBoundItems="true" Style="width: 100%">

View File

@@ -1,4 +1,4 @@


using System;
using System.Collections.Generic;
using System.Linq;
@@ -78,4 +78,26 @@
CveHuerta = gvRow.DataKey("CveHuerta").ToEntero();
TxtHuerhuerta.Text = gvRow.DataKey("Huerta");
TxtImporte.Text = gvRow.DataKey("Importe");
TxtCostoXTonelada.Text = gvRow.DataKey("CostoXTonelada");
TxtNombreRegistro.Text = gvRow.DataKey("NombreRegistro");
TxtNumeroRegistro.Text = gvRow.DataKey("NumeroRegistro");
//DdlProveedor.SelectedValue = objOC.CveProveedor.ToString
// if (gvRow.DataKey("CveProveedor").ToEntero() > 0)
// {
// DdlProveedor.SelectedValueExist(gvRow.DataKey("CveProveedor").ToEntero());
//}
// CveProveedorOriginal = objOC.CveProveedor
// DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString
//Else
// DdlProveedores.SelectedText = "-"
//End If
DdlTipoCobro.SelectedValueExist(gvRow.DataKey("TipoCobro").ToEntero());
ChkHuerestatus.Checked= Convert.ToBoolean(gvRow.DataKey("Estatus"));
RegistraScript("$('#DModalHuerta').modal();");
BtnHuerADD.Visible=false;
BtnHuerEdit.Visible=true;
DivEstatus.Visible = true;
UPModalHuer.Update();
}
protected void LnkAgregarHuer_Click(object sender, EventArgs e)

View File

@@ -3400,7 +3400,7 @@ Partial Class Compras_Compras
End Sub
Private Sub CargaTiposAF()
ViewState("TmpDTTiposAF") = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa)
ViewState("TmpDTTiposAF") = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).Copy()
Dim Row As DataRow = DirectCast(ViewState("TmpDTTiposAF"), DataTable).NewRow()
Row("CveTipoActivoFijo") = -1 : Row("TipoActivoFijo") = "Seleccione"
DirectCast(ViewState("TmpDTTiposAF"), DataTable).Rows.InsertAt(Row, 0)

View File

@@ -42,6 +42,8 @@
<asp:ListItem Value="13" Text="Anticipo Proveedores"></asp:ListItem>
<asp:ListItem Value="2" Text="Clientes"></asp:ListItem>
<asp:ListItem Value="4" Text="Factura - Cliente"></asp:ListItem>
<asp:ListItem Value="17" Text="Factura - Cliente Detalle"></asp:ListItem>
<asp:ListItem Value="14" Text="Anticipo Clientes"></asp:ListItem>
<asp:ListItem Value="5" Text="Productos y Sevicios" ></asp:ListItem>
<asp:ListItem Value="16" Text="Clasificaciones" Enabled="True"></asp:ListItem>

View File

@@ -225,7 +225,7 @@ Partial Class General_SaldosIniciales
ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "4" Then
ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "4" Or RblFormato.SelectedValue = "17" Then
If Not dt.Columns(0).ColumnName = "Sucursal" Then
Alert("El nombre de la primera columna debe ser 'Sucursal'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
@@ -293,6 +293,16 @@ Partial Class General_SaldosIniciales
Exit Sub
End If
If Not dt.Columns(15).ColumnName = "Folio Fiscal" Then
Alert("El nombre de la decimosexta columna debe ser 'Folio Fiscalo'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(16).ColumnName = "PorcentajeIVA" Then
Alert("El nombre de la decimoséptima columna debe ser 'PorcentajeIVA'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
'If RblFormato.SelectedValue = "4" Then
' If Not dt.Columns(15).ColumnName = "ImpuestoLocal" Then
' Alert("El nombre de la diesciseisava columna debe ser 'ImpuestoLocal'. Favor de corregirlo", TipoMensaje.MsgError)
@@ -305,6 +315,31 @@ Partial Class General_SaldosIniciales
' End If
'End If
If RblFormato.SelectedValue = "17" Then
If Not dt.Columns(17).ColumnName = "Cantidad" Then
Alert("El nombre de la Decimoctava columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(18).ColumnName = "PU" Then
Alert("El nombre de la Decimonovena columna debe ser 'PU'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(19).ColumnName = "IVA" Then
Alert("El nombre de la Vigésima columna debe ser 'IVA'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(20).ColumnName = "IEPS" Then
Alert("El nombre de la Vigésimo primera columna debe ser 'IEPS'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
End If
ElseIf RblFormato.SelectedValue = "5" Then
@@ -1571,7 +1606,7 @@ Partial Class General_SaldosIniciales
#End Region
'C L I E N T E S - F A C T U R A S
ElseIf RblFormato.SelectedValue = "4" Then
ElseIf RblFormato.SelectedValue = "4" Or RblFormato.SelectedValue = "17" Then
#Region "C L I E N T E S - F A C T U R A S"
@@ -1626,7 +1661,9 @@ Partial Class General_SaldosIniciales
Dim CveMoneda As Integer = 1
Dim Vendedor As String = If(dt.Columns.Contains("Vendedor"), Row("Vendedor").ToString(), "")
Dim CveVendedor As Integer = 0
Dim IEPS As Decimal = 0 'Row("IEPS").ToString().ToDecimal
Dim CveClienteSucursal As Integer = 0 'Row("CveClienteSucursal").ToString().ToEntero()
Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString(), "")
Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString().ToDecimal, 4), 0)
@@ -1640,6 +1677,16 @@ Partial Class General_SaldosIniciales
Dim Folio2 As String = "" ' Row("Folio2").ToString()
Dim CodCliente As String = "" 'Row("CodCliente2").ToString()
Dim IEPSDetalle As Decimal = 0
Dim CantidadDetalle As Decimal = 0
Dim PUDetalle As Decimal = 0
Dim IVADetalle As Decimal = 0
If RblFormato.SelectedValue = "17" Then
IEPSDetalle = Row("IEPS").ToString.ToDecimal
End If
If dt.Columns.Contains("Cliente Sucursal") AndAlso Row("Cliente Sucursal").ToString() <> "" Then
Dim ObjCliente As New ClsClientes
@@ -1710,10 +1757,25 @@ Partial Class General_SaldosIniciales
End If
CveVenta = ObjVentas.CveVenta
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=0) Then
ErrorVentas = True
Exit For
If RblFormato.SelectedValue = "17" Then
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle * CantidadDetalle, IVADetalle, (PUDetalle * CantidadDetalle) + IVADetalle - IEPSDetalle, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0,
PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle) Then
ErrorVentas = True
Exit For
End If
Else
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=0) Then
ErrorVentas = True
Exit For
End If
End If
Dim ConceptoContable As Integer = 1
Dim ConceptoContablePago As Integer = 2
If TipoDocto = "Egs" Then
@@ -2980,6 +3042,8 @@ Partial Class General_SaldosIniciales
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoBancos.xlsx"
ElseIf RblFormato.SelectedValue = "16" Then
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoClasificaciones.xlsx"
ElseIf RblFormato.SelectedValue = "17" Then
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoClientes-Facturas-Detalles.xlsx"
End If
If Not (Directorio = "") Then

View File

@@ -79,7 +79,7 @@ Partial Class OS_Asignaciones
RegistraScript("
$('#GvNA tr').each(function() {
$(this).find('td:eq(8) input').each(function() {
$(this).find('td:eq(6) input').each(function() {
if($(this).val()!=':'){
$(this).attr('style', 'width: 20px;');
}else{
@@ -518,8 +518,8 @@ Partial Class OS_Asignaciones
Dim TMSelector = DirectCast(e.Row.FindControl("TimeSelector"), TimeSelector)
TMSelector.Date = FechaCita
e.Row.Cells(7).Attributes.Add("data-order", e.Row.DBCampo("FechaCitaOS").ToDate.Ticks.ToString)
e.Row.Cells(8).Attributes.Add("data-order", e.Row.DBCampo("FechaCitaOS").ToDate.ToString("HHmm"))
e.Row.Cells(9).Attributes.Add("data-order", e.Row.DBCampo("FechaCitaOS").ToDate.Ticks.ToString)
e.Row.Cells(10).Attributes.Add("data-order", e.Row.DBCampo("FechaCitaOS").ToDate.ToString("HHmm"))
End If

View File

@@ -79,11 +79,13 @@ Partial Class Boletos
Dim ObjViaje As New ClsTransportes
If ObjContratos.GetContratos(CveViaje, UsuarioActual.CveEmpresa) Then
Contrato = ObjContratos.DtResultados
Contrato = ObjContratos.DtResultados.Copy()
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
DtPasajeros = New DataTable
DtPasajeros.Columns.Add("CveViajePasajero", GetType(Integer))
DtPasajeros.Columns.Add("Numero", GetType(Integer))
DtPasajeros.Columns.Add("Nombre", GetType(String))
DtPasajeros.Columns.Add("Visa", GetType(String))
@@ -115,6 +117,9 @@ Partial Class Boletos
End If
End If
ObjContratos.Dispose()
ObjViaje.Dispose()
Else
ObjContratos.Dispose()
ObjViaje.Dispose()
@@ -122,8 +127,6 @@ Partial Class Boletos
Response.Redirect($"~/Transportes/RepContratos.aspx")
End If
ObjContratos.Dispose()
ObjViaje.Dispose()
'Boletos Vendidos
@@ -172,16 +175,16 @@ Partial Class Boletos
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
End If
If ImporteR > 0 Then
ViewState("Importe") = ImporteR
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
LbCostos.Visible = True
BtnAgregarPasajero.Visible = True
Else
ViewState("Importe") = 0
BtnAgregarPasajero.Visible = False
LbCostos.Visible = False
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
End If
ViewState("Importe") = ImporteR
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
LbCostos.Visible = True
BtnAgregarPasajero.Visible = True
Else
ViewState("Importe") = 0
BtnAgregarPasajero.Visible = False
LbCostos.Visible = False
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
End If
ObjDestinos.Dispose()
@@ -231,9 +234,15 @@ Partial Class Boletos
Sexo = dr("CveSexo").ToString.ToBool
Obs = dr("Observaciones").ToString
If ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
ObjTransporte.Commit()
Dim CveViajePasajero = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
If CveViajePasajero < 1 Then
TieneError = True
SbAlert.Append("Ocurrió un error al generar el viaje")
Exit For
End If
dr("CveViajePasajero") = CveViajePasajero
Next
@@ -245,8 +254,11 @@ Partial Class Boletos
TieneError = Retorno.TieneError
If Not TieneError Then
If Retorno.CveVenta > 0 AndAlso Not Retorno.TieneError Then
SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
If Not Retorno.TieneError Then
If Retorno.CveVenta <= 0 Then
Retorno.TieneError = True
End If
Else
TieneError = True
SbAlert.Append("Ocurrió un error al generar la factura")
@@ -259,6 +271,12 @@ Partial Class Boletos
Else
TieneError = True
End If
Else
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
For Each Mensaje As String In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", Mensaje)
Next
End If
End If
Else
TieneError = True
@@ -278,19 +296,26 @@ Partial Class Boletos
ObjTransporte.RollBack()
ObjTransporte.Dispose()
Else
SbAlert.Append("El boleto se genero correctamente.")
DtPasajeros.Clear()
ObjTransporte.Commit()
ObjTransporte.Dispose()
DdlPartida.SelectedValueExist("-1")
DdlDestino.SelectedValueExist("-1")
SbAlert.Append("El boleto se genero correctamente.")
DtPasajeros.Clear()
GvB.DataSource = DtPasajeros
GvB.DataBind()
DdlPartida.SelectedIndex = -1
'DdlPartida.SelectedValueExist("-1")
DdlDestino.SelectedIndex = -1
'DdlDestino.SelectedValueExist("-1")
AsientoSeleccionado = ""
CargaDatos()
End If
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
End Try
UpPanel.Update()
@@ -369,48 +394,70 @@ Partial Class Boletos
End Sub
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim Retorno As New Modelos.Factura.MMensajeFactura
Dim CveCliente As Integer = 1154164
Dim CveMoneda As Integer = 2
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
Dim CveSubProyecto As Integer = -1
Dim CvePSBoleto As Integer = 912720
If EsProduccion Then
CvePSBoleto = 986337
CveCliente = 1172306
End If
If CveCliente <= 0 Then
Retorno.Mensajes.Add("No se pudo cargar el cliente")
Return Retorno
End If
If CveSubProyecto <= 0 Then
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
Return Retorno
End If
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, -1, CveCliente, CveMoneda, "Rem")
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
If ObjFactura IsNot Nothing Then
'TOMA EL SUBPROYECTO DEL CLIENTE
CveSubProyecto = ObjFactura.Cliente.CveSubProyecto
Dim CvePSBoleto As Integer = 912720
For Each Dr As DataRow In DtPasajeros.Rows
Dim Obs = Dr("Nombre").ToString
Dim Importe = Dr("Importe").ToString.ToDecimal()
If Importe <= 0 Then
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
If CveSubProyecto <= 0 Then
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
Return Retorno
End If
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0)
Next
ObjFactura.CveSubProyecto = CveSubProyecto
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
ObjFactura.SetSubProyecto()
ObjFactura.SetSubProyectoMatriz()
ObjFactura.CalculaTotales()
For Each Dr As DataRow In DtPasajeros.Rows
Dim Obs = Dr("Observaciones").ToString
Dim Importe = Dr("Importe").ToString.ToDecimal()
Try
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
Catch ex As Exception
Retorno = Nothing
GuardaLog(ex.ToString())
End Try
If Importe <= 0 Then
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
Return Retorno
End If
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
If Not ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0, CveViajePasajero:=Dr("CveViajePasajero").ToString().ToEntero()) Then
Retorno.Mensajes.Add("No se pudo agregar el producto")
Return Retorno
End If
Next
ObjFactura.CalculaTotales()
Try
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
Catch ex As Exception
Retorno = Nothing
GuardaLog(ex.ToString())
End Try
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
End If
Else
Retorno.Mensajes.Add("No se pudo generar la factura")
End If
Return Retorno

View File

@@ -1,5 +1,6 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports ADSNetLibrary.Helpers
Imports ADSNetLibrary.SIGAPI.Helpers
@@ -32,16 +33,10 @@ Partial Class ListadoBoletos
CveViaje = Request.QueryString("CveViaje").ToEntero
Ruta = IfNull(Request("Ruta"), "").ToString
LblViaje.Text = Ruta
InicializaCombos()
CargaDatos()
End If
End Sub
Private Sub InicializaCombos()
End Sub
Private Sub CargaDatos()
Dim ObjTransportes As New ClsTransportes
If ObjTransportes.GetViajesPasajeros(CveViaje) Then
@@ -82,26 +77,68 @@ Partial Class ListadoBoletos
Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveViajePasajero As String = GvRow.DataKey("CveViajePasajero")
Dim CveViajePasajero As Integer = GvRow.DataKey("CveViajePasajero").ToEntero()
Dim Estatus As String = GvRow.DataKey("Estatus")
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
Dim ObjTransportes As New ClsTransportes
ObjTransportes.IniciaTransacSQL()
Try
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
If Not cambiarEstatus Then
Alert($"El boleto ha sido cancelado correctamente.")
Else
Alert($"El boleto ha sido reactivado correctamente.")
End If
End If
ObjTransportes.Commit()
Catch ex As Exception
ObjTransportes.RollBack()
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
Dim TieneError As Boolean = False
Try
Dim DtRem As DataTable = Nothing
Dim ObjTran As New ClsTransportes
If ObjTran.GetRemisionBoleto(CveViajePasajero.ToEntero, UsuarioActual.CveEmpresa) Then
DtRem = ObjTran.DtResultados.Copy()
End If
ObjTran.Dispose()
If DtRem IsNot Nothing Then
If DtRem.Rows.Count > 0 Then
Dim CveVenta As Integer = DtRem.Rows(0)("CveVenta").ToString().ToEntero()
Dim BoletosVigentes As Integer = DtRem.Rows(0)("BoletosVigentes").ToString().ToEntero()
If CveVenta > 0 Then
Dim ObjRem As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False)
If ObjRem.DtDetalle.Rows.Count > 0 Then
'SI SOLO TIENE UNA PARTIDA CANCELAR LA REMISION
If ObjRem.DtDetalle.Rows.Count = 1 OrElse BoletosVigentes <= 1 Then
Dim RespCancelacion = ObjRem.CancelarFactura(False, ValidarSAT:=False, CancelarBoletos:=True, ListaRemisionesCancelar:=New List(Of Integer))
If RespCancelacion IsNot Nothing Then
TieneError = RespCancelacion.HuboError
Else
TieneError = True
End If
Else
TieneError = Not ObjRem.CancelarBoleto(CveViajePasajero)
End If
Else
TieneError = True
End If
End If
Else
'SI NO TIENE VENTA, SOLO CANCELAR EL BOLETO
Dim ObjTran2 As New ClsTransportes
If Not ObjTran2.UpdateViajesPasajeros(CveViajePasajero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
TieneError = True
End If
ObjTran2.Dispose()
End If
End If
Catch ex As Exception
TieneError = True
GuardaLog(ex.ToString())
Finally
ObjTransportes.Dispose()
If TieneError Then
Alert($"Ocurrió un error al cancelar el boleto.", TipoMensaje.MsgError)
Else
Alert($"El boleto ha sido cancelado correctamente.")
End If
CargaDatos()
End Try
End Sub
End Class