This commit is contained in:
2020-01-22 20:14:54 -07:00
7 changed files with 301 additions and 38 deletions

View File

@@ -792,6 +792,69 @@ Public Class ClsAcumuladores
#End Region
#Region "P O L I Z A - V I R T U A L"
Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal,
TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime,
CvePSUsado As Integer, CveBCIUsado As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@Cantidad", SqlDbType.Float).Value = Cantidad
.Add("@PU", SqlDbType.Money).Value = PU
.Add("@Descuento", SqlDbType.Money).Value = Descuento
.Add("@Total", SqlDbType.Money).Value = Total
.Add("@TipoServicio", SqlDbType.Int).Value = TipoServicio
.Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza
.Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto
.Add("@AnioVehiculo", SqlDbType.Int).Value = AnioVehiculo
.Add("@TieneUsado", SqlDbType.Bit).Value = TieneUsado
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
.Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado
.Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un al agregar la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetPolizasVirtuales(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un al obtener la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdateEnvioPolizaVirutal(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual
.Add("@Envio", SqlDbType.TinyInt).Value = Envio
.Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region #End Region
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,

View File

@@ -1349,6 +1349,13 @@ Namespace Modelos
End If End If
End If End If
If DtPolizasVirtuales IsNot Nothing Then
If DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
Dim RowPoliza As DataRow = DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
End If
'Agregamos el gasto de contrato 'Agregamos el gasto de contrato
If factura.CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then If factura.CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then
Dim ObjContrato As New ClsContratos Dim ObjContrato As New ClsContratos
@@ -1376,7 +1383,7 @@ Namespace Modelos
End If End If
Next Next
'Bonificacion Usados 'BONIFICACION USADOS
If UsadosBonificacion IsNot Nothing AndAlso UsadosBonificacion.Count > 0 AndAlso TipoBonificacion > 0 Then If UsadosBonificacion IsNot Nothing AndAlso UsadosBonificacion.Count > 0 AndAlso TipoBonificacion > 0 Then
For Each CveMovto In UsadosBonificacion For Each CveMovto In UsadosBonificacion
If Not ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, TipoBonificacion, CveVenta) Then If Not ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, TipoBonificacion, CveVenta) Then
@@ -1385,7 +1392,7 @@ Namespace Modelos
Next Next
End If End If
'Ajustes' 'AJUSTES'
If DtAjustes IsNot Nothing AndAlso DtAjustes.Rows.Count > 0 Then If DtAjustes IsNot Nothing AndAlso DtAjustes.Rows.Count > 0 Then
For Each Dr As DataRow In DtAjustes.Rows For Each Dr As DataRow In DtAjustes.Rows
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero, If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
@@ -1396,7 +1403,14 @@ Namespace Modelos
Next Next
End If End If
'Orden Produccion' 'POLIZA VIRTUAL
If factura.DtPolizasVirtuales IsNot Nothing AndAlso factura.DtPolizasVirtuales.Rows.Count > 0 Then
If Not GuardarPolizasVirtuales(ObjVentas.IniciaTransacSQL(), ObjFactura:=factura) Then
ErrorList.Add("Ocurrió un error al actualizar el distribuidor.")
End If
End If
'ORDEN PRODUCCION'
If UsuarioActual.CveEmpresa.Contiene(126) Then If UsuarioActual.CveEmpresa.Contiene(126) Then
If ObjVentas.CveVenta > 0 And factura.CveOrdenProduccion > 0 Then If ObjVentas.CveVenta > 0 And factura.CveOrdenProduccion > 0 Then
If Not ObjCGame.UpdateOrdenProduccionVenta(factura.CveOrdenProduccion, ObjVentas.CveVenta) Then If Not ObjCGame.UpdateOrdenProduccionVenta(factura.CveOrdenProduccion, ObjVentas.CveVenta) Then
@@ -1861,6 +1875,27 @@ Namespace Modelos
Return Resultado Return Resultado
End Function
Private Function GuardarPolizasVirtuales(SqlTransaccion As SqlClient.SqlTransaction, ObjFactura As Modelos.Factura) As Boolean
Dim Resultado As Boolean = True
If UsuarioActual.Empresa.Funcionalidad(531).ToEntero > 0 AndAlso ObjFactura.TipoDocto.Contiene("Rem") Then
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows
If ObjAcum.AddPolizaVirtual(ObjFactura.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),
drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then
Else
Resultado = False
Exit For
End If
Next
End If
Return Resultado
End Function End Function
Private Sub GuardarVentaPrePolizas(ByRef factura As Modelos.Factura, ByRef ObjConta As ClsContabilidad, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing) Private Sub GuardarVentaPrePolizas(ByRef factura As Modelos.Factura, ByRef ObjConta As ClsContabilidad, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing)
@@ -5132,6 +5167,7 @@ Namespace Modelos
Public Property DtDetalleAC As Data.DataTable Public Property DtDetalleAC As Data.DataTable
Public Property DtAjustes As Data.DataTable Public Property DtAjustes As Data.DataTable
Public Property DtRecepcionUsados As Data.DataTable Public Property DtRecepcionUsados As Data.DataTable
Public Property DtPolizasVirtuales As Data.DataTable
Public Property DtVentasNC As Data.DataTable Public Property DtVentasNC As Data.DataTable
Public Property DtDeduccion As Data.DataTable Public Property DtDeduccion As Data.DataTable
Public Property DtFirmas As Data.DataTable Public Property DtFirmas As Data.DataTable

View File

@@ -9201,7 +9201,7 @@ Partial Class Clientes
Dim Serie As String = "" Dim Serie As String = ""
If FolioNotaCredito(Tipo) Then If FolioNotaCredito(Tipo) Then
Folio = -1 Folio = FolioNotaAcumulador
Serie = SerieNotaAcumulador Serie = SerieNotaAcumulador
End If End If
@@ -9220,8 +9220,8 @@ Partial Class Clientes
ObjFactura.TipoDocto = "RNC" ObjFactura.TipoDocto = "RNC"
ObjFactura.Folio = Folio ObjFactura.Folio = Folio
ObjFactura.Serie = Serie ObjFactura.Serie = Serie
ObjFactura.Fecha = Now ObjFactura.Fecha = Now
ObjFactura.CvePrePoliza = -1 ObjFactura.CvePrePoliza = -1
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero

View File

@@ -2664,12 +2664,30 @@
<div id="DivRecepcionUsados" runat="server"> <div id="DivRecepcionUsados" runat="server">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-6">
<label>Modelo:</label> <label>Modelo:</label>
<br /> <br />
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto"> <asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList> </asp:DropDownList>
</div> </div>
<div class="col-md-6">
<label>Año:</label>
<br />
<asp:TextBox ID="TxtAnioVehiculo" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true" MaxLength="500"></asp:TextBox>
</div>
</div>
<div class ="row">
<div class="col-md-6">
<label>Tipo Servicio:</label>
<br />
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Particular" Value="1"></asp:ListItem>
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-6"></div>
</div> </div>
<br /> <br />

View File

@@ -859,6 +859,14 @@ Partial Class PV
ViewState("TmpDTRecepcionUsados") = value ViewState("TmpDTRecepcionUsados") = value
End Set End Set
End Property End Property
Private Property TmpDTPolizaVirtual As DataTable
Get
Return If(IsNothing(ViewState("TmpDTPolizaVirtual")), Nothing, CType(ViewState("TmpDTPolizaVirtual"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTPolizaVirtual") = value
End Set
End Property
Private Property TmpDTImpuestos As DataTable Private Property TmpDTImpuestos As DataTable
Get Get
Return If(IsNothing(ViewState("TmpDTImpuestos")), Nothing, CType(ViewState("TmpDTImpuestos"), DataTable)) Return If(IsNothing(ViewState("TmpDTImpuestos")), Nothing, CType(ViewState("TmpDTImpuestos"), DataTable))
@@ -2547,6 +2555,8 @@ Partial Class PV
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
ObjFactura.DtPolizasVirtuales = TmpDTPolizaVirtual
ObjFactura.GenerarPDFFactura = False ObjFactura.GenerarPDFFactura = False
Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22) Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22)
@@ -3734,13 +3744,14 @@ Partial Class PV
ChkAgregar.Checked = False ChkAgregar.Checked = False
divagregrarotrops.Visible = False divagregrarotrops.Visible = False
Ajuste() Ajuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
UpVenta.Update() UpVenta.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta") RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
End Sub End Sub
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
If AgregarPS() Then If AgregarPS() Then
If ChkAjuste.Checked Then GuardaAjuste() If ChkAjuste.Checked Then GuardaAjuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
CalculaTotalesVenta() CalculaTotalesVenta()
If ChkAgregar.Checked = True And Modalidad = "A" Then If ChkAgregar.Checked = True And Modalidad = "A" Then
@@ -5053,6 +5064,7 @@ Partial Class PV
CreaDTmpDTAjustes() CreaDTmpDTAjustes()
CreaDTmpDTRecepcionUsados() CreaDTmpDTRecepcionUsados()
CreaDTmpDTPolizaVirtual()
CargaBCIAjuste() CargaBCIAjuste()
DdlDistribuidor.setEsWebService(True) DdlDistribuidor.setEsWebService(True)
DivChkAjuste.Visible = True DivChkAjuste.Visible = True
@@ -5478,6 +5490,101 @@ Partial Class PV
#End Region #End Region
#Region "P O L I Z A - V I R T U A L"
Private Sub CreaDTmpDTPolizaVirtual()
TmpDTPolizaVirtual = New DataTable
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("Descuento", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("Total", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TipoServicio", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TipoPoliza", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveModeloAuto", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("AnioVehiculo", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TieneUsado", GetType(Boolean))
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
End Sub
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
Dim Retorno As Boolean = False
'Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero()
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal()
Dim PU As Decimal = TxtPrecio.Text.ToDecimal()
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
Dim Elimino As Boolean = False
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
RowPoliza.Delete()
Elimino = True
End If
Next
If Elimino Then
TmpDTRecepcionUsados.AcceptChanges()
End If
End If
End If
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime()
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
Dim TipoPoliza As Integer = 1
If ChkAjuste.Checked Then
If Total = ImporteAjuste Then
TipoPoliza = 3
Else
TipoPoliza = 2
End If
End If
Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
Dim CvePSUsado As Integer = -1
Dim CveBCIUsado As Integer = -1
If TieneUsado Then
For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
CvePS = GvRow.DataKey("CvePSCargo").ToEntero()
CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
Exit For
End If
End If
Next
End If
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
Row("CvePS") = CvePS
Row("Cantidad") = Cantidad
Row("PU") = PU
Row("Descuento") = Descuento
Row("Total") = Total
Row("CveVentaDetalle") = -1
Row("TipoServicio") = TipoServicio
Row("TipoPoliza") = TipoPoliza
Row("CveModeloAuto") = CveModeloAuto
Row("AnioVehiculo") = AnioVehiculo
Row("TieneUsado") = TieneUsado
Row("FechaUsado") = FechaUsado
Row("CvePSUsado") = CvePSUsado
Row("CveBCIUsado") = CveBCIUsado
TmpDTPolizaVirtual.Rows.Add(Row)
Return Retorno
End Function
#End Region
#Region "U S A D O S" #Region "U S A D O S"
Private Sub CreaDTmpDTRecepcionUsados() Private Sub CreaDTmpDTRecepcionUsados()
@@ -5492,6 +5599,7 @@ Partial Class PV
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer)) TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
End Sub End Sub
Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs) Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs)
'CalculaRecepcionUsados(GvRecepcionUsadosModal) 'CalculaRecepcionUsados(GvRecepcionUsadosModal)

View File

@@ -356,6 +356,9 @@
<li> <li>
<asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton> <asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton runat="server" ID="LnkEnviarPolizaVirtual" Visible="false" OnClick="LnkEnviarPolizaVirtual_Click">Enviar Poliza Virtual</asp:LinkButton>
</li>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
@@ -1301,7 +1304,7 @@
<ContentTemplate> <ContentTemplate>
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GvCodigosUnicos" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False" <asp:GridView ID="GvCodigosUnicos" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False"
DataKeyNames="SerieLote,IdProductoPolizaVirtual,FechaAjuste,IdModelo,IdBCI" ClientIDMode="Static" EmptyDataText="" GridLines="None"> DataKeyNames="CvePolizaVirtual,SerieLote,IdProductoPolizaVirtual,Total,Descuento,AnioVehiculo,FechaUsado,IdModeloAuto,IdMarcaAuto,IdBCI,TipoServicio,TipoPoliza,TieneUsado" ClientIDMode="Static" EmptyDataText="" GridLines="None">
<Columns> <Columns>
<asp:TemplateField HeaderText="Código Único"> <asp:TemplateField HeaderText="Código Único">
<ItemTemplate> <ItemTemplate>

View File

@@ -23934,11 +23934,20 @@ Partial Class Ventas
#Region "P O L I Z A - V I R T U A L" #Region "P O L I Z A - V I R T U A L"
Private Sub CargaCodigoUnico() Private Sub CargaCodigoUnico()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
Dim ObjAcum As New ClsAcumuladores Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasPolizaVirtual(Me.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then If ObjAcum.GetPolizasVirtuales(Me.CveVenta) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
GvCodigosUnicos.DataSource = ObjAcum.DtResultados Dim RowPoliza As DataRow = ObjAcum.DtResultados.Rows(0)
DivCodigosUnicos.Visible = True
If DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
GvCodigosUnicos.DataSource = ObjAcum.DtResultados
DivCodigosUnicos.Visible = True
End If
If Not CBool(RowPoliza("Enviada").ToString()) Then
LnkEnviarPolizaVirtual.Visible = True
End If
End If End If
ObjAcum.Dispose() ObjAcum.Dispose()
GvCodigosUnicos.DataBind() GvCodigosUnicos.DataBind()
@@ -23946,47 +23955,56 @@ Partial Class Ventas
End Sub End Sub
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura) Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
Try Try
'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía
Dim TipoPoliza As Integer = 0
For Each Row As GridViewRow In GvCodigosUnicos.Rows For Each Row As GridViewRow In GvCodigosUnicos.Rows
If Row.RowType = DataControlRowType.DataRow Then If Row.RowType = DataControlRowType.DataRow Then
Dim CvePolizaVirtual As Integer = Row.DataKey("CvePolizaVirtual").ToEntero()
Dim obj As New Modelos.MPolizaVentaWS Dim obj As New Modelos.MPolizaVentaWS
'DATOS DEL CLIENTE 'DATOS DEL CLIENTE
obj.customer_name = ObjFactura.Cliente.Nombre obj.customer_name = ObjFactura.Cliente.Nombre
obj.customer_last_name1 = "" obj.customer_last_name1 = "."
obj.customer_last_name2 = "" obj.customer_last_name2 = ""
obj.customer_birthday = Nothing obj.customer_birthday = Nothing
obj.customer_phone = ObjFactura.Cliente.Telefono obj.customer_phone = ObjFactura.Cliente.Telefono
obj.customer_email = ObjFactura.Cliente.Mail obj.customer_email = ObjFactura.Cliente.Mail
obj.customer_gender = "03" 'OTRO GENERO obj.customer_gender = "03" 'OTRO GENERO
obj.customer_advertising = False obj.customer_advertising = False
obj.customer_car_brand = "00" obj.customer_car_brand = Row.DataKey("IdMarcaAuto").ToString().Trim()
obj.customer_car_model = "00" obj.customer_car_model = Row.DataKey("IdModeloAuto").ToString().Trim()
obj.customer_car_year = ObjFactura.Fecha.Year obj.customer_car_year = Row.DataKey("AnioVehiculo").ToString().ToEntero()
'DATOS DE VENTA 'DATOS DE VENTA
obj.sale_date = ObjFactura.Fecha obj.sale_date = ObjFactura.Fecha
obj.sale_paidby = "01" obj.sale_paidby = "01"
obj.sale_type = "01" 'PISO obj.sale_type = "01" 'PISO
obj.sale_type_service = "02" 'COMERCIAL obj.sale_type_service = "0" & Row.DataKey("TipoServicio").ToString().Trim()
obj.sale_total = ObjFactura.Total obj.sale_total = Row.DataKey("Total").ToString().ToDecimal()
obj.sale_discount = ObjFactura.Descuento obj.sale_discount = Row.DataKey("Descuento").ToString().ToDecimal()
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta) obj.sale_id = ObjFactura.CveVenta.ToString
'DATOS DEL PRODUCTO 'DATOS DEL PRODUCTO
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString() obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString().Trim()
obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text 'se indique el código único de la batería. (SERIE LOTE) obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text.Trim() 'se indique el código único de la batería. (SERIE LOTE)
obj.product_sale_type = "01 " 'VENTA obj.product_sale_type = "0" & Row.DataKey("TipoPoliza").ToString().Trim()
Dim FechaUsado As DateTime = Row.DataKey("FechaAjuste").ToString().ToDateTime()
'DATOS DE USADO 'DATOS DE USADO
obj.used_product = True obj.used_product = CBool(Row.DataKey("TieneUsado").ToString())
obj.used_brand = Row.DataKey("IdModelo").ToString() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString() 'VALOR DEL BCI If obj.used_product Then
obj.used_month = FechaUsado.Month Dim FechaUsado As DateTime = Row.DataKey("FechaUsado").ToString().ToDateTime()
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado obj.used_brand = Row.DataKey("IdModelo").ToString().Trim() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString().Trim() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado
End If
EnviarPolizaVentaWS(obj, CvePolizaVirtual)
EnviarPolizaVentaWS(obj)
End If End If
Next Next
Catch ex As Exception Catch ex As Exception
@@ -23996,11 +24014,11 @@ Partial Class Ventas
End Sub End Sub
Protected Function EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS) As Boolean Protected Function EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS, CvePolizaVirtual As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
Dim Respuesta As String = "[]" Dim Respuesta As String = "[]"
Dim User As String = "cslth.2809@jcilink.com" Dim User As String = "cslth.7777@lth.com"
Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076" Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076"
Try Try
@@ -24047,13 +24065,22 @@ Partial Class Ventas
Dim resp = JArray.Parse(Respuesta) Dim resp = JArray.Parse(Respuesta)
If resp.Count > 0 Then If resp.Count > 0 Then
Dim Msg = resp(0)("Descripcion").ToString() Dim Msg As New StringBuilder()
Msg.AppendFormat("Mensaje Poliza Virtual: {0}", resp(0)("Descripcion").ToString())
If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then
Alert(Msg, TipoMensaje.MsgInformacion)
Retorno = True Retorno = True
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, True, Now) Then
Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
End If
ObjAcum.Dispose()
Else Else
Alert(Msg, TipoMensaje.MsgAdvertencia) Dim ObjAcum As New ClsAcumuladores
If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, False, Now) Then
Alert(Msg.ToString(), TipoMensaje.MsgAdvertencia)
End If
ObjAcum.Dispose()
End If End If
Else Else
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
@@ -24067,6 +24094,13 @@ Partial Class Ventas
Return Retorno Return Retorno
End Function End Function
Protected Sub LnkEnviarPolizaVirtual_Click(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(576) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contains("Rem") Then
CreaObjetosVenta()
GeneraPolizaVentaWS(ObjFactura)
End If
End Sub
#End Region #End Region
Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -24105,4 +24139,5 @@ Partial Class Ventas
End If End If
End Sub End Sub
End Class End Class