-
This commit is contained in:
@@ -283,7 +283,7 @@
|
||||
<asp:UpdatePanel runat="server" ID="UpReporteGpsButton" RenderMode="Inline" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="ReporteDispositivos" Visible="False" OnClick="GenerarReporte" data-toggle="tooltip" data-placement="left" runat="server" Text="<i class='fa fa-file-pdf-o'></i> Dispositivos GPS"></asp:LinkButton>
|
||||
<asp:LinkButton ID="ReporteDispositivos" Visible="False" OnClick="GenerarReporte" data-toggle="tooltip" data-placement="left" runat="server" Text="<i class='fa fa-file-pdf-o'></i> PDF"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
@@ -294,7 +294,7 @@
|
||||
<asp:UpdatePanel runat="server" ID="UpReporteGpsExcel" RenderMode="Inline" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkReporteExcel" Visible="False" OnClick="GenerarReporteExcel" data-toggle="tooltip" data-placement="left" runat="server" Text="<i class='fa fa-file-excel-o'></i> Dispositivos GPS"></asp:LinkButton>
|
||||
<asp:LinkButton ID="LnkReporteExcel" Visible="False" OnClick="GenerarReporteExcel" data-toggle="tooltip" data-placement="left" runat="server" Text="<i class='fa fa-file-excel-o'></i> Excel"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
|
||||
@@ -3758,6 +3758,7 @@ Partial Class Clientes
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("NombreUsuario", UsuarioActual.Usuario))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
|
||||
params.Add(New ReportParameter("Cliente", TxtNombre.Text))
|
||||
|
||||
Dim ObjGPS As New ClsGPS
|
||||
Dim tablaReporte As DataTable
|
||||
|
||||
@@ -1776,6 +1776,17 @@ Partial Class PV
|
||||
Moneda = 1
|
||||
End If
|
||||
|
||||
'ELIMINA LOS DETALLES
|
||||
If Not OcurrioError Then
|
||||
Dim DtEliminados As DataTable = TmpDT.FiltraParametros("EliminarDB = True AND CveVentaDetalle > 0", "", {"CveVentaDetalle"})
|
||||
|
||||
For Each Dr1 As DataRow In DtEliminados.Rows
|
||||
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
'Actualizo los parametros de la venta
|
||||
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
|
||||
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
|
||||
@@ -1789,7 +1800,7 @@ Partial Class PV
|
||||
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
|
||||
If Not OcurrioError Then
|
||||
Dim index As Integer = 0
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
For Each Row As DataRow In TmpDT.FiltraParametros("EliminarDB = False").Rows
|
||||
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
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("Obs").ToString, UsuarioActual.CveUsuario) Then
|
||||
@@ -1834,32 +1845,46 @@ Partial Class PV
|
||||
Next
|
||||
End If
|
||||
|
||||
'RECARGA LOS DATOS
|
||||
ObjFactura.Dispose()
|
||||
ObjFactura = Nothing
|
||||
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
|
||||
|
||||
'ELIMINA LOS DETALLES
|
||||
If Not OcurrioError Then
|
||||
Dim DtEliminados As DataTable = TmpDT.FiltraParametros("EliminarDB = True AND CveVentaDetalle > 0", "", {"CveVentaDetalle"})
|
||||
If ObjFactura Is Nothing Then
|
||||
OcurrioError = True
|
||||
Else
|
||||
TmpDT = ObjFactura.DtDetalle
|
||||
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||
|
||||
For Each Dr1 As DataRow In DtEliminados.Rows
|
||||
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
|
||||
OcurrioError = True
|
||||
Dim NumRowsPS As Integer = 0
|
||||
Dim CantidadPS As Decimal = 0
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
NumRowsPS += 1
|
||||
CantidadPS += GvRow.DataKey("Cantidad").ToDecimal()
|
||||
End If
|
||||
Next
|
||||
|
||||
'VALIDA NUMERO DE REGISTROS
|
||||
If TmpDT.Rows.Count <> NumRowsPS Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'VALIDA CANTIDAD DE REGISTROS
|
||||
If TmpDT.SUM("Cantidad") <> CantidadPS Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'RECARGA LOS DATOS
|
||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||
TmpDT = ObjVentas.DtResultados.Copy()
|
||||
ObjFactura.DtDetalle = TmpDT
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'GUARDA USADOS
|
||||
If Not ObjVentas.EliminarUsados(CveVenta) Then
|
||||
If Not OcurrioError AndAlso Not ObjVentas.EliminarUsados(CveVenta) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If TmpDTRecepcionUsados IsNot Nothing Then
|
||||
If Not OcurrioError AndAlso TmpDTRecepcionUsados IsNot Nothing Then
|
||||
For Each drow As DataRow In TmpDTRecepcionUsados.Rows
|
||||
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then
|
||||
OcurrioError = True
|
||||
@@ -1869,11 +1894,11 @@ Partial Class PV
|
||||
End If
|
||||
|
||||
'GUARDAR AJUSTES'
|
||||
If Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then
|
||||
If Not OcurrioError AndAlso Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
||||
If Not OcurrioError AndAlso TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
||||
For Each Dr As DataRow In TmpDTAjustes.Rows
|
||||
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
|
||||
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
||||
@@ -1884,11 +1909,11 @@ Partial Class PV
|
||||
End If
|
||||
|
||||
'GUARDAR POLIZA VIRTUAL
|
||||
If Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then
|
||||
If Not OcurrioError AndAlso Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If TmpDTPolizaVirtual IsNot Nothing Then
|
||||
If Not OcurrioError AndAlso TmpDTPolizaVirtual IsNot Nothing Then
|
||||
For Each drow As DataRow In TmpDTPolizaVirtual.Rows
|
||||
If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
|
||||
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
|
||||
@@ -2758,13 +2783,18 @@ Partial Class PV
|
||||
|
||||
#Region "GVPS"
|
||||
Protected Sub GvPS_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvPS.RowDeleting
|
||||
|
||||
Dim DbRow As DataRow = Nothing
|
||||
DbRow = TmpDT.Rows(e.RowIndex)
|
||||
|
||||
EliminarUsados(DbRow("Consec").ToString().ToEntero())
|
||||
Me.CveVentaDetalle = DbRow("CveVentaDetalle").ToString().ToEntero()
|
||||
|
||||
TmpDT.Rows.Remove(DbRow)
|
||||
If Me.CveVentaDetalle <= 0 Then
|
||||
EliminarUsados(DbRow("Consec").ToString().ToEntero())
|
||||
TmpDT.Rows.Remove(DbRow)
|
||||
Else
|
||||
EliminarUsados()
|
||||
DbRow("EliminarDB") = True
|
||||
End If
|
||||
|
||||
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
@@ -2774,6 +2804,9 @@ Partial Class PV
|
||||
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
|
||||
Me.CveVentaDetalle = -1
|
||||
|
||||
|
||||
UpContado.Update()
|
||||
End Sub
|
||||
Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound
|
||||
|
||||
@@ -6281,6 +6281,14 @@ Partial Class Ventas
|
||||
e.Row.FCCheckBox("cbInv").Enabled = False
|
||||
End If
|
||||
|
||||
'SI DEBE HACER SALIDA DIRECTA DE ALMACEN DEBE ESTAR SELECCIONADO SIEMPRE
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
|
||||
e.Row.FCCheckBox("cbInv").Checked = True
|
||||
If UsuarioActual.CveEmpresa = 141 Then
|
||||
e.Row.FCCheckBox("cbInv").Enabled = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If (CveVenta > 0 And DdlTipoComprobante.SelectedValue <> "Cot") AndAlso Not AplicaDevolucion Then
|
||||
@@ -11197,6 +11205,15 @@ Partial Class Ventas
|
||||
Next
|
||||
End If
|
||||
|
||||
'EN ECONOLLANTAS DEBE REALIZAR SIEMPRE LA SALIDA DE ALMACEN
|
||||
If UsuarioActual.CveEmpresa = 141 AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
||||
For Each GvRow As GridViewRow In GvInv.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
GvRow.FCCheckBox("cbInv").Checked = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
|
||||
|
||||
Dim Filtro As String = ""
|
||||
@@ -11299,6 +11316,11 @@ Partial Class Ventas
|
||||
i = i + 1
|
||||
Next
|
||||
|
||||
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
|
||||
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN
|
||||
If Not OcurrioError Then
|
||||
Dim DtCostos As DataTable = Nothing
|
||||
@@ -19505,30 +19527,11 @@ Partial Class Ventas
|
||||
Public Sub LbDescargarExcel_Click(sender As Object, e As EventArgs) Handles LbDescargarExcelVentas.Click
|
||||
DescargarFormato()
|
||||
End Sub
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String, FileUrl As String)
|
||||
Dim dt As New DataTable
|
||||
Dim Conexion As Odbc.OdbcConnection = Nothing
|
||||
Dim ErrorArchivo = False
|
||||
Dim n As Integer = 0
|
||||
Try
|
||||
Select Case Tipo
|
||||
Case "EXCEL"
|
||||
Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";")
|
||||
Conexion.Open()
|
||||
Dim cmd = Conexion.CreateCommand()
|
||||
cmd.CommandType = CommandType.Text
|
||||
cmd.CommandText = "Select * FROM [Hoja1$] WHERE Cantidad >=1"
|
||||
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
|
||||
DataAdapter.Fill(dt)
|
||||
Case Else
|
||||
Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un Error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
Conexion.Close()
|
||||
dt = ReadExcelFile(FileUrl, True)
|
||||
If Not ErrorArchivo Then
|
||||
If Not dt.Columns(0).ColumnName = "Cantidad" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Cantidad'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
@@ -19577,6 +19580,7 @@ Partial Class Ventas
|
||||
Dim RowNoEncontrados As String = ""
|
||||
Dim NumAgregados As Integer = 0
|
||||
For Each Row As DataRow In dt.Rows
|
||||
NumAgregados = NumAgregados + 1
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal
|
||||
Dim UM As String = Row("UM").ToString()
|
||||
Dim Codigo As String = Row("Código").ToString().Trim.ToUpper
|
||||
@@ -19728,7 +19732,7 @@ Partial Class Ventas
|
||||
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
|
||||
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch
|
||||
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
CargarArchivo(Directorio, file.filename, Tipo)
|
||||
CargarArchivo(Directorio, file.filename, Tipo, file.FileUrl)
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
End If
|
||||
@@ -25504,4 +25508,7 @@ Partial Class Ventas
|
||||
Protected Sub btnupEventoBitacora_Click(sender As Object, e As EventArgs)
|
||||
CargaEventoBitacora()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user