Promociones carga desde plantilla, ProductosServicios Ecomerce Etiquetas
This commit is contained in:
@@ -412,7 +412,7 @@ Public Class ClsProductosServicios
|
|||||||
Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1, Optional PrecioLibre As Boolean = False,
|
Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1, Optional PrecioLibre As Boolean = False,
|
||||||
Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0,
|
Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0,
|
||||||
Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1,
|
Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1,
|
||||||
Optional NombreComercial As String = "", Optional NotasAdicionales As String = "") As Integer
|
Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "") As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_ProductosServiciosAdd")
|
DataAdapter("PA_ProductosServiciosAdd")
|
||||||
@@ -512,6 +512,7 @@ Public Class ClsProductosServicios
|
|||||||
.Add("@CveTipoOrganico", SqlDbType.Int).Value = CveTipoOrganico
|
.Add("@CveTipoOrganico", SqlDbType.Int).Value = CveTipoOrganico
|
||||||
.Add("@NombreComercial", SqlDbType.VarChar).Value = NombreComercial
|
.Add("@NombreComercial", SqlDbType.VarChar).Value = NombreComercial
|
||||||
.Add("@NotasAdicionales", SqlDbType.VarChar).Value = NotasAdicionales
|
.Add("@NotasAdicionales", SqlDbType.VarChar).Value = NotasAdicionales
|
||||||
|
.Add("@EcommerceEtiquetas", SqlDbType.VarChar).Value = EcommerceEtiquetas
|
||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
@@ -647,7 +648,7 @@ Public Class ClsProductosServicios
|
|||||||
Optional AplicaSerie As Boolean = False, Optional AplicaLote As Boolean = False, Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1, Optional PrecioLibre As Boolean = False,
|
Optional AplicaSerie As Boolean = False, Optional AplicaLote As Boolean = False, Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1, Optional PrecioLibre As Boolean = False,
|
||||||
Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0,
|
Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0,
|
||||||
Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1,
|
Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1,
|
||||||
Optional NombreComercial As String = "", Optional NotasAdicionales As String = "") As Boolean
|
Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "-") As Boolean
|
||||||
|
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
@@ -746,6 +747,7 @@ Public Class ClsProductosServicios
|
|||||||
.Add("@CveTipoOrganico", SqlDbType.Int).Value = CveTipoOrganico
|
.Add("@CveTipoOrganico", SqlDbType.Int).Value = CveTipoOrganico
|
||||||
.Add("@NombreComercial", SqlDbType.VarChar).Value = NombreComercial
|
.Add("@NombreComercial", SqlDbType.VarChar).Value = NombreComercial
|
||||||
.Add("@NotasAdicionales", SqlDbType.VarChar).Value = NotasAdicionales
|
.Add("@NotasAdicionales", SqlDbType.VarChar).Value = NotasAdicionales
|
||||||
|
.Add("@EcommerceEtiquetas", SqlDbType.VarChar).Value = EcommerceEtiquetas
|
||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
|
|||||||
@@ -547,17 +547,27 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtNombreComercial" CssClass="form-control input-sm" runat="server" >
|
<asp:TextBox ID="TxtNombreComercial" CssClass="form-control input-sm" runat="server" MaxLength="100" >
|
||||||
</asp:TextBox>
|
</asp:TextBox>
|
||||||
<label for="<%= TxtNombreComercial.ClientID.ToString()%>">Nombre Comercial:</label>
|
<label for="<%= TxtNombreComercial.ClientID.ToString()%>">Nombre Comercial:</label>
|
||||||
<i></i>
|
<i></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtEcommerceNota" CssClass="form-control input-sm" runat="server" >
|
<asp:TextBox ID="TxtEcommerceNota" CssClass="form-control input-sm" runat="server" MaxLength="250" >
|
||||||
</asp:TextBox>
|
</asp:TextBox>
|
||||||
<label for="<%= TxtEcommerceNota.ClientID.ToString()%>">Notas Adicionales:</label>
|
<label for="<%= TxtEcommerceNota.ClientID.ToString()%>">Notas Adicionales:</label>
|
||||||
<i></i>
|
<i></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
|
<asp:TextBox ID="TxtEcommerceEtiquetas" CssClass="form-control input-sm" runat="server" MaxLength="200" >
|
||||||
|
</asp:TextBox>
|
||||||
|
<label for="<%= TxtEcommerceEtiquetas.ClientID.ToString()%>">Etiquetas:</label>
|
||||||
|
<i></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -974,6 +974,7 @@ Partial Class ProductosyServicios
|
|||||||
DdlTipoOrganico.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTipoOrganico").ToString)
|
DdlTipoOrganico.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTipoOrganico").ToString)
|
||||||
TxtNombreComercial.Text = ObjProductosServicios.DtResultados.Rows(0)("NombreComercial").ToString
|
TxtNombreComercial.Text = ObjProductosServicios.DtResultados.Rows(0)("NombreComercial").ToString
|
||||||
TxtEcommerceNota.Text = ObjProductosServicios.DtResultados.Rows(0)("NotasAdicionales").ToString
|
TxtEcommerceNota.Text = ObjProductosServicios.DtResultados.Rows(0)("NotasAdicionales").ToString
|
||||||
|
TxtEcommerceEtiquetas.Text = ObjProductosServicios.DtResultados.Rows(0)("EcommerceEtiquetas").ToString
|
||||||
|
|
||||||
Try
|
Try
|
||||||
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, Nothing)
|
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, Nothing)
|
||||||
@@ -1460,7 +1461,7 @@ Partial Class ProductosyServicios
|
|||||||
CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked,
|
CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked,
|
||||||
CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim,
|
CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim,
|
||||||
CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal, RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked,
|
CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal, RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked,
|
||||||
NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim) > 0 Then
|
NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim) > 0 Then
|
||||||
ViewState("CvePS") = ObjProductosServicios.CvePS
|
ViewState("CvePS") = ObjProductosServicios.CvePS
|
||||||
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
|
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
|
||||||
If GVR.FCCheckBox("ChkDeduccion").Checked Then
|
If GVR.FCCheckBox("ChkDeduccion").Checked Then
|
||||||
@@ -1532,7 +1533,7 @@ Partial Class ProductosyServicios
|
|||||||
CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim,
|
CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim,
|
||||||
CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal,
|
CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal,
|
||||||
RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked,
|
RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked,
|
||||||
NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim) Then
|
NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim) Then
|
||||||
|
|
||||||
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
|
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
|
||||||
TieneError = True
|
TieneError = True
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="ImgAddFolio" runat="server" Visible="True" OnClick="BtnGenerarAPartir_Click"> Generar a partir de</asp:LinkButton>
|
<asp:LinkButton ID="ImgAddFolio" runat="server" Visible="True" OnClick="BtnGenerarAPartir_Click"> Generar a partir de</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LnkAgrgarPlantillaPS" runat="server" Visible="True" OnClick="LnkAgrgarPlantillaPS_Click"> Agregar Productos desde platilla</asp:LinkButton>
|
||||||
|
</li>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -439,6 +442,43 @@
|
|||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="DivAgregarPlantilla" class="modal fade">
|
||||||
|
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpAgregarPlantilla">
|
||||||
|
<ContentTemplate>
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="background-color: #258FD7; height: 30px; padding-top: 3px;">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" style="top: 3px !important; margin-top: 6px !important;"></button>
|
||||||
|
<h4 class="modal-title" style="color: #FFF; text-align: center;">Agregar Producto/Servicio Plantilla</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body rowpadding">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12" style="text-align:right">
|
||||||
|
<asp:LinkButton runat="server" ID="LnkDecargaPlatilla" OnClick="LnkDecargaPlatilla_Click"><i class="fa fa-arrow-down" aria-hidden="true"></i> Descarga Plantilla</asp:LinkButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 50px;">
|
||||||
|
<asp:TextBox ID="TxtExcel" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" data-dismiss="modal" class="btn btn-">Cerrar</button>
|
||||||
|
<asp:Button Text="Agregar" CssClass="btn btn-primary" ID="BrnAgregarPlantilla" OnClick="BrnAgregarPlantilla_Click" runat="server" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentTemplate>
|
||||||
|
<Triggers>
|
||||||
|
<asp:PostBackTrigger ControlID="LnkDecargaPlatilla" />
|
||||||
|
</Triggers>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
|
Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl
|
||||||
|
Imports Microsoft.Owin.Security.Provider
|
||||||
|
|
||||||
Partial Class Ventas_Promociones
|
Partial Class Ventas_Promociones
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -73,19 +75,22 @@ Partial Class Ventas_Promociones
|
|||||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
|
|
||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
|
|
||||||
CvePromocion = -1
|
CvePromocion = -1
|
||||||
CargaValoresIniciales()
|
CargaValoresIniciales()
|
||||||
CargaMonedas()
|
CargaMonedas()
|
||||||
|
|
||||||
If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then
|
If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then
|
||||||
|
|
||||||
CvePromocion = Request("CvePromocion").ToString.ToEntero
|
CvePromocion = Request("CvePromocion").ToString.ToEntero
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
|
LnkAgrgarPlantillaPS.Visible = False
|
||||||
Else
|
Else
|
||||||
ChkEstatus.Enabled = True
|
ChkEstatus.Enabled = True
|
||||||
ChkEstatus.Checked = True
|
ChkEstatus.Checked = True
|
||||||
CreaDT()
|
CreaDT()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
CargaGvBitacora()
|
CargaGvBitacora()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -917,4 +922,275 @@ Partial Class Ventas_Promociones
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub LnkAgrgarPlantillaPS_Click(sender As Object, e As EventArgs)
|
||||||
|
TxtExcel.Text = "[]"
|
||||||
|
UpAgregarPlantilla.Update()
|
||||||
|
RegistraScript("$('#DivAgregarPlantilla').modal('show');")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub LnkDecargaPlatilla_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
Dim rutaArchivoPlantilla As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\CargaPromociones.xlsx"
|
||||||
|
|
||||||
|
Dim nombreArchivo As String = "CargaPromociones.xlsx"
|
||||||
|
|
||||||
|
' Configurar la respuesta HTTP
|
||||||
|
Response.Clear()
|
||||||
|
Response.ContentType = "application/octet-stream"
|
||||||
|
Response.AppendHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
|
||||||
|
|
||||||
|
Dim contenido As Byte() = System.IO.File.ReadAllBytes(rutaArchivoPlantilla)
|
||||||
|
Response.BinaryWrite(contenido)
|
||||||
|
|
||||||
|
|
||||||
|
Response.Flush()
|
||||||
|
Response.End()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Protected Sub BrnAgregarPlantilla_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
If TxtExcel.getfiles().Archivos.Count > 0 Then
|
||||||
|
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
|
||||||
|
Dim Directorio As String = Server.MapPath("~") & file.path
|
||||||
|
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||||
|
|
||||||
|
CargarArchivo(Directorio, file.filename, Tipo)
|
||||||
|
Else
|
||||||
|
Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||||
|
|
||||||
|
TempDT.Clear()
|
||||||
|
|
||||||
|
CveConsecutivo = TempDT.Rows.Count + 1
|
||||||
|
|
||||||
|
Dim ProcesoOK As Boolean = False
|
||||||
|
Dim DTPlantilla As New DataTable
|
||||||
|
Dim ErrorArchivo = False
|
||||||
|
Dim ErrorExcel = False
|
||||||
|
DTPlantilla = ReadExcelFile(Ruta + FileName, True)
|
||||||
|
'Alert(DT.Rows.Count.ToString)
|
||||||
|
|
||||||
|
If DTPlantilla.Rows.Count = 0 Then
|
||||||
|
Alert("No encontraron registros.")
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ValidaDTPlantilla(DTPlantilla) Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
For Each dRowTemplate As DataRow In DTPlantilla.Rows
|
||||||
|
|
||||||
|
'Clasificacion Codigo TipoPromocion Promocion CantidadMinima Rin IncluyeImpuestos
|
||||||
|
|
||||||
|
Dim CveClasificacion As Integer = dRowTemplate("CveClasificacion").ToString.ToEntero
|
||||||
|
Dim CvePS As Integer = dRowTemplate("CvePS").ToString.ToEntero
|
||||||
|
Dim CveTipoPromosicion As Integer = dRowTemplate("CveTipoPromosicion").ToString.ToEntero
|
||||||
|
Dim Promocion As Decimal = dRowTemplate("Promocion").ToString.ToDecimal
|
||||||
|
Dim CantidadMinima As Decimal = dRowTemplate("CantidadMinima").ToString.ToDecimal
|
||||||
|
Dim CveRin As Integer = dRowTemplate("CveRin").ToString.ToEntero
|
||||||
|
Dim IncluyeImpuestos As Boolean = Boolean.Parse(dRowTemplate("IncluyeImpuestos").ToString)
|
||||||
|
|
||||||
|
|
||||||
|
Dim Dr As DataRow = TempDT.NewRow
|
||||||
|
Dr = TempDT.NewRow
|
||||||
|
Dr("Estatus") = 0
|
||||||
|
|
||||||
|
If CveClasificacion > 0 Then
|
||||||
|
Dr("CveClasificacion") = CveClasificacion
|
||||||
|
Dr("Clasificacion") = dRowTemplate("Clasificacion").ToString
|
||||||
|
Dr("CvePS") = -1
|
||||||
|
Else
|
||||||
|
Dr("CveClasificacion") = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion")
|
||||||
|
Dr("Clasificacion") = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("Clasificacion")
|
||||||
|
Dr("CvePS") = CvePS
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Dr("CodigoPS") = dRowTemplate("CodigoPS").ToString
|
||||||
|
Dr("PUAnterior") = 0
|
||||||
|
|
||||||
|
Dr("CveTipoPromocion") = CveTipoPromosicion
|
||||||
|
Dr("TipoPromocion") = dRowTemplate("TipoPromocion").ToString
|
||||||
|
Dr("Promocion") = Promocion
|
||||||
|
|
||||||
|
Dr("PUPromocion") = 0
|
||||||
|
|
||||||
|
Dr("CantidadMinima") = CantidadMinima
|
||||||
|
|
||||||
|
Dr("AplicaRestriccionTexto") = "No"
|
||||||
|
Dr("AplicaRestriccion") = False
|
||||||
|
Dr("HoraInicio") = MinFecha.ToDateTime
|
||||||
|
Dr("HoraFin") = MaxFecha.ToDateTime
|
||||||
|
Dr("AplicaLunes") = False
|
||||||
|
Dr("AplicaMartes") = False
|
||||||
|
Dr("AplicaMiercoles") = False
|
||||||
|
Dr("AplicaJueves") = False
|
||||||
|
Dr("AplicaViernes") = False
|
||||||
|
Dr("AplicaSabado") = False
|
||||||
|
Dr("AplicaDomingo") = False
|
||||||
|
|
||||||
|
Dr("IncluyeImpuestos") = IncluyeImpuestos
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||||
|
Dr("CveRinTamaño") = CveRin
|
||||||
|
Dr("RinTamaño") = dRowTemplate("RinTamaño").ToString
|
||||||
|
Else
|
||||||
|
Dr("CveRinTamaño") = -1
|
||||||
|
End If
|
||||||
|
|
||||||
|
TempDT.Rows.Add(Dr)
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CargaGrid()
|
||||||
|
RegistraScript("$('#DivAgregarPlantilla').modal('hide')")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function ValidaDTPlantilla(ByRef DTPlantilla As DataTable) As Boolean
|
||||||
|
|
||||||
|
Dim Errores As New StringBuilder
|
||||||
|
|
||||||
|
|
||||||
|
DTPlantilla.Columns.Add("CveClasificacion", GetType(Integer))
|
||||||
|
DTPlantilla.Columns.Add("CvePS", GetType(Integer))
|
||||||
|
DTPlantilla.Columns.Add("CveTipoPromosicion", GetType(Integer))
|
||||||
|
'DTPlantilla.Columns.Add("Promocion", GetType(Decimal))
|
||||||
|
'DTPlantilla.Columns.Add("CantidadMinima", GetType(Decimal))
|
||||||
|
DTPlantilla.Columns.Add("CveRin", GetType(Integer))
|
||||||
|
'DTPlantilla.Columns.Add("IncluyeImpuestos", GetType(Boolean))
|
||||||
|
DTPlantilla.Columns.Add("CodigoPS", GetType(String))
|
||||||
|
DTPlantilla.Columns.Add("RinTamaño", GetType(String))
|
||||||
|
|
||||||
|
|
||||||
|
Dim DTPS As DataTable = New DataTable
|
||||||
|
Dim DTRines As DataTable = New DataTable
|
||||||
|
Dim ObjPS As New ClsProductosServicios
|
||||||
|
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||||
|
DTPS = ObjPS.DtResultados
|
||||||
|
End If
|
||||||
|
ObjPS.Dispose()
|
||||||
|
|
||||||
|
|
||||||
|
Dim ObjGral As New ClsGenerales
|
||||||
|
If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then
|
||||||
|
DTRines = ObjGral.DtResultados
|
||||||
|
End If
|
||||||
|
ObjGral.Dispose()
|
||||||
|
|
||||||
|
|
||||||
|
Dim RegistroActual As Integer = 1
|
||||||
|
For Each dRow As DataRow In DTPlantilla.Rows
|
||||||
|
|
||||||
|
Dim SBErrorRegistro As New StringBuilder
|
||||||
|
|
||||||
|
Dim ClasificacionStr, CodigoStr, TipoPromocionStr, PromocionStr, CantidadMinimaStr, RinStr, IncluyeImpuestosStr As String
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ClasificacionStr = dRow("Clasificacion").ToString.Trim
|
||||||
|
CodigoStr = dRow("Codigo").ToString.Trim
|
||||||
|
TipoPromocionStr = dRow("TipoPromocion").ToString.Trim
|
||||||
|
PromocionStr = dRow("Promocion").ToString.Trim
|
||||||
|
CantidadMinimaStr = dRow("CantidadMinima").ToString.Trim
|
||||||
|
RinStr = dRow("Rin").ToString.Trim
|
||||||
|
IncluyeImpuestosStr = dRow("IncluyeImpuestos").ToString.Trim
|
||||||
|
|
||||||
|
If ClasificacionStr.Length > 0 Or CodigoStr.Length > 0 Then
|
||||||
|
|
||||||
|
Dim CveClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{ClasificacionStr}'").ToString().ToEntero()
|
||||||
|
Dim CvePS As Integer = DTPS.FiltroPrimeroValor("CvePS", $"Codigo = '{CodigoStr}'").ToString().ToEntero()
|
||||||
|
Dim CodigoPS As String = DTPS.FiltroPrimeroValor("PSCodigo", $"Codigo = '{CodigoStr}'").ToString()
|
||||||
|
Dim CveTipoPromosicion As Integer = -1
|
||||||
|
Dim Promocion As Decimal = PromocionStr.ToDecimal
|
||||||
|
Dim CantidadMinima As Decimal = CantidadMinimaStr.ToDecimal
|
||||||
|
Dim CveRin As Integer = DTRines.FiltroPrimeroValor("CveRinTamaño", $"Codigo = '{RinStr}'").ToString().ToEntero()
|
||||||
|
Dim RinTamaño As String = DTRines.FiltroPrimeroValor("RinTamaño", $"Codigo = '{RinStr}'").ToString()
|
||||||
|
Dim IncluyeImpuestos As Boolean = If(IncluyeImpuestosStr.ToUpper.Contiene("´SÍ", "SI", "1"), True, False)
|
||||||
|
|
||||||
|
' SBErrorRegistro.Append($"")
|
||||||
|
If ClasificacionStr.Length > 0 And CodigoStr.Length > 0 Then
|
||||||
|
SBErrorRegistro.Append($"No se puede agregar Clasificación y codigo en un mismo registro. ")
|
||||||
|
Else
|
||||||
|
|
||||||
|
If ClasificacionStr.Length > 0 Then
|
||||||
|
SBErrorRegistro.Append(If(CveClasificacion > 0, "", $"No se encontro Clasificación {ClasificacionStr}. "))
|
||||||
|
Else
|
||||||
|
SBErrorRegistro.Append(If(CvePS > 0, "", $"No se encontro codigo de Producto/Servicio {CodigoStr }. "))
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TipoPromocionStr.ToUpper = "IMPORTE $" Then
|
||||||
|
CveTipoPromosicion = 1
|
||||||
|
ElseIf TipoPromocionStr.ToUpper = "DESCUENTO %" Then
|
||||||
|
CveTipoPromosicion = 2
|
||||||
|
ElseIf TipoPromocionStr.ToUpper = "CANTIDAD" Then
|
||||||
|
CveTipoPromosicion = 3
|
||||||
|
Else
|
||||||
|
SBErrorRegistro.Append($"Tipo Promosion no encontrada {TipoPromocionStr}. ")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not Promocion > 0 Then
|
||||||
|
SBErrorRegistro.Append($"La Promoción debe de ser mayor a 0. ")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not CantidadMinima > 0 Then
|
||||||
|
SBErrorRegistro.Append($"La Cantidad Minima debe de ser mayor a 0. ")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If RinStr.Length > 0 And Not CveRin > 0 Then
|
||||||
|
SBErrorRegistro.Append($"Tamaño de Rin no encontrado {RinStr}. ")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not IncluyeImpuestosStr.ToUpper.Contiene("´SÍ", "SI", "1", "NO", "0") Then
|
||||||
|
SBErrorRegistro.Append($"Campo IncluyeImpuestos no valido {IncluyeImpuestos}.<br/> ")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If SBErrorRegistro.ToString.Length > 0 Then
|
||||||
|
Errores.AppendLine($"Registro {RegistroActual}, {SBErrorRegistro.ToString}")
|
||||||
|
Else
|
||||||
|
dRow("CveClasificacion") = CveClasificacion
|
||||||
|
dRow("CvePS") = CvePS
|
||||||
|
dRow("CveTipoPromosicion") = CveTipoPromosicion
|
||||||
|
dRow("Promocion") = Promocion
|
||||||
|
dRow("CantidadMinima") = CantidadMinima
|
||||||
|
dRow("RinTamaño") = RinTamaño
|
||||||
|
dRow("CveRin") = CveRin
|
||||||
|
dRow("IncluyeImpuestos") = IncluyeImpuestos
|
||||||
|
dRow("CodigoPS") = If(CveClasificacion > 0, "Todos", CodigoPS)
|
||||||
|
End If
|
||||||
|
|
||||||
|
RegistroActual = RegistroActual + 1
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
If Errores.ToString.Length = 0 Then
|
||||||
|
DTPlantilla.AcceptChanges()
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
Alert(Errores.ToString, TipoMensaje.MsgAdvertencia)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
Reference in New Issue
Block a user