Poliza Virtual en Ventas
This commit is contained in:
@@ -9201,7 +9201,7 @@ Partial Class Clientes
|
||||
Dim Serie As String = ""
|
||||
|
||||
If FolioNotaCredito(Tipo) Then
|
||||
Folio = -1
|
||||
Folio = FolioNotaAcumulador
|
||||
Serie = SerieNotaAcumulador
|
||||
End If
|
||||
|
||||
@@ -9220,8 +9220,8 @@ Partial Class Clientes
|
||||
ObjFactura.TipoDocto = "RNC"
|
||||
|
||||
ObjFactura.Folio = Folio
|
||||
|
||||
ObjFactura.Serie = Serie
|
||||
|
||||
ObjFactura.Fecha = Now
|
||||
ObjFactura.CvePrePoliza = -1
|
||||
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero
|
||||
|
||||
@@ -2664,12 +2664,30 @@
|
||||
<div id="DivRecepcionUsados" runat="server">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-6">
|
||||
<label>Modelo:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
|
||||
</asp:DropDownList>
|
||||
</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>
|
||||
|
||||
<br />
|
||||
|
||||
@@ -859,6 +859,14 @@ Partial Class PV
|
||||
ViewState("TmpDTRecepcionUsados") = value
|
||||
End Set
|
||||
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
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTImpuestos")), Nothing, CType(ViewState("TmpDTImpuestos"), DataTable))
|
||||
@@ -2547,6 +2555,8 @@ Partial Class PV
|
||||
|
||||
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
|
||||
|
||||
ObjFactura.DtPolizasVirtuales = TmpDTPolizaVirtual
|
||||
|
||||
ObjFactura.GenerarPDFFactura = False
|
||||
|
||||
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
|
||||
divagregrarotrops.Visible = False
|
||||
Ajuste()
|
||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||
UpVenta.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
|
||||
End Sub
|
||||
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
|
||||
If AgregarPS() Then
|
||||
If ChkAjuste.Checked Then GuardaAjuste()
|
||||
|
||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||
CalculaTotalesVenta()
|
||||
|
||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
||||
@@ -5053,6 +5064,7 @@ Partial Class PV
|
||||
|
||||
CreaDTmpDTAjustes()
|
||||
CreaDTmpDTRecepcionUsados()
|
||||
CreaDTmpDTPolizaVirtual()
|
||||
CargaBCIAjuste()
|
||||
DdlDistribuidor.setEsWebService(True)
|
||||
DivChkAjuste.Visible = True
|
||||
@@ -5478,6 +5490,101 @@ Partial Class PV
|
||||
|
||||
#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"
|
||||
|
||||
Private Sub CreaDTmpDTRecepcionUsados()
|
||||
@@ -5492,6 +5599,7 @@ Partial Class PV
|
||||
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs)
|
||||
|
||||
'CalculaRecepcionUsados(GvRecepcionUsadosModal)
|
||||
|
||||
@@ -356,6 +356,9 @@
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkEnviarPolizaVirtual" Visible="false" OnClick="LnkEnviarPolizaVirtual_Click">Enviar Poliza Virtual</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
|
||||
@@ -1301,7 +1304,7 @@
|
||||
<ContentTemplate>
|
||||
<div class="col-md-12">
|
||||
<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>
|
||||
<asp:TemplateField HeaderText="Código Único">
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -23931,11 +23931,20 @@ Partial Class Ventas
|
||||
|
||||
#Region "P O L I Z A - V I R T U A L"
|
||||
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
|
||||
If ObjAcum.GetGarantiasPolizaVirtual(Me.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
|
||||
GvCodigosUnicos.DataSource = ObjAcum.DtResultados
|
||||
DivCodigosUnicos.Visible = True
|
||||
If ObjAcum.GetPolizasVirtuales(Me.CveVenta) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
|
||||
Dim RowPoliza As DataRow = ObjAcum.DtResultados.Rows(0)
|
||||
|
||||
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
|
||||
ObjAcum.Dispose()
|
||||
GvCodigosUnicos.DataBind()
|
||||
@@ -23943,47 +23952,56 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
|
||||
Try
|
||||
'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía
|
||||
Dim TipoPoliza As Integer = 0
|
||||
For Each Row As GridViewRow In GvCodigosUnicos.Rows
|
||||
If Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim CvePolizaVirtual As Integer = Row.DataKey("CvePolizaVirtual").ToEntero()
|
||||
|
||||
Dim obj As New Modelos.MPolizaVentaWS
|
||||
'DATOS DEL CLIENTE
|
||||
obj.customer_name = ObjFactura.Cliente.Nombre
|
||||
obj.customer_last_name1 = ""
|
||||
obj.customer_last_name1 = "."
|
||||
obj.customer_last_name2 = ""
|
||||
obj.customer_birthday = Nothing
|
||||
obj.customer_phone = ObjFactura.Cliente.Telefono
|
||||
obj.customer_email = ObjFactura.Cliente.Mail
|
||||
obj.customer_gender = "03" 'OTRO GENERO
|
||||
obj.customer_advertising = False
|
||||
obj.customer_car_brand = "00"
|
||||
obj.customer_car_model = "00"
|
||||
obj.customer_car_year = ObjFactura.Fecha.Year
|
||||
obj.customer_car_brand = Row.DataKey("IdMarcaAuto").ToString().Trim()
|
||||
obj.customer_car_model = Row.DataKey("IdModeloAuto").ToString().Trim()
|
||||
obj.customer_car_year = Row.DataKey("AnioVehiculo").ToString().ToEntero()
|
||||
|
||||
'DATOS DE VENTA
|
||||
obj.sale_date = ObjFactura.Fecha
|
||||
obj.sale_paidby = "01"
|
||||
obj.sale_type = "01" 'PISO
|
||||
obj.sale_type_service = "02" 'COMERCIAL
|
||||
obj.sale_total = ObjFactura.Total
|
||||
obj.sale_discount = ObjFactura.Descuento
|
||||
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta)
|
||||
obj.sale_type_service = "0" & Row.DataKey("TipoServicio").ToString().Trim()
|
||||
obj.sale_total = Row.DataKey("Total").ToString().ToDecimal()
|
||||
obj.sale_discount = Row.DataKey("Descuento").ToString().ToDecimal()
|
||||
obj.sale_id = ObjFactura.CveVenta.ToString
|
||||
|
||||
'DATOS DEL PRODUCTO
|
||||
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString()
|
||||
obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text 'se indique el código único de la batería. (SERIE LOTE)
|
||||
obj.product_sale_type = "01 " 'VENTA
|
||||
|
||||
Dim FechaUsado As DateTime = Row.DataKey("FechaAjuste").ToString().ToDateTime()
|
||||
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString().Trim()
|
||||
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 = "0" & Row.DataKey("TipoPoliza").ToString().Trim()
|
||||
|
||||
'DATOS DE USADO
|
||||
obj.used_product = True
|
||||
obj.used_brand = Row.DataKey("IdModelo").ToString() 'MARCAR DEL USADO
|
||||
obj.used_bci = Row.DataKey("IdBCI").ToString() 'VALOR DEL BCI
|
||||
obj.used_month = FechaUsado.Month
|
||||
obj.used_year = FechaUsado.Year
|
||||
obj.used_sale_date = FechaUsado
|
||||
obj.used_product = CBool(Row.DataKey("TieneUsado").ToString())
|
||||
|
||||
If obj.used_product Then
|
||||
Dim FechaUsado As DateTime = Row.DataKey("FechaUsado").ToString().ToDateTime()
|
||||
|
||||
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
|
||||
Next
|
||||
Catch ex As Exception
|
||||
@@ -23993,11 +24011,11 @@ Partial Class Ventas
|
||||
|
||||
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 Respuesta As String = "[]"
|
||||
|
||||
Dim User As String = "cslth.2809@jcilink.com"
|
||||
Dim User As String = "cslth.7777@lth.com"
|
||||
Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076"
|
||||
|
||||
Try
|
||||
@@ -24044,13 +24062,22 @@ Partial Class Ventas
|
||||
Dim resp = JArray.Parse(Respuesta)
|
||||
|
||||
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
|
||||
Alert(Msg, TipoMensaje.MsgInformacion)
|
||||
Retorno = True
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, True, Now) Then
|
||||
Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
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
|
||||
Else
|
||||
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
|
||||
@@ -24064,6 +24091,13 @@ Partial Class Ventas
|
||||
|
||||
Return Retorno
|
||||
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
|
||||
|
||||
Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
@@ -24102,4 +24136,5 @@ Partial Class Ventas
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user