Facturacion de usados de cotizaciones
This commit is contained in:
@@ -3493,7 +3493,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr align="left" id="TrKilometraje" runat="server" visible="false">
|
<tr align="left" id="TrKilometraje" runat="server" visible="false">
|
||||||
<td>Kilometraje
|
<td>Kilometraje
|
||||||
<asp:TextBox ID="TxtKilometraje" runat="server" Width="250px" CssClass="form-control input-sm"></asp:TextBox></td>
|
<asp:TextBox ID="TxtKilometraje" runat="server" Width="250px" CssClass="form-control input-sm" MaxLength="6" CausesValidation="true" Text="000000"></asp:TextBox>
|
||||||
|
<ajax:MaskedEditExtender ID="MEEKilometraje" runat="server" TargetControlID="TxtKilometraje" ClearMaskOnLostFocus="false" MaskType="Number" Mask="999999" MessageValidatorTip="true" InputDirection="LeftToRight" ErrorTooltipEnabled="True"></ajax:MaskedEditExtender>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr align="left" id="trCorreoNotif1" runat="server" visible="false">
|
<tr align="left" id="trCorreoNotif1" runat="server" visible="false">
|
||||||
<td id="Td1" runat="server">Correo Notificación Usuario Final: </td>
|
<td id="Td1" runat="server">Correo Notificación Usuario Final: </td>
|
||||||
|
|||||||
@@ -1290,6 +1290,15 @@ Partial Class Ventas
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Property CveVentaUsadoDevolucionEfectivo As Integer
|
||||||
|
Get
|
||||||
|
Return If(IsNothing(ViewState("CveVentaUsadoDevolucionEfectivo")), 0, CType(ViewState("CveVentaUsadoDevolucionEfectivo"), Integer))
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
ViewState("CveVentaUsadoDevolucionEfectivo") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Propiedades PuntoVenta"
|
#Region "Propiedades PuntoVenta"
|
||||||
@@ -7236,6 +7245,13 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then
|
||||||
|
If TxtKilometraje.Text.Length < 6 Then
|
||||||
|
Alert("El kilometraje debe tener 6 digitos.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'CUANDO ES COTIZACION Y SE VA A FACTURAR SE HACE INGRESO
|
'CUANDO ES COTIZACION Y SE VA A FACTURAR SE HACE INGRESO
|
||||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar" Then
|
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar" Then
|
||||||
DdlTipoComprobante.SelectedValue = "Ing"
|
DdlTipoComprobante.SelectedValue = "Ing"
|
||||||
@@ -10774,6 +10790,13 @@ Partial Class Ventas
|
|||||||
Me.AplicaRelacionManual = False
|
Me.AplicaRelacionManual = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'SI SE SELECCIONO UNA FACTURA PARA DEVOLUCION DE EFECTIVO DEBE ASOCIARLA A LA NOTA DE CREDITO
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Egs" AndAlso Me.CveVentaUsadoDevolucionEfectivo > 0 Then
|
||||||
|
If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVentaUsadoDevolucionEfectivo) Then
|
||||||
|
ErrorList.Add("Ocurrió un error al relacionar la venta de devolución de efectivo entre si.")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(280) = "1" And RblPaqueteria.SelectedValue = "1" And Not factura.TipoDocto.Contiene("Rem", "Ped") Then
|
If UsuarioActual.Empresa.Funcionalidad(280) = "1" And RblPaqueteria.SelectedValue = "1" And Not factura.TipoDocto.Contiene("Rem", "Ped") Then
|
||||||
NotificarPaqueteria()
|
NotificarPaqueteria()
|
||||||
End If
|
End If
|
||||||
@@ -19123,7 +19146,7 @@ Partial Class Ventas
|
|||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||||
Dim sb As New StringBuilder()
|
Dim sb As New StringBuilder()
|
||||||
|
|
||||||
If Not String.IsNullOrEmpty(FolioFiscal) Then
|
If Not String.IsNullOrEmpty(FolioFiscal) AndAlso Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then
|
||||||
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
||||||
|
|
||||||
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
|
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
|
||||||
@@ -24675,9 +24698,14 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
|
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
|
||||||
If UsuarioActual.CveEmpresa = 140 Then
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
|
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
|
||||||
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
If ClienteEsDistribuidor AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then
|
||||||
|
Alert("No se puede generar una nota de crédito para devolución de efectivo si el cliente es distribuidor.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Else
|
||||||
|
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||||
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
AplicarNotaCreditoDesdeVenta()
|
AplicarNotaCreditoDesdeVenta()
|
||||||
End If
|
End If
|
||||||
@@ -24694,6 +24722,8 @@ Partial Class Ventas
|
|||||||
Private Sub AplicarNotaCreditoDesdeVenta(Optional AplicaNuevoDocumento As Boolean = False)
|
Private Sub AplicarNotaCreditoDesdeVenta(Optional AplicaNuevoDocumento As Boolean = False)
|
||||||
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
||||||
|
|
||||||
|
CveVentaUsadoDevolucionEfectivo = -1
|
||||||
|
|
||||||
DdlTipoComprobante.SelectedValue = "Egs"
|
DdlTipoComprobante.SelectedValue = "Egs"
|
||||||
Dim AplicaImpuestosLocales As Boolean = False
|
Dim AplicaImpuestosLocales As Boolean = False
|
||||||
|
|
||||||
@@ -24722,6 +24752,11 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
|
'SI SE SELECCIONO UNA FACTURA PARA DEVOLUCION DE EFECTIVO DEBE ASOCIARLA A LA NOTA DE CREDITO
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso AplicaNuevoDocumento AndAlso DdlVentaUsado.SelectedValue.ToEntero() > 0 AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then
|
||||||
|
CveVentaUsadoDevolucionEfectivo = DdlVentaUsado.SelectedValue.ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True)
|
AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -26688,6 +26723,9 @@ Partial Class Ventas
|
|||||||
Dim Cves As New StringBuilder
|
Dim Cves As New StringBuilder
|
||||||
Dim CveMetodoPago As Integer = -1
|
Dim CveMetodoPago As Integer = -1
|
||||||
Dim MetodoPagoDif As Boolean = False
|
Dim MetodoPagoDif As Boolean = False
|
||||||
|
|
||||||
|
Dim ListaVentaDetalleCotizacion As List(Of MVentaDetalleCotizacion) = Nothing
|
||||||
|
|
||||||
If ChkCotProductos.Checked Then
|
If ChkCotProductos.Checked Then
|
||||||
For Each row As DataRow In DTSeleccionadas.Rows
|
For Each row As DataRow In DTSeleccionadas.Rows
|
||||||
If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then
|
If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then
|
||||||
@@ -26702,7 +26740,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'CARGA LOS USADOS RELACIONADOS A LOS PRODUCTOS SELECCIONADOS DE LA COTIZACION
|
'CARGA LOS USADOS RELACIONADOS A LOS PRODUCTOS SELECCIONADOS DE LA COTIZACION
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones)
|
ListaVentaDetalleCotizacion = CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -26728,6 +26766,18 @@ Partial Class Ventas
|
|||||||
ObjClientes.Dispose()
|
ObjClientes.Dispose()
|
||||||
Cves.Clear()
|
Cves.Clear()
|
||||||
|
|
||||||
|
'SI SE CALCULARON USADOS LA CANTIDAD DEBE ASIGNARSE A PARTIR DEL CALCULO
|
||||||
|
If ListaVentaDetalleCotizacion IsNot Nothing AndAlso ListaVentaDetalleCotizacion.Count > 0 Then
|
||||||
|
|
||||||
|
For Each Dr As DataRow In DtCotizacionesPS.Rows
|
||||||
|
Dim VentaDetalle = ListaVentaDetalleCotizacion.FirstOrDefault(Function(cot) cot.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero())
|
||||||
|
If VentaDetalle IsNot Nothing Then
|
||||||
|
Dr("Cantidad") = VentaDetalle.Cantidad
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
If Not AgregaPSCotizacion() Then
|
If Not AgregaPSCotizacion() Then
|
||||||
Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -26749,14 +26799,29 @@ Partial Class Ventas
|
|||||||
UpPS.Update()
|
UpPS.Update()
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Class MVentaDetalleCotizacion
|
||||||
|
Public Property CveVentaDetalle As Integer
|
||||||
|
Public Property Cantidad As Decimal
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Private Function CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) As List(Of MVentaDetalleCotizacion)
|
||||||
|
Dim Retorno As New List(Of MVentaDetalleCotizacion)
|
||||||
|
|
||||||
Private Sub CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable)
|
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
||||||
|
|
||||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||||
|
|
||||||
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||||
|
|
||||||
|
|
||||||
|
For Each Dr As DataRow In DTSeleccionadas.Rows
|
||||||
|
Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
||||||
|
Dr("Cantidad") = tCantidad
|
||||||
|
|
||||||
|
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad})
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
||||||
|
|
||||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||||
@@ -26812,11 +26877,15 @@ Partial Class Ventas
|
|||||||
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
||||||
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
||||||
|
|
||||||
|
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()})
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
Private Sub VerificaCotizaciones(ByRef dt As DataTable)
|
Private Sub VerificaCotizaciones(ByRef dt As DataTable)
|
||||||
If ChkCotProductos.Checked Then
|
If ChkCotProductos.Checked Then
|
||||||
For Each Gvr As GridViewRow In GvCotPS.Rows
|
For Each Gvr As GridViewRow In GvCotPS.Rows
|
||||||
@@ -26862,7 +26931,12 @@ Partial Class Ventas
|
|||||||
If DtCotizacionesPS IsNot Nothing Then
|
If DtCotizacionesPS IsNot Nothing Then
|
||||||
Dim tCantidad As Decimal = 0
|
Dim tCantidad As Decimal = 0
|
||||||
For Each Dr As DataRow In DtCotizacionesPS.Select()
|
For Each Dr As DataRow In DtCotizacionesPS.Select()
|
||||||
tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
tCantidad = Dr("Cantidad").ToString().ToDecimal()
|
||||||
|
Else
|
||||||
|
tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(),
|
AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(),
|
||||||
Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal,
|
Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal,
|
||||||
Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),
|
Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user