EMD. PDF Con subreporte de carta porte, asignacion de mercancias
This commit is contained in:
@@ -55,6 +55,16 @@ Public Class ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
|
||||
Private Property SubReportData As Modelos.MSubReportData
|
||||
Get
|
||||
Return If(IsNothing(ViewState("SubReportData")), Nothing, DirectCast(ViewState("SubReportData"), Modelos.MSubReportData))
|
||||
End Get
|
||||
|
||||
Set(value As Modelos.MSubReportData)
|
||||
ViewState("SubReportData") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Shared ReadOnly Property UrlSitio As String
|
||||
Get
|
||||
If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UrlSitio")) Then
|
||||
@@ -5927,17 +5937,17 @@ Public Class ClsPaginas
|
||||
''' <param name="NombreArchivo">Opcional Nombre del archivo que se descarga</param>
|
||||
''' <param name="Formato">Optional, Formato de Generacion PDF o Excel</param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment")
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment", Optional SubReportData As Modelos.MSubReportData = Nothing)
|
||||
'limpio ReportViwer
|
||||
ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR), NombreArchivo, Formato, Content_Disposition:=Content_Disposition)
|
||||
ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR, SubReportData), NombreArchivo, Formato, Content_Disposition:=Content_Disposition)
|
||||
End Sub
|
||||
Public Function StreamPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing) As Byte()
|
||||
Public Function StreamPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim rds As New ReportDataSource
|
||||
rds.Name = RDSName
|
||||
rds.Value = DtDatos
|
||||
lrds.Add(rds)
|
||||
Return StreamPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR)
|
||||
Return StreamPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR, SubReportData)
|
||||
End Function
|
||||
'Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte()
|
||||
' 'limpio ReportViwer
|
||||
@@ -5981,10 +5991,13 @@ Public Class ClsPaginas
|
||||
' Return Bytes
|
||||
'End Function
|
||||
|
||||
Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte()
|
||||
Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
|
||||
'limpio ReportViwer
|
||||
Dim sw As New System.Diagnostics.Stopwatch()
|
||||
sw.Start()
|
||||
|
||||
Me.SubReportData = Nothing
|
||||
|
||||
Dim Bytes As Byte() = Nothing
|
||||
|
||||
Dim CveUsuario As Integer = 0
|
||||
@@ -6030,12 +6043,21 @@ Public Class ClsPaginas
|
||||
reportobjects.Add(ojext)
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each rpds As ReportParameter In Parametros
|
||||
Dim param As New WSRDLC.ReportParameter
|
||||
param.Name = rpds.Name
|
||||
param.Values = {rpds.Values(0)}
|
||||
|
||||
'SI ES TEXTO, QUITAR TABS Y OTROS ESPACIOS QUE DEN PROBLEMAS AL MANDAR LA PETICION
|
||||
If rpds IsNot Nothing AndAlso rpds.Values IsNot Nothing AndAlso rpds.Values.Count > 0 AndAlso rpds.Values(0) IsNot Nothing AndAlso rpds.Values(0).GetType() = GetType(String) Then
|
||||
param.Values = {rpds.Values(0).Replace(vbVerticalTab, "")}
|
||||
Else
|
||||
param.Values = {rpds.Values(0)}
|
||||
End If
|
||||
|
||||
params.Add(param)
|
||||
Next
|
||||
|
||||
Bytes = wsreport.StreamNEWPDFBytes(RutaReporte, ds, reportobjects.ToArray(), params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
|
||||
wsreport = Nothing
|
||||
params = Nothing
|
||||
@@ -6050,9 +6072,16 @@ Public Class ClsPaginas
|
||||
|
||||
MR.LocalReport.ReportPath = RutaReporte
|
||||
MR.ProcessingMode = ProcessingMode.Local
|
||||
|
||||
If SubReportData IsNot Nothing Then
|
||||
Me.SubReportData = SubReportData
|
||||
AddHandler MR.LocalReport.SubreportProcessing, AddressOf LocalReport_SubreportProcessing
|
||||
End If
|
||||
|
||||
MR.LocalReport.EnableExternalImages = True
|
||||
MR.LocalReport.SetParameters(Parametros)
|
||||
MR.LocalReport.Refresh()
|
||||
|
||||
Dim Warnings As Warning() = Nothing
|
||||
Dim StreamIds As String() = Nothing
|
||||
Dim MimeType As String = Nothing
|
||||
@@ -6121,6 +6150,14 @@ Public Class ClsPaginas
|
||||
Return Bytes
|
||||
End Function
|
||||
|
||||
Private Sub LocalReport_SubreportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
|
||||
If SubReportData IsNot Nothing Then
|
||||
For Each ds In SubReportData.DataSources
|
||||
e.DataSources.Add(ds)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function ImprimirPDFCrystal(RutaReporte As String, DataSource As DataTable, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportDocument = Nothing) As Byte()
|
||||
'limpio ReportViwer
|
||||
Dim sw As New System.Diagnostics.Stopwatch()
|
||||
@@ -6934,7 +6971,7 @@ Public Class ClsPaginas
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
End Try
|
||||
End Sub
|
||||
Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True) As Byte()
|
||||
Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
|
||||
Dim retorno As Byte() = Nothing
|
||||
|
||||
' Dim ObjVentas As New ClsVentas
|
||||
@@ -7754,6 +7791,13 @@ Public Class ClsPaginas
|
||||
'Next
|
||||
'ast.ToString.GuardaLog()
|
||||
|
||||
'PASAR LOS PARAMETROS SI TIENE SUBREPORTE
|
||||
If SubReportData IsNot Nothing Then
|
||||
For Each parametro As ReportParameter In SubReportData.Parametros
|
||||
params.Add(parametro)
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim Archivo As New System.IO.FileInfo(RutaFormato)
|
||||
If Archivo.Exists Then
|
||||
'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
@@ -7762,7 +7806,7 @@ Public Class ClsPaginas
|
||||
'Else
|
||||
' retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
|
||||
'End If
|
||||
retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
|
||||
retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData)
|
||||
|
||||
Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
|
||||
If Guardar Then
|
||||
@@ -7792,7 +7836,7 @@ Public Class ClsPaginas
|
||||
'Else
|
||||
' retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
|
||||
'End If
|
||||
retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
|
||||
retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
@@ -7831,12 +7875,12 @@ Public Class ClsPaginas
|
||||
End If
|
||||
|
||||
'SITIO DE PRUEBA EN IIS
|
||||
Dim Url = New Uri(String.Format("{0}{1}", "http://localhost:2202/", Opcion))
|
||||
|
||||
Try
|
||||
Dim dataSourceArray As New JArray()
|
||||
Dim paramsArray As New JArray()
|
||||
|
||||
Dim Url = New Uri(String.Format("{0}{1}", "http://localhost:2202/", Opcion))
|
||||
|
||||
Try
|
||||
Dim dataSourceArray As New JArray()
|
||||
Dim paramsArray As New JArray()
|
||||
|
||||
For Each rds As ReportDataSource In DataSource
|
||||
dataSourceArray.Add(New JObject(New JProperty("Nombre", rds.Name), New JProperty("Valor", JArray.Parse(JsonConvert.SerializeObject(rds.Value)))))
|
||||
Next
|
||||
@@ -7850,10 +7894,10 @@ Public Class ClsPaginas
|
||||
New JProperty("ruta", RutaReporte),
|
||||
New JProperty("parametros", paramsArray),
|
||||
New JProperty("dataSource", dataSourceArray)
|
||||
)
|
||||
|
||||
Dim data = New StringContent(payload.ToString(), Encoding.UTF8, "application/json")
|
||||
|
||||
)
|
||||
|
||||
Dim data = New StringContent(payload.ToString(), Encoding.UTF8, "application/json")
|
||||
|
||||
Using httpClient = New HttpClient()
|
||||
Using request = New HttpRequestMessage(HttpMethod.Post, Url)
|
||||
'request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
@@ -7863,10 +7907,10 @@ Public Class ClsPaginas
|
||||
Bytes = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
sw.Stop()
|
||||
|
||||
|
||||
@@ -35,6 +35,20 @@ Namespace Modelos
|
||||
Public Property CveEmpresa As Integer
|
||||
|
||||
End Class
|
||||
<Serializable>
|
||||
Public Class MSubReportData
|
||||
Public Sub New()
|
||||
Me.Nombre = ""
|
||||
Me.SerieFolio = ""
|
||||
Me.Parametros = New List(Of ReportParameter)
|
||||
Me.DataSources = New List(Of ReportDataSource)
|
||||
End Sub
|
||||
|
||||
Public Property Nombre As String
|
||||
Public Property SerieFolio As String
|
||||
Public Property Parametros As List(Of ReportParameter)
|
||||
Public Property DataSources As List(Of ReportDataSource)
|
||||
End Class
|
||||
|
||||
Public Class Evento
|
||||
Public Sub New()
|
||||
|
||||
@@ -375,7 +375,7 @@ Public Class Timbres
|
||||
Public Property CartaPorte As CFDICartaPorte
|
||||
End Class
|
||||
|
||||
Public Shared Function PreParaCartaPorteFactura(CveTimbre As Integer, Obj As Modelos.Factura, UsuarioActual As Usuario) As MMensajeCartaPorte
|
||||
Public Shared Function PreParaCartaPorteFactura(CveTimbre As Integer, UsuarioActual As Usuario) As MMensajeCartaPorte
|
||||
Dim Retorno As New MMensajeCartaPorte
|
||||
|
||||
Try
|
||||
@@ -399,7 +399,7 @@ Public Class Timbres
|
||||
|
||||
Dim ObjGrales As New ClsGenerales
|
||||
|
||||
If ObjGrales.GetGralTimbre(CveTimbre, "Man", FI, FF, -1, UsuarioActual.CveEmpresa, -1) Then
|
||||
If ObjGrales.GetGralTimbre(CveTimbre, "Ing", FI, FF, -1, UsuarioActual.CveEmpresa, -1) Then
|
||||
|
||||
If ObjGrales.DtResultados.Rows.Count = 1 Then
|
||||
Dim DtMovimientos As DataTable = Nothing
|
||||
@@ -466,16 +466,6 @@ Public Class Timbres
|
||||
End If
|
||||
|
||||
|
||||
If drT("ClaveTipoRemolque1").ToString <> "" Then
|
||||
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}
|
||||
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem1)
|
||||
End If
|
||||
|
||||
If drT("ClaveTipoRemolque2").ToString <> "" Then
|
||||
Dim Rem2 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque2"), .Placa = drT("PlacaRemolque2")}
|
||||
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem2)
|
||||
End If
|
||||
|
||||
|
||||
Dim DomOrigen As CFDICartaPorteDomicilio = Nothing
|
||||
DomOrigen = New CFDICartaPorteDomicilio With {.Calle = drT("DirOriCalle").ToString,
|
||||
@@ -569,7 +559,7 @@ Public Class Timbres
|
||||
.ClaveUnidad = drr("SATClaveUM").ToString,
|
||||
.Unidad = drr("UM").ToString,
|
||||
.Dimensiones = drr("Dimensiones").ToString,
|
||||
.PesoenKg = drr("PesoKg").ToString.ToDecimal,
|
||||
.PesoenKg = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal,
|
||||
.MaterialPeligroso = If(drr("ClaveMaterialPeligroso").ToString <> "", "Sí", ""),
|
||||
.ClaveMaterialPeligroso = drr("ClaveMaterialPeligroso").ToString,
|
||||
.Embalaje = drr("ClaveEmbalaje").ToString,
|
||||
@@ -580,7 +570,7 @@ Public Class Timbres
|
||||
.UUIDComercioExt = ""
|
||||
}
|
||||
|
||||
Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal}
|
||||
Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal}
|
||||
conceptoCarta.DetalleMercancia = DetalleMercancia
|
||||
|
||||
Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4609
Empresas/13/Formatos/CartaPorteTimbrado.rdlc
Normal file
4609
Empresas/13/Formatos/CartaPorteTimbrado.rdlc
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2467,21 +2467,27 @@
|
||||
<div class="row rowpadding">
|
||||
<label class="col-md-2">Emitir:</label>
|
||||
<div class="col-md-10">
|
||||
<asp:CheckBox ID="ChkEmitirCartaPorte" runat="server" CssClass="chksino" Text=" " />
|
||||
<asp:CheckBox ID="ChkEmitirCartaPorte" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirCartaPorte_CheckedChanged" AutoPostBack="true" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row rowpadding">
|
||||
<label class="col-md-2">Origen:</label>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtOrigenCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>
|
||||
<asp:DropDownList ID="DdlDireccionOrigen" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="100%" OnSelectedIndexChanged="DdlDireccionOrigen_SelectedIndexChanged">
|
||||
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<%--<asp:TextBox ID="TxtOrigenCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>--%>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row rowpadding">
|
||||
<label class="col-md-2">Destino:</label>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtDestinoCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>
|
||||
<asp:DropDownList ID="DdlDireccionDestino" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="100%" OnSelectedIndexChanged="DdlDireccionDestino_SelectedIndexChanged">
|
||||
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<%--<asp:TextBox ID="TxtDestinoCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>--%>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
@@ -5956,11 +5962,54 @@
|
||||
<h4 class="modal-title">Registrar Mercancía</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCantidadMercancia" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTEMercancia" runat="server" TargetControlID="TxtCantidadMercancia" FilterType="Numbers, Custom" ValidChars="." />
|
||||
<asp:RequiredFieldValidator ID="RFVMercancia" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCantidadMercancia" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtCantidadMercancia.ClientID.ToString()%>">Cantidad:</label>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Agregar Flete:</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:CheckBox ID="ChkAgregarFlete" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkAgregarFlete_CheckedChanged" Checked="true"
|
||||
AutoPostBack="true" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="DivServicioFlete" runat="server" visible="True" class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="<%= DdlPSFlete.ClientID.ToString()%>">Servicio:</label>
|
||||
<ADS:Dropdownlost runat="server" ID="DdlPSFlete" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" DataTextField="PSCodigo" DataValueField="CvePS" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Observaciones:</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:TextBox ID="TxtObservacionesMercancia" CssClass="form-control input-sm" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="50"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCantidadMercancia" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTEMercancia" runat="server" TargetControlID="TxtCantidadMercancia" FilterType="Numbers, Custom" ValidChars="." />
|
||||
<asp:RequiredFieldValidator ID="RFVMercancia" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCantidadMercancia" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtCantidadMercancia.ClientID.ToString()%>">Cantidad:</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -5970,6 +6019,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtPrecioMercancia" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddPSMercancia" Width="200px" CssClass="form-control "></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBPrecioMercancia" runat="server" TargetControlID="TxtPrecioMercancia" FilterType="Custom, Numbers" ValidChars="." />
|
||||
<asp:RequiredFieldValidator ID="RFVPrecioMercancia" runat="server" ControlToValidate="TxtPrecioMercancia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPrecioM1" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecioMercancia" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
<asp:CustomValidator ID="CVPrecioMercancia" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecioMercancia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddPSMercancia"></asp:CustomValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPrecioM2" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioMercancia" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
<label for="<%= TxtPrecioMercancia.ClientID.ToString()%>">Precio:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:LinkButton ID="LnkAddPSMercancia" OnClick="LnkAddPSMercancia_Click" runat="server" CssClass="btn btn-success" Text="Agregar" ValidationGroup="GrpAddPSMercancia"></asp:LinkButton>
|
||||
|
||||
@@ -228,6 +228,14 @@ Partial Class Ventas
|
||||
ViewState("TmpDTEnvioDireccion") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTDireccionCP As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTDireccionCP")), Nothing, CType(ViewState("TmpDTDireccionCP"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTDireccionCP") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property IdPoliza As Integer
|
||||
Get
|
||||
@@ -1346,6 +1354,22 @@ Partial Class Ventas
|
||||
ViewState("RegimenFiscalCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property RegimenSociedad As String
|
||||
Get
|
||||
Return IfNull(ViewState("RegimenSociedad"), "").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("RegimenSociedad") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TipoPersona As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("TipoPersona"), False))
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("TipoPersona") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Adjunto As String
|
||||
Get
|
||||
Return If(IsNothing(ViewState("Adjunto")), "", ViewState("Adjunto").ToString())
|
||||
@@ -2296,7 +2320,7 @@ Partial Class Ventas
|
||||
UpFacturar.Update()
|
||||
'CargaTiposDocumentos()
|
||||
TrEmitir.Visible = False
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.CveEmpresa = 1 Then
|
||||
DivCartaPorte.Visible = True
|
||||
End If
|
||||
ViewState("EstablecioFolio") = False
|
||||
@@ -2460,6 +2484,7 @@ Partial Class Ventas
|
||||
CargaClasificaciones()
|
||||
CargaPS(-1, DdlPS)
|
||||
CargaPS(-1, DdlPSMercancia)
|
||||
CargaPS(-1, DdlPSFlete)
|
||||
'CargaPSRemision(-1, DdlPSRemision)
|
||||
CargaPSPyME(-1, DdlPSPyME)
|
||||
|
||||
@@ -4922,7 +4947,7 @@ Partial Class Ventas
|
||||
If DbRowVenta("CveDireccionEnvio").ToString().ToEntero() > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString() IsNot Nothing Then
|
||||
ChkDireccionEnvio.Checked = True
|
||||
DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString().ToEntero())
|
||||
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
DdlDireccionEnvio.Enabled = False
|
||||
ChkDireccionEnvio.Enabled = False
|
||||
DdlDireccionEnvio.Visible = True
|
||||
@@ -6076,8 +6101,11 @@ Partial Class Ventas
|
||||
ViewState("CliLocalidad") = If(ObjCliente.Localidad.Trim.Length = 0, ObjCliente.Ciudad.Trim, ObjCliente.Localidad.Trim)
|
||||
ViewState("CliPais") = ObjCliente.Pais
|
||||
ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString()
|
||||
RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString()
|
||||
TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona"))
|
||||
CargaUsoCFDI()
|
||||
End If
|
||||
'ViewState("NumCtaPago") = ObjCliente.NumCtaPago
|
||||
@@ -6103,7 +6131,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'HABILITA LA OPCION DE DIRECCION DE ENVIO
|
||||
If UsuarioActual.CveEmpresa.Contiene(1, 72, 119, 140) Then
|
||||
If UsuarioActual.CveEmpresa.Contiene(1, 13, 72, 119, 140) Then
|
||||
trDireccionEnvio.Visible = True
|
||||
CargaDireccionesEnvio()
|
||||
End If
|
||||
@@ -7225,7 +7253,7 @@ Partial Class Ventas
|
||||
DdlClasificacion.DataBind()
|
||||
DdlClasificacionPyME.DataBind()
|
||||
End Sub
|
||||
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
|
||||
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost, Optional AplicaParaVenta As Boolean = True)
|
||||
|
||||
Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1")
|
||||
|
||||
@@ -7251,7 +7279,9 @@ Partial Class Ventas
|
||||
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString())
|
||||
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
|
||||
Objeto.ddlWS.Attributes.Add("data-Estatus", "1")
|
||||
Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1")
|
||||
If AplicaParaVenta Then
|
||||
Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1")
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -8215,6 +8245,22 @@ Partial Class Ventas
|
||||
DtOCTmpDT = TmpDT.Copy
|
||||
TmpDTError = TmpDT.Copy
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then
|
||||
If RegimenFiscalCliente.Contiene("-1", "") Then
|
||||
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim EsPersonaMoral As Boolean = (TipoPersona = True)
|
||||
If EsPersonaMoral AndAlso String.IsNullOrEmpty(RegimenSociedad) Then
|
||||
Alert("El cliente no tiene asignado un regimen de sociedad.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
|
||||
Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -8236,11 +8282,11 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If ChkEmitirCartaPorte.Checked Then
|
||||
If String.IsNullOrEmpty(TxtOrigenCP.Text.Trim()) Then
|
||||
If DdlDireccionOrigen.SelectedValue.ToEntero() <= 0 Then
|
||||
Alert("La carta porte no tiene un origen definido.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
If String.IsNullOrEmpty(TxtDestinoCP.Text.Trim()) Then
|
||||
If DdlDireccionDestino.SelectedValue.ToEntero() <= 0 Then
|
||||
Alert("La carta porte no tiene un destino definido.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -9285,7 +9331,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If ChkEmitirCartaPorte.Checked AndAlso CveTimbreCartaPorte > 0 Then
|
||||
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, ObjFactura, UsuarioActual)
|
||||
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, UsuarioActual)
|
||||
If Not RespCartaPorte.TieneError Then
|
||||
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
|
||||
Else
|
||||
@@ -11377,7 +11423,11 @@ Partial Class Ventas
|
||||
Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP
|
||||
Else
|
||||
Timbre.Receptor.RFC = Obj.Cliente.RFC
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.NombreComercial
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
|
||||
Else
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.NombreComercial
|
||||
End If
|
||||
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
|
||||
End If
|
||||
|
||||
@@ -16179,12 +16229,12 @@ Partial Class Ventas
|
||||
Dim TmpDTComplementosTimbrado As New DataTable
|
||||
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
|
||||
|
||||
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, ObjFactura, UsuarioActual)
|
||||
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, UsuarioActual)
|
||||
If Not RespCartaPorte.TieneError Then
|
||||
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
|
||||
Else
|
||||
Exit Sub
|
||||
Alert(RespCartaPorte.Mensaje, TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then
|
||||
@@ -21496,6 +21546,11 @@ Partial Class Ventas
|
||||
ObjConta.Dispose()
|
||||
ObjBancos.Dispose()
|
||||
If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
||||
|
||||
'REGENERAR EL PDF
|
||||
If Not OcurrioError Then
|
||||
DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click
|
||||
Dim ObjVentas As New ClsVentas
|
||||
@@ -22800,14 +22855,14 @@ Partial Class Ventas
|
||||
If ChkDireccionEnvio.Checked Then
|
||||
DdlDireccionEnvio.Visible = True
|
||||
LnkOtraDireccion.Visible = True
|
||||
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
Else
|
||||
DdlDireccionEnvio.Visible = False
|
||||
LnkOtraDireccion.Visible = False
|
||||
If SucursalDestinoCP IsNot Nothing Then
|
||||
SucursalDestinoCP = Nothing
|
||||
SucursalDestinoCP = New Modelos.SucursalModel
|
||||
TxtDestinoCP.Text = ""
|
||||
'TxtDestinoCP.Text = ""
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
@@ -22847,7 +22902,7 @@ Partial Class Ventas
|
||||
TxtEnvioTel.Text = ""
|
||||
CargaDireccionesEnvio()
|
||||
DdlDireccionEnvio.SelectedValueExist(CveDireccionEnvio)
|
||||
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
|
||||
End If
|
||||
|
||||
ObjClientes.Dispose()
|
||||
@@ -33014,8 +33069,8 @@ Partial Class Ventas
|
||||
|
||||
' Return File
|
||||
'End Function
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0")))))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient = New HttpClient()
|
||||
@@ -34172,7 +34227,7 @@ Partial Class Ventas
|
||||
TxtFechaLlegadaCP.Enabled = False
|
||||
|
||||
Using ObjGral As New ClsGenerales
|
||||
If ObjGral.GetGralTimbre(-1, "Man", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||
If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||
Dim RowCP As DataRow = ObjGral.DtResultados.Rows(0)
|
||||
|
||||
Me.CveTimbreCartaPorteVenta = RowCP("CveTimbre").ToString().ToEntero()
|
||||
@@ -34308,7 +34363,7 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
CveTimbre = ObjGral.AddGralTimbre("Man", DdlSubProyectoDatos.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta)
|
||||
CveTimbre = ObjGral.AddGralTimbre("Ing", DdlSubProyectoDatos.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta)
|
||||
|
||||
If Not CveTimbre > 0 Then
|
||||
ErrorProceso = True
|
||||
@@ -34440,12 +34495,80 @@ Partial Class Ventas
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
|
||||
TxtOrigenCP.Text = SBDomicilioSucursal.ToString
|
||||
'TxtOrigenCP.Text = SBDomicilioSucursal.ToString
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlDireccionEnvio_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
'If SucursalDestinoCP Is Nothing Then
|
||||
' SucursalDestinoCP = New Modelos.SucursalModel
|
||||
'Else
|
||||
' SucursalDestinoCP = Nothing
|
||||
' SucursalDestinoCP = New Modelos.SucursalModel
|
||||
'End If
|
||||
|
||||
|
||||
'If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
|
||||
|
||||
' Dim Row As DataRow = TmpDTEnvioDireccion.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero()))
|
||||
' If Row IsNot Nothing Then
|
||||
|
||||
' SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString()
|
||||
' SucursalDestinoCP.Colonia = Row("EnvioColonia").ToString()
|
||||
' SucursalDestinoCP.Municipio = Row("EnvioCiudad").ToString()
|
||||
' SucursalDestinoCP.CveEstado = Row("CveEstado").ToString().ToEntero()
|
||||
' SucursalDestinoCP.Estado = Row("EnvioEstado").ToString()
|
||||
' SucursalDestinoCP.CvePais = Row("CvePais").ToString().ToEntero()
|
||||
' SucursalDestinoCP.Pais = Row("Pais").ToString()
|
||||
' SucursalDestinoCP.CP = Row("EnvioCP").ToString()
|
||||
|
||||
' TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
|
||||
' Else
|
||||
' TxtDestinoCP.Text = ""
|
||||
' End If
|
||||
'Else
|
||||
' TxtDestinoCP.Text = ""
|
||||
'End If
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlDireccionOrigen_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
If SucursalOrigenCP Is Nothing Then
|
||||
SucursalOrigenCP = New Modelos.SucursalModel
|
||||
Else
|
||||
SucursalOrigenCP = Nothing
|
||||
SucursalOrigenCP = New Modelos.SucursalModel
|
||||
End If
|
||||
|
||||
|
||||
If TmpDTDireccionCP IsNot Nothing AndAlso TmpDTDireccionCP.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionOrigen.SelectedValue.ToEntero())).Rows.Count > 0 Then
|
||||
|
||||
Dim Row As DataRow = TmpDTDireccionCP.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionOrigen.SelectedValue.ToEntero()))
|
||||
If Row IsNot Nothing Then
|
||||
|
||||
SucursalOrigenCP.Direccion = Row("EnvioDireccion").ToString()
|
||||
SucursalOrigenCP.Colonia = Row("EnvioColonia").ToString()
|
||||
SucursalOrigenCP.Municipio = Row("EnvioCiudad").ToString()
|
||||
SucursalOrigenCP.CveEstado = Row("CveEstado").ToString().ToEntero()
|
||||
SucursalOrigenCP.Estado = Row("EnvioEstado").ToString()
|
||||
SucursalOrigenCP.CvePais = Row("CvePais").ToString().ToEntero()
|
||||
SucursalOrigenCP.Pais = Row("Pais").ToString()
|
||||
SucursalOrigenCP.CP = Row("EnvioCP").ToString()
|
||||
|
||||
'TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
|
||||
Else
|
||||
'TxtDestinoCP.Text = ""
|
||||
End If
|
||||
Else
|
||||
'TxtDestinoCP.Text = ""
|
||||
End If
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlDireccionDestino_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
If SucursalDestinoCP Is Nothing Then
|
||||
SucursalDestinoCP = New Modelos.SucursalModel
|
||||
Else
|
||||
@@ -34454,9 +34577,9 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
|
||||
If TmpDTDireccionCP IsNot Nothing AndAlso TmpDTDireccionCP.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionDestino.SelectedValue.ToEntero())).Rows.Count > 0 Then
|
||||
|
||||
Dim Row As DataRow = TmpDTEnvioDireccion.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero()))
|
||||
Dim Row As DataRow = TmpDTDireccionCP.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionDestino.SelectedValue.ToEntero()))
|
||||
If Row IsNot Nothing Then
|
||||
|
||||
SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString()
|
||||
@@ -34468,20 +34591,20 @@ Partial Class Ventas
|
||||
SucursalDestinoCP.Pais = Row("Pais").ToString()
|
||||
SucursalDestinoCP.CP = Row("EnvioCP").ToString()
|
||||
|
||||
TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
|
||||
'TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
|
||||
Else
|
||||
TxtDestinoCP.Text = ""
|
||||
'TxtDestinoCP.Text = ""
|
||||
End If
|
||||
Else
|
||||
TxtDestinoCP.Text = ""
|
||||
'TxtDestinoCP.Text = ""
|
||||
End If
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
Protected Sub LnkAgregarMercancia_Click(sender As Object, e As EventArgs)
|
||||
TxtCantidadMercancia.Text = ""
|
||||
DdlPSMercancia.SelectedValue = ""
|
||||
DdlPSMercancia.SelectedText = "Seleccione"
|
||||
'DdlPSMercancia.SelectedValue = ""
|
||||
'DdlPSMercancia.SelectedText = "Seleccione"
|
||||
|
||||
UpAgregarMercancia.Update()
|
||||
RegistraScript("$('#DivAddMercancia').modal('show');", "M1")
|
||||
@@ -34515,9 +34638,45 @@ Partial Class Ventas
|
||||
GvMercanciasCP.DataSource = DtMercancias
|
||||
GvMercanciasCP.DataBind()
|
||||
|
||||
If ChkAgregarFlete.Checked Then
|
||||
Dim CvePSServicio As Integer = DdlPSFlete.SelectedValue.ToEntero()
|
||||
If CvePSServicio > 0 Then
|
||||
Dim Cantidad As Decimal = TxtCantidadMercancia.Text.ToDecimal
|
||||
Dim PU As Decimal = TxtPrecioMercancia.Text.Trim.ToDecimal
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim CveUM As Integer = -1
|
||||
Dim UnidadMedida As String = ""
|
||||
Dim CveClasificacion As Integer = -1
|
||||
Dim Clasificacion As String = ""
|
||||
|
||||
Dim drPSFlete As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSServicio).FiltroPrimero("")
|
||||
If DrPS IsNot Nothing Then
|
||||
CveUM = drPSFlete("CveUnidadMedida").ToString().ToEntero()
|
||||
CveClasificacion = drPSFlete("CveClasificacion").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
Dim CveSubProyecto As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
|
||||
Dim CveProyecto = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProyecto", "").ToEntero()
|
||||
|
||||
Dim Proyecto As String = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, CveProyecto, UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("Proyecto", "").ToString()
|
||||
|
||||
AgregarProductoServicio(Cantidad, CveUM, UnidadMedida, CveClasificacion, Clasificacion,
|
||||
CvePSServicio, "", TxtObservacionesMercancia.Text.Trim, PU, Descuento,
|
||||
CveProyecto, Proyecto, CveSubProyecto, DdlSubProyectoDatos.SelectedItem.Text,
|
||||
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1,
|
||||
ImporteProntoPago:=0)
|
||||
|
||||
CalculaUsados()
|
||||
|
||||
CalculaTotalesVenta()
|
||||
Else
|
||||
Alert("No se agrego el servicio del flete", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
TxtCantidadMercancia.Text = ""
|
||||
DdlPSMercancia.SelectedValue = ""
|
||||
DdlPSMercancia.SelectedText = "Seleccione"
|
||||
TxtObservacionesMercancia.Text = ""
|
||||
|
||||
UpAgregarMercancia.Update()
|
||||
UpEmitirTransitorio.Update()
|
||||
@@ -34580,5 +34739,109 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub ChkEmitirCartaPorte_CheckedChanged(sender As Object, e As EventArgs)
|
||||
If ChkEmitirCartaPorte.Checked AndAlso CveCliente > 0 Then
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then
|
||||
TmpDTDireccionCP = ObjClientes.DtResultados.FiltraParametros(String.Format("Estatus = 1"))
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
Else
|
||||
TmpDTDireccionCP = Nothing
|
||||
End If
|
||||
|
||||
DdlDireccionOrigen.DataSource = TmpDTDireccionCP
|
||||
DdlDireccionOrigen.DataBind()
|
||||
|
||||
DdlDireccionDestino.DataSource = TmpDTDireccionCP
|
||||
DdlDireccionDestino.DataBind()
|
||||
End Sub
|
||||
Protected Sub ChkAgregarFlete_CheckedChanged(sender As Object, e As EventArgs)
|
||||
|
||||
DivServicioFlete.Visible = ChkAgregarFlete.Checked
|
||||
|
||||
UpAgregarMercancia.Update()
|
||||
End Sub
|
||||
Protected Sub DdlPSMercancia_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPSMercancia.selectedindexchange
|
||||
Dim CvePSParametro As Integer = DdlPSMercancia.SelectedValue.ToEntero()
|
||||
If CvePSParametro > 0 Then
|
||||
|
||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSMercancia.SelectedValue.ToEntero()).FiltroPrimero("")
|
||||
If drPS IsNot Nothing Then
|
||||
Dim CveClasificacion As Integer = drPS("CveClasificacion").ToString().ToEntero()
|
||||
'SUGIERE PRECIO
|
||||
Dim PrecioSugerido As Decimal = 0
|
||||
Dim tPrecioSugerido As Decimal = 0
|
||||
tPrecioSugerido = drPS("Precio").ToString().ToDecimal
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(1) Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPorcentajeProductos(CveCliente) Then
|
||||
Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal
|
||||
If PrecioAplicado > 0 Then
|
||||
PrecioSugerido = PrecioAplicado
|
||||
End If
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente
|
||||
Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero
|
||||
' si es 10. primero el cliente
|
||||
Dim CvePrecioListaPS As Integer
|
||||
Dim PorcentajePrecio As Decimal = 0
|
||||
|
||||
If TipoPrecioLista = 10 Then
|
||||
|
||||
CvePrecioListaPS = Me.CvePrecioListaCliente
|
||||
If CvePrecioListaPS <= 0 Then
|
||||
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
|
||||
End If
|
||||
Else
|
||||
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
|
||||
If CvePrecioListaPS <= 0 Then
|
||||
CvePrecioListaPS = Me.CvePrecioListaCliente 'GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
|
||||
End If
|
||||
End If
|
||||
|
||||
If CvePrecioListaPS > 0 Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
|
||||
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
|
||||
PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
End If
|
||||
|
||||
If PrecioSugerido = 0 Then
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
|
||||
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
|
||||
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
|
||||
ObjInventarios.Dispose()
|
||||
If CostoPS > 0 And PorcentajePrecio > 0 Then
|
||||
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
|
||||
End If
|
||||
End If
|
||||
CvePrecioLista = CvePrecioListaPS
|
||||
End If
|
||||
|
||||
|
||||
If PrecioSugerido > 0 Then
|
||||
Dim PrecioBaseCosto As Decimal = 0
|
||||
PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal
|
||||
|
||||
If PrecioBaseCosto > 0 Then
|
||||
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
|
||||
End If
|
||||
End If
|
||||
|
||||
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
|
||||
|
||||
TxtPrecioMercancia.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user