+
-
-
-
+
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb
index dff5190cb..46b242070 100644
--- a/Ventas/Clientes.aspx.vb
+++ b/Ventas/Clientes.aspx.vb
@@ -10345,20 +10345,24 @@ Partial Class Clientes
If (UsuarioActual.Empresa.Funcionalidad(105) = "1") Then
DdlProveedorLineaAdicionalModal.setEsWebService(True)
DdlProveedorLineaAdicionalModal.Attributes.Add("data-metodo", "getproveedores")
- DdlProveedorLineaAdicionalModal.SelectedText = "Todos"
+ DdlProveedorLineaAdicionalModal.SelectedText = "-"
DdlProveedorLineaAdicionalModal.SelectedValue = "-1"
+ DdlProveedorLineaAdicionalModal.txtText.Value = "-"
+ DdlProveedorLineaAdicionalModal.txtValue.Value = "-1"
+
+
Else
DdlProveedorLineaAdicionalModal.setEsWebService(False)
DdlProveedorLineaAdicionalModal.ddl.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedorLineaAdicionalModal.ddl.DataBind()
- DdlProveedorLineaAdicionalModal.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
+ DdlProveedorLineaAdicionalModal.ddl.Items.Insert(0, New ListItem("-", "-1"))
End If
DdlClasificacionLienaAdicionalModal.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacionLienaAdicionalModal.DataBind()
- DdlClasificacionLienaAdicionalModal.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlClasificacionLienaAdicionalModal.Items.Insert(0, New ListItem("-", "-1"))
@@ -10405,10 +10409,10 @@ Partial Class Clientes
Protected Sub LnkAgregarLineaAdicionalModal_Click(sender As Object, e As EventArgs)
Dim ErrorAgregar As Boolean = False
- If DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero <= 0 Then
- Alert("El proveedor es requerido", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ 'If DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero <= 0 Then
+ ' Alert("El proveedor es requerido", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
Dim ObjVentas As New ClsVentas
diff --git a/Ventas/RepLineasAdicionales.aspx b/Ventas/RepLineasAdicionales.aspx
new file mode 100644
index 000000000..099f0709d
--- /dev/null
+++ b/Ventas/RepLineasAdicionales.aspx
@@ -0,0 +1,208 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepLineasAdicionales.aspx.cs" Inherits="Ventas_RepLineasAdicionales" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Excel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Proveedor:
+
+
+
Cliente:
+
+
+
Fecha Inicio:
+
+
Fecha Fin:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- MODAL COMPROBANTE --%>
+
+ <%-- FIN MODAL COMPROBANTE --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/RepLineasAdicionales.aspx.cs b/Ventas/RepLineasAdicionales.aspx.cs
new file mode 100644
index 000000000..51f634d90
--- /dev/null
+++ b/Ventas/RepLineasAdicionales.aspx.cs
@@ -0,0 +1,254 @@
+using System;
using System.Web.UI.WebControls;
using Extensiones;
using System.Data;
using static Extensiones.ModExtensiones;
+using System.Collections.Generic;
+using System.IO;
+using ListItem = System.Web.UI.WebControls.ListItem;
+
+public partial class Ventas_RepLineasAdicionales : ClsPaginas
+{
+ #region PROPIEDADES
+
+ private int CveLineaAdicional
+ {
+ get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); }
+ set { ViewState["CveLineaAdicional"] =(int) value; }
+ }
+
+ private string Comprobante
+ {
+ get {
+
+ if(ViewState["Comprobante"] == null)
+ {
+ ViewState["Comprobante"] = "";
+ }
+
+ return ViewState["Comprobante"].ToString();
+ }
+ set { ViewState["Comprobante"] = value; }
+ }
+
+ #endregion
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ InicializaValores();
+ }
+ }
+
+ private void InicializaValores()
+ {
+
+ if (Request["OP"] != null && Request["OP"].ToString() == "PO")
+ {
+ DVProveedor1.Visible = true;
+ DVProveedor2.Visible = true;
+ GvLineasAdicionales.Columns[9].Visible = true;
+ }
+
+ //Carga Clientes
+ DdlClientes.DataSource = get_GlobalDTCliente(UsuarioActual.CveEmpresa, -1);
+ DdlClientes.DataBind();
+
+
+
+ if(UsuarioActual.Empresa.Funcionalidad(105) == "1") {
+ DdlProveedor.setEsWebService(true);
+ DdlProveedor.Attributes.Add("data-metodo", "getproveedores");
+ DdlProveedor.SelectedText = "Todos";
+ DdlProveedor.SelectedValue = "-1";
+
+
+
+ }else {
+ DdlProveedor.setEsWebService(false);
+ DdlProveedor.ddl.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
+ DdlProveedor.ddl.DataBind();
+ DdlProveedor.ddl.Items.Insert(0, new ListItem("-", "-1"));
+ }
+
+ DdlClientes.setEsWebService(true);
+ DdlClientes.Attributes.Add("data-metodo", "getcliente");
+ DdlClientes.SelectedText = "Todos";
+ DdlClientes.SelectedValue = "-1";
+
+ txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString();
+ txtFechaF.Text = DateTime.Now.ToShortDateString();
+
+ }
+
+
+ protected void BtnConsultar_Click(object sender, EventArgs e)
+ {
+ CargaDatos();
+ }
+
+ private void CargaDatos()
+ {
+ LnkDescargaExcel.Visible = false;
+
+ ClsVentas objVentas = new ClsVentas();
+
+ int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1;
+
+ if(objVentas.GetLineasAdicionales(-1,DdlClientes.SelectedValue.ToEntero(),CveProveedor,-1,-1,txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), -1, UsuarioActual.CveEmpresa)){
+ GvLineasAdicionales.DataSource = objVentas.DtResultados;
+
+ if( objVentas.DtResultados.Rows.Count > 0)
+ {
+ LnkDescargaExcel.Visible = true;
+ UpAcciones.Update();
+ }
+ }
+ else
+ {
+ GvLineasAdicionales.DataSource = null;
+ }
+
+ objVentas.Dispose();
+
+ GvLineasAdicionales.DataBind();
+ UpLineasAdicionales.Update();
+ }
+
+
+ protected void LnkCargarComprobante_Click(object sender, EventArgs e)
+ {
+ GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer;
+
+ CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
+ Comprobante = GvRow.DataKey("Comprobante").ToString();
+
+ RegistraScript("$('#ModalComprobante').modal('show');","");
+ }
+
+ protected void BtnAddComprobante_Click(object sender, EventArgs e)
+ {
+ bool errorCargaComprobante = false;
+ string FileExtension = "-1";
+ List
filesgral = Anexo.getfiles().Archivos;
+ string filemove = "";
+ FileInfo fiNuevo;
+
+ DirectoryInfo df = new DirectoryInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\");
+
+
+ //Crea directorio si no existe
+ if (!df.Exists)
+ {
+ try
+ {
+ Directory.CreateDirectory(df.FullName);
+ }
+ catch
+ {
+ errorCargaComprobante = true;
+ }
+ }
+
+ //borrar archivo anterior
+ if((!errorCargaComprobante) && Comprobante.Length > 0)
+ {
+ FileInfo fiAnterior = new FileInfo($@"{df.FullName}{Comprobante}");
+ if (fiAnterior.Exists)
+ {
+ try
+ {
+ File.Delete(fiAnterior.FullName);
+ }
+ catch
+ {
+ errorCargaComprobante = true;
+ }
+ }
+ }
+
+ if(!errorCargaComprobante){
+
+ string RutaArchivoTemp = "";
+ foreach (Archivo fileItem in filesgral)
+ {
+ FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
+ filemove = fileItem.filename;
+ RutaArchivoTemp = $@"{AppDomain.CurrentDomain.BaseDirectory}\Temp\{fileItem.filename}";
+
+ break;
+ }
+
+ if((!errorCargaComprobante) && RutaArchivoTemp.Length > 0)
+ {
+ fiNuevo = new FileInfo(RutaArchivoTemp);
+
+ if (fiNuevo.Exists)
+ {
+ try
+ {
+
+ if (File.Exists($@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}"))
+ {
+ File.Delete($@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}");
+ }
+
+ File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}");
+ errorCargaComprobante = false;
+ }
+ catch
+ {
+ errorCargaComprobante = true;
+ }
+
+ if (!errorCargaComprobante)
+ {
+ ClsVentas objVentas = new ClsVentas();
+ if (!objVentas.UpdateLineasAdicionales(CveLineaAdicional, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, -1, UsuarioActual.CveEmpresa, Comprobante: $@"{CveLineaAdicional}{fiNuevo.Extension}"))
+ {
+ errorCargaComprobante = true;
+ }
+ objVentas.Dispose();
+ }
+ }
+ }
+
+ }
+
+
+ if (!errorCargaComprobante)
+ {
+ CargaDatos();
+ Anexo.Text = "[]";
+ RegistraScript("$('#ModalComprobante').modal('hide');", "");
+ Alert("Comprbante actualizado correctamente.");
+ }
+
+ UpAddComprobancte.Update();
+ }
+
+ protected void LnkCambiarEstatus_Click(object sender, EventArgs e)
+ {
+ GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
+ int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
+ bool errorCambioEstatus = false;
+
+ ClsVentas objVentas = new ClsVentas();
+
+ if (!objVentas.UpdateLineasAdicionales(CveLineaAdicionalActualzarEstatus, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, 3, UsuarioActual.CveEmpresa))
+ {
+ errorCambioEstatus = true;
+ }
+
+ if (!errorCambioEstatus)
+ {
+ CargaDatos();
+ }
+
+ objVentas.Dispose();
+ }
+
+
+ protected void LnkDescargaExcel_Click(object sender, EventArgs e)
+ {
+ GvLineasAdicionales.ExportToExcel2("RepLineas");
+ }
+
+
+}
\ No newline at end of file