diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb
index 658e42ace..25aefb9ca 100644
--- a/App_Code/ClsOIEventos.vb
+++ b/App_Code/ClsOIEventos.vb
@@ -219,6 +219,109 @@ Public Class ClsOIEventos
Public Property objCorreo As ObjEventosCorreo
#End Region
+#Region "uno a uno"
+ Public Function GetUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32, cveEmpresa As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_GetUnoaUnoEtiqueta", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta)
+ .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+ Public Function AddUnoaUnoEtiqueta(etiqueta As String, cveUnoaUnoEtiquetaVinculo As Int32, cveGrupo As Int32, cveEmpresa As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_AddUnoaUnoEtiqueta", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@etiqueta", SqlDbType.VarChar).Value = (etiqueta)
+ .Add("@cveUnoaUnoEtiquetaVinculo", SqlDbType.Int).Value = (cveUnoaUnoEtiquetaVinculo)
+ .Add("@cveGrupo", SqlDbType.Int).Value = (cveGrupo)
+ .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+ Public Function UpUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32, etiqueta As String, cveUnoaUnoEtiquetaVinculo As Int32, cveGrupo As Int32, cveEmpresa As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_UpUnoaUnoEtiqueta", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta)
+ .Add("@etiqueta", SqlDbType.VarChar).Value = (etiqueta)
+ .Add("@cveUnoaUnoEtiquetaVinculo", SqlDbType.Int).Value = (cveUnoaUnoEtiquetaVinculo)
+ .Add("@cveGrupo", SqlDbType.Int).Value = (cveGrupo)
+ .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al actualizar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+ Public Function RemoveUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_RemoveUnoaUnoEtiqueta", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al eliminar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+
+ Public Function UnoAUnoTableroGet(cveEmpresa As Int32, fecha As String, cveUsuario As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_UnoAUnoTableroGet", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Fecha", SqlDbType.Date).Value = (fecha)
+ .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario)
+ .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el Tablero Uno A Uno.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return retorno
+ End Function
+ Public Function UnoAUnoTableroAdd(cveEmpresa As Int32, fecha As String, cveUsuario As Int32, CveUnoaUnoEtiqueta As Integer, Comentarios As String) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_OI_UnoAUnoADD", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Fecha", SqlDbType.Date).Value = (fecha)
+ .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario)
+ .Add("@CveUnoaUnoEtiqueta", SqlDbType.Int).Value = (CveUnoaUnoEtiqueta)
+ .Add("@Comentarios", SqlDbType.VarChar).Value = (Comentarios)
+ .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa)
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el Tablero Uno A Uno.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return retorno
+ End Function
+#End Region
#Region "Trello"
Public Function GetTablero(cveTablero As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean
Dim retorno As Boolean = False
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index f0f9ee342..0aec0a4c6 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -3585,6 +3585,8 @@ Public Class ClsPaginas
PaginaDict.Add("/OI/Proyecto.aspx".ToUpper(), -1)
PaginaDict.Add("/OI/Tablero.aspx".ToUpper(), -1)
PaginaDict.Add("/OI/TableroDetalle.aspx".ToUpper(), -1)
+ PaginaDict.Add("/OI/UnoaUno.aspx".ToUpper(), -1)
+ PaginaDict.Add("/OI/UnoaUnoConfiguracion.aspx".ToUpper(), -1)
PaginaDict.Add("/OI/ConvocatoriaDetalle.aspx".ToUpper(), -1)
PaginaDict.Add("/OI/RepReuniones.aspx".ToUpper(), -1)
PaginaDict.Add("/AdSistemasTeam/ProcedimientosAlmacenados.aspx".ToUpper(), -1)
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 43b09710e..8d188b934 100644
--- a/OC/OC.aspx.vb
+++ b/OC/OC.aspx.vb
@@ -4811,7 +4811,7 @@ Partial Class OC
Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
For Each fileItem As Archivo In Filesgral
- FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", ModExtensiones.DirectorioBaseEmpresas, fileItem.filename)).Replace(".", "")
+ FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
Filename = fileItem.filename
Next
@@ -6102,7 +6102,7 @@ Partial Class OC
Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
If TxtExcel.getfiles().Archivos.Count > 0 Then
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
- Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch
+ Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
CargarArchivo(Directorio, file.filename, Tipo)
Else
@@ -7509,7 +7509,7 @@ Partial Class OC
Protected Sub BtnCargaExcelCot_Click(sender As Object, e As EventArgs)
If TxtExcelCot.getfiles().Archivos.Count > 0 Then
Dim file As Archivo = TxtExcelCot.getfiles().Archivos(0)
- Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch
+ Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
CargarArchivoCot(Directorio, file.filename)
CargaCotizaciones(CveOrdenCompra)
diff --git a/OI/UnoaUno.aspx b/OI/UnoaUno.aspx
new file mode 100644
index 000000000..e97d18dbe
--- /dev/null
+++ b/OI/UnoaUno.aspx
@@ -0,0 +1,86 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="UnoaUno.aspx.cs" Inherits="OI_UnoaUno" %>
+
+
+
+
+
+
+
+
+
+
+ Tablero Uno a Uno -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OI/UnoaUno.aspx.cs b/OI/UnoaUno.aspx.cs
new file mode 100644
index 000000000..24f90da7a
--- /dev/null
+++ b/OI/UnoaUno.aspx.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Extensiones;
+public partial class OI_UnoaUno : ClsPaginas
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ TxtCFecha.Text = DateTime.Now.ToString("dd/MM/yyyy");
+ LtlusuarioTitulo.Text = UsuarioActual.Nombre;
+ BtnConsultar_Click(null, null);
+ }
+ }
+
+ protected void BtnConsultar_Click(object sender, EventArgs e)
+ {
+ using (ClsOIEventos ObjPA_O = new ClsOIEventos())
+ {
+
+ ObjPA_O.UnoAUnoTableroGet(UsuarioActual.CveEmpresa, TxtCFecha.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario);
+ GVPA_OI_UnoAUnoTableroGet.DataSource = ObjPA_O.DtResultados;
+ ObjPA_O.Dispose();
+ GVPA_OI_UnoAUnoTableroGet.DataBind();
+ }
+ }
+
+ protected void LnkGuardar_Click(object sender, EventArgs e)
+ {
+ string fecha = TxtCFecha.Text.ToDate().ToString("yyyy/MM/dd");
+ bool continuar = true;
+ using (ClsOIEventos ObjPA_O = new ClsOIEventos())
+ {
+ foreach (GridViewRow gvrow in GVPA_OI_UnoAUnoTableroGet.Rows)
+ {
+ if (continuar)
+ {
+ int CveUnoaUnoEtiqueta = gvrow.DataKey("CveUnoaUnoEtiqueta").ToEntero();
+ if (CveUnoaUnoEtiqueta > 0)
+ {
+ string Comentarios = gvrow.FCTextBox("TxtComentarios").Text;
+ continuar = ObjPA_O.UnoAUnoTableroAdd(UsuarioActual.CveEmpresa, fecha, UsuarioActual.CveUsuario, CveUnoaUnoEtiqueta, Comentarios);
+ }
+
+ }
+ }
+
+ }
+ if (continuar)
+ {
+ Alert("Información Actualizada");
+ }
+ }
+}
\ No newline at end of file
diff --git a/OI/UnoaUnoConfiguracion.aspx b/OI/UnoaUnoConfiguracion.aspx
new file mode 100644
index 000000000..583ed8e8e
--- /dev/null
+++ b/OI/UnoaUnoConfiguracion.aspx
@@ -0,0 +1,81 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="UnoaUnoConfiguracion.aspx.cs" Inherits="OI_UnoaUnoConfiguracion" %>
+
+
+
+
+
+
+ Configuración Uno a Uno
+
+
+
+
+
+
+ Etiqueta
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OI/UnoaUnoConfiguracion.aspx.cs b/OI/UnoaUnoConfiguracion.aspx.cs
new file mode 100644
index 000000000..455ba507a
--- /dev/null
+++ b/OI/UnoaUnoConfiguracion.aspx.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Extensiones;
+
+public partial class OI_UnoaUnoConfiguracion : ClsPaginas
+{
+
+ #region Propiedades
+ private int CcveUnoaUnoEtiqueta
+ {
+ get { return (ViewState["CcveUnoaUnoEtiqueta"] == null) ? 0 : Convert.ToInt32(ViewState["CcveUnoaUnoEtiqueta"]); }
+ set { ViewState["CcveUnoaUnoEtiqueta"] = value; }
+ }
+ #endregion
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ CargaUnoaUnoEtiqueta();
+ }
+ }
+ protected void CargaUnoaUnoEtiqueta()
+ {
+ using (ClsOIEventos ObjUnoa = new ClsOIEventos())
+ {
+
+ ObjUnoa.GetUnoaUnoEtiqueta(-1, UsuarioActual.CveEmpresa);
+ GVUnoaUnoEtiqueta.DataSource = ObjUnoa.DtResultados;
+ DdlUnoaetiqueta1.DataSource = ObjUnoa.DtResultados;
+ }
+ GVUnoaUnoEtiqueta.DataBind();
+ DdlUnoaetiqueta1.DataBind();
+ DdlUnoaetiqueta1.Items.Insert(0,new ListItem("Seleccione","-1"));
+ upDatosUnoa.Update();
+ }
+ protected void LimpiaUnoaUnoEtiqueta()
+ {
+ TxtUnoaetiqueta.Text = "";
+ DdlUnoaetiqueta1.SelectedIndex = 0;
+ UPModalUnoa.Update();
+ }
+ protected void LnkEditarUnoa_Click(object sender, EventArgs e)
+ {
+ LimpiaUnoaUnoEtiqueta();
+ ltlUnoatitulo.Text = "Actualizar Etiqueta";
+ GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
+ CcveUnoaUnoEtiqueta = gvRow.DataKey("CveUnoaUnoEtiqueta").ToEntero();
+ string etiqueta = gvRow.DataKey("Etiqueta");
+ int cveUnoaUnoEtiquetaVinculo = gvRow.DataKey("CveUnoaUnoEtiquetaVinculo").ToEntero();
+ int cveGrupo = gvRow.DataKey("CveGrupo").ToEntero();
+ int cveEmpresa = gvRow.DataKey("CveEmpresa").ToEntero();
+
+ TxtUnoaetiqueta.Text = etiqueta.ToString();
+ DdlUnoaetiqueta1.SelectedValue = "-1";
+ DdlUnoaetiqueta1.SelectedValueExist(cveUnoaUnoEtiquetaVinculo.ToString());
+ this.RegistraScript("$('#DModalUnoaUnoEtiqueta').modal();");
+ BtnUnoaADD.Visible = false;
+ BtnUnoaEdit.Visible = true;
+ UPModalUnoa.Update();
+ }
+ protected void LnkAgregarUnoa_Click(object sender, EventArgs e)
+ {
+ ltlUnoatitulo.Text = "Agregar Etiqueta";
+ this.RegistraScript("$('#DModalUnoaUnoEtiqueta').modal();");
+ LimpiaUnoaUnoEtiqueta();
+ BtnUnoaADD.Visible = true;
+ BtnUnoaEdit.Visible = false;
+ UPModalUnoa.Update();
+ }
+ protected void BtnUnoaADD_Click(object sender, EventArgs e)
+ {
+
+ string etiqueta = TxtUnoaetiqueta.Text;
+ int cveUnoaUnoEtiquetaVinculo = DdlUnoaetiqueta1.SelectedValue.ToEntero();
+ int cveGrupo = 1;
+ int cveEmpresa = UsuarioActual.CveEmpresa;
+ bool Continuar = false;
+ using (ClsOIEventos ObjUnoa = new ClsOIEventos())
+ {
+ Continuar=ObjUnoa.AddUnoaUnoEtiqueta(etiqueta, cveUnoaUnoEtiquetaVinculo, cveGrupo, cveEmpresa);
+ }
+ if (Continuar)
+ {
+ this.RegistraScript("$('#DModalUnoaUnoEtiqueta').modal('hide');");
+ LimpiaUnoaUnoEtiqueta();
+ CargaUnoaUnoEtiqueta();
+ UPModalUnoa.Update();
+ this.Alert("La Etiqueta se ha agregado");
+ }
+ }
+ protected void BtnUnoaEdit_Click(object sender, EventArgs e)
+ {
+
+ string etiqueta = TxtUnoaetiqueta.Text;
+ int cveUnoaUnoEtiquetaVinculo = DdlUnoaetiqueta1.SelectedValue.ToEntero();
+ int cveGrupo = 1;
+ int cveEmpresa = UsuarioActual.CveEmpresa;
+ bool Continuar = false;
+ using (ClsOIEventos ObjUnoa = new ClsOIEventos())
+ {
+ Continuar = ObjUnoa.UpUnoaUnoEtiqueta(CcveUnoaUnoEtiqueta, etiqueta, cveUnoaUnoEtiquetaVinculo, cveGrupo, cveEmpresa);
+ }
+ if (Continuar)
+ {
+ this.RegistraScript("$('#DModalUnoaUnoEtiqueta').modal('hide');");
+ LimpiaUnoaUnoEtiqueta();
+ UPModalUnoa.Update();
+ CargaUnoaUnoEtiqueta();
+ this.Alert("La Etiqueta se ha actualizado");
+ }
+ }
+ protected void LnkEliminarUnoa_Click(object sender, EventArgs e)
+ {
+ GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
+ CcveUnoaUnoEtiqueta = gvRow.DataKey("CveUnoaUnoEtiqueta").ToEntero();
+ bool Continuar = false;
+ using (ClsOIEventos ObjUnoa = new ClsOIEventos())
+ {
+
+ Continuar = ObjUnoa.RemoveUnoaUnoEtiqueta(CcveUnoaUnoEtiqueta);
+ }
+ if (Continuar)
+ {
+ CargaUnoaUnoEtiqueta();
+ this.Alert("La Etiqueta se ha Eliminado");
+ }
+ }
+}
diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb
index c010e3d4c..f9ff95c6a 100644
--- a/Ventas/PV.aspx.vb
+++ b/Ventas/PV.aspx.vb
@@ -1789,7 +1789,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("Obs").ToString, UsuarioActual.CveUsuario) Then
@@ -1847,19 +1847,45 @@ Partial Class PV
End If
'RECARGA LOS DATOS
- If ObjVentas.GetVentaDetalle(CveVenta) Then
- TmpDT = ObjVentas.DtResultados.Copy()
- ObjFactura.DtDetalle = TmpDT
- Else
+ ObjFactura.Dispose()
+ ObjFactura = Nothing
+ ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
+
+ If ObjFactura Is Nothing Then
OcurrioError = True
+ Else
+ TmpDT = ObjFactura.DtDetalle
+ TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
+ TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
+
+ 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
+
'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 +1895,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 +1910,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 +2784,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 +2805,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
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index e828f93c6..6f9caf1da 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -19453,28 +19453,29 @@ Partial Class Ventas
End Sub
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
Dim dt As New DataTable
- Dim Conexion As Odbc.OdbcConnection = Nothing
+ '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
" & ex.Message, ex)
- End Try
- Conexion.Close()
+ dt = ReadExcelFile(Ruta + FileName, True)
+ '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
" & ex.Message, ex)
+ 'End Try
+ 'Conexion.Close()
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)
@@ -19523,6 +19524,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
@@ -25444,4 +25446,53 @@ Partial Class Ventas
Protected Sub btnupEventoBitacora_Click(sender As Object, e As EventArgs)
CargaEventoBitacora()
End Sub
+
+ Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) 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 curCol As Integer = 0
+ Dim dataTable As DataTable = New DataTable()
+ Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0)
+
+ For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
+
+ If firstRowHasHeaders Then
+
+ If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
+ dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
+ Else
+ dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
+ End If
+
+ curRow = 1
+ Else
+ dataTable.Columns.Add("Column " & (cols + 1))
+ End If
+ Next
+
+ While curRow < worksheet.Rows.Count
+ columns = New String(cols - 1) {}
+
+ For curCol = 0 To cols - 1
+
+ If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then
+ columns(curCol) = ""
+ Else
+ columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
+ End If
+ Next
+
+ dataTable.Rows.Add(columns)
+ curRow += 1
+ End While
+
+ Return dataTable
+ End Function
+
+
End Class
\ No newline at end of file
diff --git a/WEB.rar b/WEB.rar
index f1421731b..7c07463c9 100644
Binary files a/WEB.rar and b/WEB.rar differ