Generar OC a partir de una cotizacion y modificar precios

This commit is contained in:
2020-02-26 19:01:27 -07:00
parent e34df69643
commit 017f404b32
5 changed files with 112 additions and 11 deletions

View File

@@ -1230,7 +1230,7 @@ Public Class ClsOC
pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0,
Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0,
Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0,
Optional IEPSPSIVAPorcentaje As Double = 0) As Boolean Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraDetalleAdd") DataAdapter("PA_OC_OrdenesCompraDetalleAdd")
@@ -1259,7 +1259,8 @@ Public Class ClsOC
.Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje
.Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
.Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion
End With End With
Try Try

View File

@@ -179,6 +179,25 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
Public Function GetVentasCotizacionesOC(CveVenta As Integer, CveOC As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasCotizacionesOCGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveOC", SqlDbType.Int).Value = CveOC
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener los datos de la cotizacion, VentaTerminal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetVentas(CveEmpresa As Integer, TipoDocto As String, Serie As String, Folio As Integer, Codigo As String, CveCliente As Integer, Public Function GetVentas(CveEmpresa As Integer, TipoDocto As String, Serie As String, Folio As Integer, Codigo As String, CveCliente As Integer,
CveSubProyecto As Integer, CveEstatus As Integer, CveUsuario As Integer, FechaI As String, FechaF As String, FolioFiscal As String, Optional CveClienteSucursal As Integer = -1, Optional CvePS As Integer = -1, Optional PedidoContrato As String = "-1", CveSubProyecto As Integer, CveEstatus As Integer, CveUsuario As Integer, FechaI As String, FechaF As String, FolioFiscal As String, Optional CveClienteSucursal As Integer = -1, Optional CvePS As Integer = -1, Optional PedidoContrato As String = "-1",
Optional OrdenCompra As String = "-1", Optional CveUsuarioConsulta As Integer = -1, Optional ClienteRFC As String = "-1", Optional OrdenCompra As String = "-1", Optional CveUsuarioConsulta As Integer = -1, Optional ClienteRFC As String = "-1",
@@ -3934,7 +3953,7 @@ Public Class ClsVentas
Return retorno Return retorno
End Function End Function
Public Function RepIngresosDetalle(CveEmpresa As Integer, FechaInicio As Date, FechaFin As Date, TipoDocto As String, CveSubProyecto As Integer, CveConceptoContable As Integer, CveCuenta As Integer) As Boolean Public Function RepIngresosDetalle(CveEmpresa As Integer, FechaInicio As Date, FechaFin As Date, TipoDocto As String, CveSubProyecto As Integer, CveConceptoContable As Integer, CveCuenta As Integer, TipoAmortizacion As Integer) As Boolean
Dim retorno As Boolean = False Dim retorno As Boolean = False
DataAdapter("PA_Ventas_RepIngresosDetalle", CommandType.StoredProcedure) DataAdapter("PA_Ventas_RepIngresosDetalle", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -3945,6 +3964,7 @@ Public Class ClsVentas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable
.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
.Add("@TipoAmortizacion", SqlDbType.Int).Value = TipoAmortizacion
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -534,6 +534,18 @@ Partial Class OC
End If End If
End If End If
Dim DtOCGeneradas As DataTable = Nothing
If ObjVentas.GetVentasCotizacionesOC(Me.CveVenta, -1, UsuarioActual.CveEmpresa) Then
DtOCGeneradas = ObjVentas.DtResultados.Copy()
End If
If DtOCGeneradas IsNot Nothing AndAlso DtOCGeneradas.Rows.Count > 0 Then
ObjVentas.Dispose()
BtnGuardar.Enabled = False
Alert("Ya existe una OC con esta cotización", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
CargaClasificacionesPopUp(CveCotizacion) CargaClasificacionesPopUp(CveCotizacion)
ObjVentas.Dispose() ObjVentas.Dispose()
End If End If
@@ -971,6 +983,8 @@ Partial Class OC
DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer)) DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer))
DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double)) DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double))
DtDetalle.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) 'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
' DtDetalle.Columns.Add("ClasificacionOG", GetType(String)) ' DtDetalle.Columns.Add("ClasificacionOG", GetType(String))
@@ -1040,6 +1054,10 @@ Partial Class OC
dr("CveTipoGasto") = -1 dr("CveTipoGasto") = -1
dr("CveClasificacionOG") = -1 dr("CveClasificacionOG") = -1
If UsuarioActual.Empresa.Funcionalidad(583) = "1" Then
dr("CveVentaDetalleCotizacion") = RowV("CveVentaDetalle")
End If
DtDetalle.Rows.Add(dr) DtDetalle.Rows.Add(dr)
Next Next
@@ -2318,7 +2336,7 @@ Partial Class OC
Dim OCBitacora As New ClsOIEventos(OC.IniciaTransacSQL()) Dim OCBitacora As New ClsOIEventos(OC.IniciaTransacSQL())
Dim ObjInventarios As New ClsInventarios(OC.IniciaTransacSQL()) Dim ObjInventarios As New ClsInventarios(OC.IniciaTransacSQL())
Dim ObjConta As New ClsContabilidad(OC.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(OC.IniciaTransacSQL())
Dim ObjVentas As New ClsVentas(OC.IniciaTransacSQL())
Dim Conta As ClsContPAQi = Nothing Dim Conta As ClsContPAQi = Nothing
If (UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto) Or UsuarioActual.Empresa.Funcionalidad(200) = "1" Then If (UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto) Or UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
Conta = New ClsContPAQi(UsuarioActual.Empresa) Conta = New ClsContPAQi(UsuarioActual.Empresa)
@@ -2361,7 +2379,12 @@ Partial Class OC
CveOrdenCompraPadre = OC.CveOrdenCompra CveOrdenCompraPadre = OC.CveOrdenCompra
If CveOrdenCompraPadre > 0 Then If CveOrdenCompraPadre > 0 Then
For Each dr As DataRow In DtDetalle.Rows For Each dr As DataRow In DtDetalle.Rows
If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble,
dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDouble,
IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble,
RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble,
RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then
TieneError = True TieneError = True
Exit For Exit For
End If End If
@@ -2435,11 +2458,20 @@ Partial Class OC
For Each dr As DataRow In DtDetalle.Rows For Each dr As DataRow In DtDetalle.Rows
If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero,
dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble,
IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero,
IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero()) Then
TieneError = True TieneError = True
Exit For Exit For
End If End If
Next Next
If Not TieneError AndAlso UsuarioActual.Empresa.Funcionalidad(583) = "1" Then
TieneError = Not ActualizarCotizacion(ObjVentas)
End If
Else Else
TieneError = True TieneError = True
End If End If
@@ -2887,6 +2919,7 @@ Partial Class OC
Else Else
'TERMINA TODO POR SI OCURRIÓ ALGO RARO 'TERMINA TODO POR SI OCURRIÓ ALGO RARO
If OC IsNot Nothing Then OC.Dispose() If OC IsNot Nothing Then OC.Dispose()
If ObjVentas IsNot Nothing Then ObjVentas.Dispose()
If Conta IsNot Nothing Then Conta.Dispose() If Conta IsNot Nothing Then Conta.Dispose()
'MANDA CORREOS SI EL ESTATUS ES MAYOR A 0 'MANDA CORREOS SI EL ESTATUS ES MAYOR A 0
@@ -5043,7 +5076,7 @@ Partial Class OC
End Function End Function
#End Region #End Region
#Region " COTIZACIONES " #Region "C O T I Z A C I O N E S"
Protected Sub VerificaSiRequiereCotizacion() Protected Sub VerificaSiRequiereCotizacion()
If TipoOC = "REQ" Then If TipoOC = "REQ" Then
If ChkCotizacion.Checked Then If ChkCotizacion.Checked Then
@@ -5083,6 +5116,32 @@ Partial Class OC
VerificaCotizacionesGanadoras() VerificaCotizacionesGanadoras()
End If End If
End Sub End Sub
Protected Function ActualizarCotizacion(ByRef ObjVentas As ClsVentas) As Boolean
Dim OcurrioError As Boolean = False
Try
Dim PorcentajeGanancia As Decimal = 0.1D
For Each Row As DataRow In DtDetalle.Rows
Dim CvePS As Integer = Row("CvePS").ToString.ToEntero
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal
Dim PU As Decimal = Row("Importe").ToString.ToDecimal() + (Row("Importe").ToString.ToDecimal() * PorcentajeGanancia)
Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal
Dim ImporteIEPS As Decimal = ((Cantidad * PU) * IEPSPS).RoundSQL(2)
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, "", UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
Next
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al guardar la cotización", ex)
End Try
Return Not OcurrioError
End Function
#End Region #End Region
Private Function notienepresupuesto() As Boolean Private Function notienepresupuesto() As Boolean
@@ -7544,4 +7603,5 @@ Partial Class OC
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@@ -308,6 +308,9 @@
<%--<asp:LinkButton ID="LnkSaldarVenta" runat="server" CausesValidation="False" Text="<i class='fa fa-ban'></i> Saldar" data-toggle="confirmation" data-popout="true" data-original-title="¿Estás seguro que deseas saldar el Documento?" data-btn-ok-label="si" Visible="false" />--%> <%--<asp:LinkButton ID="LnkSaldarVenta" runat="server" CausesValidation="False" Text="<i class='fa fa-ban'></i> Saldar" data-toggle="confirmation" data-popout="true" data-original-title="¿Estás seguro que deseas saldar el Documento?" data-btn-ok-label="si" Visible="false" />--%>
<asp:HyperLink ID="HLSaldarVenta" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#ModalSaldarVenta" runat="server"><i class='fa fa-ban'></i> Saldar</asp:HyperLink> <asp:HyperLink ID="HLSaldarVenta" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#ModalSaldarVenta" runat="server"><i class='fa fa-ban'></i> Saldar</asp:HyperLink>
</li> </li>
<li id="LtGenerarOC" runat="server" visible="false">
<asp:LinkButton ID="LnkGenerarOC" OnClick="LnkGenerarOC_Click" title="Generar Orden de Compra!" runat="server"><i class="fa fa-tags"></i> Generar Orden de Compra</asp:LinkButton>
</li>
<asp:UpdatePanel ID="UPPDescontabilizar" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPPDescontabilizar" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
@@ -3541,7 +3544,7 @@
<div style="max-height: 300px; overflow-y: auto;"> <div style="max-height: 300px; overflow-y: auto;">
<asp:GridView ID="GVAnticipos" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente" <asp:GridView ID="GVAnticipos" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente"
ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall" data-height="300" Style="text-align: center;" GridLines="None" ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall" data-height="300" Style="text-align: center;" GridLines="None"
DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, IdCtaContableNCSIG, TipoCambio,TipoCambioPago, CveMoneda,Fecha,SaldoSubTotal"> DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, IdCtaContableNCSIG, TipoCambio,TipoCambioPago,TipoCambioHoy, CveMoneda,Fecha,SaldoSubTotal">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>

View File

@@ -3543,6 +3543,7 @@ Partial Class Ventas
' LbCancelarDocumentoManual.Visible = True ' LbCancelarDocumentoManual.Visible = True
'End If 'End If
If Not CveEstatus.Contiene(4, 5, 12, 13, 20) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then If Not CveEstatus.Contiene(4, 5, 12, 13, 20) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then If TienePermiso <> "" Then
@@ -4362,6 +4363,19 @@ Partial Class Ventas
CargaCodigoUnico() CargaCodigoUnico()
'SI ES COTIZACION PUEDE GENERAR UNA OC PARA MODIFICAR LOS IMPORTES
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(583) = "1" Then
Dim DtOCGeneradas As DataTable = Nothing
If ObjVentas.GetVentasCotizacionesOC(Me.CveVenta, -1, UsuarioActual.CveEmpresa) Then
DtOCGeneradas = ObjVentas.DtResultados.Copy()
End If
If DtOCGeneradas IsNot Nothing AndAlso DtOCGeneradas.Rows.Count > 0 Then
LtGenerarOC.Visible = False
Else
LtGenerarOC.Visible = True
End If
End If
UpPS.Update() UpPS.Update()
UpContado.Update() UpContado.Update()
UpEstatus.Update() UpEstatus.Update()
@@ -11670,7 +11684,7 @@ Partial Class Ventas
If e.Row.DBCampo("Tipo").ToString = "NC" And e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then If e.Row.DBCampo("Tipo").ToString = "NC" And e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then
If e.Row.DBCampo("CveMoneda").ToString.ToEntero = 2 Then If e.Row.DBCampo("CveMoneda").ToString.ToEntero = 2 Then
tipoCambio = e.Row.DataKey("TipoCambio").ToString.ToDecimal tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString.ToDecimal
Else Else
tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString.ToDate).ToDecimal tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString.ToDate).ToDecimal
End If End If
@@ -11703,7 +11717,7 @@ Partial Class Ventas
maxsaldo = total maxsaldo = total
End If End If
e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(4) e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(2)
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo)) e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo))
e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, saldo)) e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, saldo))
e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("CambioTipoMoneda({0},{1},{2},{3},{4});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, e.Row.DataKey("Saldo"), e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).ClientID, e.Row.DataKey("CveMoneda"))) e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("CambioTipoMoneda({0},{1},{2},{3},{4});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, e.Row.DataKey("Saldo"), e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).ClientID, e.Row.DataKey("CveMoneda")))
@@ -11874,7 +11888,7 @@ Partial Class Ventas
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES
tipoCambioPago = gvr.DataKey("TipoCambio").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioPago = gvr.DataKey("TipoCambioHoy").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
tipoCambioVenta = 1 tipoCambioVenta = 1
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
@@ -24658,4 +24672,7 @@ Partial Class Ventas
' Return File ' Return File
'End Function 'End Function
Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs)
Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC")
End Sub
End Class End Class