mejoras en promociones
This commit is contained in:
@@ -107,9 +107,8 @@
|
||||
<div class="row">
|
||||
<label class="col-md-2 truncate">Cliente:</label>
|
||||
<div class="col-md-4">
|
||||
<asp:DropDownList ID="DdlCliente" DataTextField="NombreComercial" DataValueField="CveCliente" CssClass="select2me" runat="server" Width="350px"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVCliente" runat="server" ControlToValidate="DdlCliente" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cliente''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCECliente" runat="server" HighlightCssClass="vco" TargetControlID="RFVCliente" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;">
|
||||
</ADS:Dropdownlost>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -117,7 +116,7 @@
|
||||
<label class="col-md-2 truncate">Moneda:</label>
|
||||
<div class="col-md-4">
|
||||
<asp:DropDownList ID="DdlMoneda" DataTextField="Moneda" DataValueField="CveMoneda" CssClass="select2me" runat="server" Width="350px"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVMoneda" runat="server" ControlToValidate="DdlCliente" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Moneda''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<asp:RequiredFieldValidator ID="RFVMoneda" runat="server" ControlToValidate="DdlMoneda" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Moneda''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEMoneda" runat="server" HighlightCssClass="vco" TargetControlID="RFVMoneda" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -87,9 +87,10 @@ Partial Class Ventas_Promociones
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
DdlCliente.DataBind()
|
||||
DdlCliente.Items.Insert(0, New ListItem("todos", "-1"))
|
||||
'DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
'DdlCliente.DataBind()
|
||||
'DdlCliente.Items.Insert(0, New ListItem("todos", "-1"))
|
||||
DdlClientes.setEsWebService(True)
|
||||
|
||||
TxtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString
|
||||
TxtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
|
||||
@@ -131,6 +132,7 @@ Partial Class Ventas_Promociones
|
||||
TempDT.Columns.Add("TipoPromocion", GetType(String))
|
||||
TempDT.Columns.Add("Promocion", GetType(String))
|
||||
TempDT.Columns.Add("CantidadMinima", GetType(Integer))
|
||||
TempDT.Columns.Add("RinTamaño", GetType(String))
|
||||
|
||||
TempDT.Columns.Add("AplicaRestriccionTexto", GetType(String))
|
||||
TempDT.Columns.Add("AplicaRestriccion", GetType(Boolean))
|
||||
@@ -149,7 +151,7 @@ Partial Class Ventas_Promociones
|
||||
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
ChangeDdlProducto()
|
||||
DdlTipoPromocion.Items.FindByValue("1").Enabled = False
|
||||
DdlTipoPromocion.Items.FindByValue("3").Enabled = False
|
||||
' DdlTipoPromocion.Items.FindByValue("3").Enabled = False
|
||||
End Sub
|
||||
Private Sub ChangeDdlProducto()
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "" Then
|
||||
@@ -185,9 +187,10 @@ Partial Class Ventas_Promociones
|
||||
DdlSubProyecto.SelectedValue = Dr("CveSubProyecto").ToString
|
||||
DdlMarca.SelectedValue = Dr("CveMarca").ToString
|
||||
If Dr("CveVendedor").ToString.ToEntero > 0 Then DdlVendedor.SelectedValue = Dr("CveVendedor").ToString
|
||||
If Dr("CveCliente").ToString.ToEntero > 0 Then DdlCliente.SelectedValue = Dr("CveCliente").ToString
|
||||
If Dr("CveCliente").ToString.ToEntero > 0 Then DdlClientes.SelectedValue = Dr("CveCliente").ToString
|
||||
ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False)
|
||||
DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString)
|
||||
DdlMarca.SelectedValueExist(Dr("CveMarca").ToString)
|
||||
|
||||
If ObjVentas.GetPromocionesDetalle(CvePromocion, UsuarioActual.CveEmpresa) Then
|
||||
TempDT = ObjVentas.DtResultados
|
||||
@@ -411,11 +414,12 @@ Partial Class Ventas_Promociones
|
||||
|
||||
|
||||
Private Sub GuardaPromocion()
|
||||
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim TieneError = False
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
CvePromocion = ObjVentas.AddPromociones(TxtPromocion.Text.Trim, If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha), If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MaxFecha),
|
||||
DdlVendedor.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario,
|
||||
DdlVendedor.SelectedValue.ToEntero, CveCliente, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, DdlTipoAplicacion.SelectedValue.ToString, DdlMarca.SelectedValue.ToEntero)
|
||||
|
||||
If CvePromocion > 0 Then
|
||||
@@ -443,11 +447,13 @@ Partial Class Ventas_Promociones
|
||||
ObjVentas.Dispose()
|
||||
End Sub
|
||||
Private Sub ActualizaPromocion()
|
||||
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim TieneError = False
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
If ObjVentas.UpdatePromociones(TxtPromocion.Text.Trim, If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha), If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MaxFecha), DdlVendedor.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CvePromocion, DdlSubProyecto.SelectedValue.ToEntero) Then
|
||||
If ObjVentas.UpdatePromociones(TxtPromocion.Text.Trim, If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha), If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MaxFecha), DdlVendedor.SelectedValue.ToEntero, CveCliente, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CvePromocion, DdlSubProyecto.SelectedValue.ToEntero, DdlMarca.SelectedValue.ToEntero) Then
|
||||
|
||||
For Each Dr As DataRow In TempDT.FiltraParametros("Estatus = 0").Rows
|
||||
If Not ObjVentas.AddPromocionesDetalle(CvePromocion, Dr("CvePS").ToString.ToEntero, Dr("CveTipoPromocion").ToString.ToEntero, Dr("Promocion").ToString.ToDouble, Dr("PUAnterior").ToString.ToDouble, Dr("PUPromocion").ToString.ToDouble,
|
||||
|
||||
@@ -34,7 +34,7 @@ Partial Class Ventas
|
||||
Private Property FolioXML As String
|
||||
Private Property SubTotal As Decimal
|
||||
Private Property Total As Decimal = 0
|
||||
Private Property Descuentos As Decimal = 0
|
||||
' Private Property Descuentos As Decimal = 0
|
||||
Private Property EmisorRFC As String
|
||||
Private Property ReceptorRFC As String
|
||||
Private Property TrasladoIVA As Decimal = 0
|
||||
@@ -5883,11 +5883,12 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating
|
||||
'Dim TipoDescuento As Integer
|
||||
Dim Cantidad, PU, Descuento, CantidadInventario As Decimal
|
||||
Dim Cantidad, PU, CantidadInventario As Decimal
|
||||
Dim ObjDescuento As New Descuentos
|
||||
Dim CuentaPredial As String
|
||||
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6)
|
||||
Descuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
|
||||
ObjDescuento.ImporteDescuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
|
||||
CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim
|
||||
|
||||
If PU <= 0 AndAlso UsuarioActual.CveEmpresa = 141 Then
|
||||
@@ -5896,7 +5897,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
Descuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Cantidad, PU)
|
||||
ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Cantidad, PU)
|
||||
End If
|
||||
|
||||
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
|
||||
@@ -6060,10 +6061,10 @@ Partial Class Ventas
|
||||
CalculaUsados()
|
||||
AgregarProductoServicio(Cantidad, DdlUM.SelectedValue.ToEntero, DdlUM.SelectedItem.Text, DdlCla.SelectedValue.ToEntero, DdlCla.SelectedItem.Text,
|
||||
GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedText,
|
||||
GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim, PU, Descuento,
|
||||
GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim, PU, ObjDescuento.ImporteDescuento,
|
||||
GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text,
|
||||
GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text,
|
||||
CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString.ToEntero, SeActualiza:=True)
|
||||
CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString.ToEntero, SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
|
||||
|
||||
' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue
|
||||
' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text
|
||||
@@ -6091,7 +6092,7 @@ Partial Class Ventas
|
||||
TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0
|
||||
End If
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuento))
|
||||
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
|
||||
Dim TotalCalculableImpuestosIVA As Decimal = 0
|
||||
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal)
|
||||
|
||||
@@ -6119,7 +6120,7 @@ Partial Class Ventas
|
||||
TmpDT.Rows(e.RowIndex)("Obs") = GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim
|
||||
TmpDT.Rows(e.RowIndex)("TiempoEntrega") = GvPS.Rows(e.RowIndex).FCTextBox("TxtTiempoEntrega").Text.Trim
|
||||
TmpDT.Rows(e.RowIndex)("PU") = PU
|
||||
TmpDT.Rows(e.RowIndex)("Descuento") = Descuento
|
||||
TmpDT.Rows(e.RowIndex)("Descuento") = ObjDescuento.ImporteDescuento
|
||||
TmpDT.Rows(e.RowIndex)("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
|
||||
TmpDT.Rows(e.RowIndex)("ImporteIVA") = (TmpDT.Rows(e.RowIndex)("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
|
||||
TmpDT.Rows(e.RowIndex)("ImporteIEPS") = (TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
|
||||
@@ -9422,7 +9423,7 @@ Partial Class Ventas
|
||||
If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
|
||||
Row("PU").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
|
||||
Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero,
|
||||
TiempoEntrega:=Row("TiempoEntrega").ToString, CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1),
|
||||
TiempoEntrega:=Row("TiempoEntrega").ToString, CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=Row("CvePromocionDetalle").ToString.ToEntero,
|
||||
IEPS:=Row("ImporteIEPS").ToString.ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero,
|
||||
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble,
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then
|
||||
@@ -14201,11 +14202,21 @@ Partial Class Ventas
|
||||
EsValido = True
|
||||
End If
|
||||
Else
|
||||
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
'valida sino tiene promocion la clasificacion
|
||||
If DtPromociones.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero}").Rows.Count > 0 Then
|
||||
''falta aplicar si tiene promocion
|
||||
If DrPS IsNot Nothing Then
|
||||
If DtPromociones.FiltraParametros(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero)).Rows.Count > 0 Then
|
||||
''falta aplicar si tiene promocion
|
||||
Dim drPromo As DataRow = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero))
|
||||
If drPromo IsNot Nothing Then
|
||||
If drPromo("CveMarca").ToString = DrPS("CveMarca").ToString Then
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -14245,7 +14256,7 @@ Partial Class Ventas
|
||||
Return True
|
||||
|
||||
End Function
|
||||
Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Decimal
|
||||
Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Descuentos
|
||||
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then
|
||||
@@ -14256,11 +14267,30 @@ Partial Class Ventas
|
||||
Descuento = HdnDescuento.Value.ToDecimal * Cantidad
|
||||
End If
|
||||
|
||||
Dim ValidaCondicionesComerciales As Boolean = True
|
||||
|
||||
'AGREGA PROMOCION EN EL DESCUENTO
|
||||
Dim TipoPromo As Integer = 0
|
||||
Dim TotalPromocion As Decimal = 0
|
||||
Dim PromocionPorcentaje As Decimal = 0
|
||||
Dim CantMinima As Integer = 0
|
||||
Dim CveMarcaPS As Integer = 0
|
||||
Dim CveClasifPS As Integer = 0
|
||||
Dim CvePromocionDetalle As Integer = 0
|
||||
Dim ObjDescuento As New Descuentos
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS IsNot Nothing Then
|
||||
|
||||
CveMarcaPS = DrPS("CveMarca").ToString.ToEntero
|
||||
CveClasifPS = DrPS("CveClasificacion").ToString.ToEntero
|
||||
|
||||
If CveClasifPS = 20636 Then
|
||||
ValidaCondicionesComerciales = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
|
||||
Dim dr As DataRow = DtPromociones.FiltroPrimero($"CvePS = {CvePS}")
|
||||
@@ -14269,6 +14299,18 @@ Partial Class Ventas
|
||||
TotalPromocion = dr("PUPromocion").ToString.ToDecimal * TxtCantidad.Text.ToDecimal
|
||||
PromocionPorcentaje = dr("Promocion").ToString.ToDecimal
|
||||
CantMinima = dr("CantidadMinima").ToString.ToEntero
|
||||
CvePromocionDetalle = dr("CvePromocionDetalle").ToString.ToEntero
|
||||
Else
|
||||
'verifica marca, si tiene asignada la promocion
|
||||
Dim drC As DataRow = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL)", CveClasifPS, CveMarcaPS))
|
||||
|
||||
If drC IsNot Nothing Then
|
||||
TipoPromo = drC("TipoPromocion").ToString.ToEntero
|
||||
TotalPromocion = drC("PUPromocion").ToString.ToDecimal * TxtCantidad.Text.ToDecimal
|
||||
PromocionPorcentaje = drC("Promocion").ToString.ToDecimal
|
||||
CantMinima = drC("CantidadMinima").ToString.ToEntero
|
||||
CvePromocionDetalle = drC("CvePromocionDetalle").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -14279,15 +14321,11 @@ Partial Class Ventas
|
||||
ElseIf TipoPromo = 3 Then 'Promocion por Cantidad
|
||||
If Cantidad >= CantMinima Then
|
||||
Descuento = Descuento + TotalPromocion
|
||||
Else
|
||||
CvePromocionDetalle = -1
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
Dim ValidaCondicionesComerciales As Boolean = True
|
||||
|
||||
If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then
|
||||
ValidaCondicionesComerciales = False
|
||||
End If
|
||||
|
||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||
@@ -14334,8 +14372,13 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
Return Descuento
|
||||
ObjDescuento.ImporteDescuento = Descuento
|
||||
ObjDescuento.CvePromocionDetalle = CvePromocionDetalle
|
||||
|
||||
Return ObjDescuento
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub AgregarPS()
|
||||
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
|
||||
Dim CvePS As Integer = -1
|
||||
@@ -14353,12 +14396,12 @@ Partial Class Ventas
|
||||
|
||||
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
|
||||
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
|
||||
Dim Descuento As Decimal = CalcularDescuentos(CvePS, Cantidad, PU)
|
||||
Dim ObjDescuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
|
||||
|
||||
AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
CvePS, "", TxtObsPS.Text.Trim, PU, Descuento,
|
||||
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
|
||||
DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text,
|
||||
SerieLote:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS)
|
||||
SerieLote:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
|
||||
|
||||
CalculaUsados()
|
||||
|
||||
@@ -14390,10 +14433,10 @@ Partial Class Ventas
|
||||
|
||||
Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero
|
||||
|
||||
Dim Descuento As Decimal = CalcularDescuentos(CvePS, Cantidad, PU)
|
||||
Dim Descuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
|
||||
|
||||
AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text,
|
||||
CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento.ImporteDescuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
|
||||
CalculaUsados()
|
||||
CalculaTotalesVenta()
|
||||
@@ -14492,7 +14535,7 @@ Partial Class Ventas
|
||||
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0,
|
||||
Optional SeActualiza As Boolean = False) As Boolean
|
||||
Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
If Not CvePS > 0 Then
|
||||
@@ -14639,6 +14682,7 @@ Partial Class Ventas
|
||||
Row("IEPS") = Row("ImporteIEPS")
|
||||
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
|
||||
Row("TipoDescuento") = HdnTipoDescuento.Value
|
||||
Row("CvePromocionDetalle") = CvePromocionDetalle
|
||||
Row("Total") = (Cantidad * PU)
|
||||
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
|
||||
|
||||
@@ -14830,6 +14874,7 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
TmpDT.Columns.Add("SubProyecto", GetType(String))
|
||||
TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer))
|
||||
TmpDT.Columns.Add("CvePromocionDetalle", GetType(Integer))
|
||||
|
||||
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
|
||||
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
|
||||
@@ -18290,6 +18335,8 @@ Partial Class Ventas
|
||||
Case "egreso" : DdlTipoComprobante.SelectedValue = "Egs"
|
||||
End Select
|
||||
|
||||
Dim Descuentos As Decimal = 0
|
||||
|
||||
|
||||
RFC = ReceptorRFC
|
||||
TxtFecha.Text = Fecha
|
||||
@@ -18556,7 +18603,7 @@ Partial Class Ventas
|
||||
_Fecha = ValorXML(nodo, "fecha")
|
||||
SubTotal = ValorXML(nodo, "subTotal").ToDecimal
|
||||
Total = ValorXML(nodo, "total").ToDecimal
|
||||
Descuentos = ValorXML(nodo, "descuento").ToDecimal
|
||||
'Descuentos = ValorXML(nodo, "descuento").ToDecimal
|
||||
_Moneda = ValorXML(nodo, "Moneda")
|
||||
_TipoComprobante = ValorXML(nodo, "tipoDeComprobante")
|
||||
|
||||
@@ -20058,11 +20105,11 @@ Partial Class Ventas
|
||||
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
|
||||
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
|
||||
|
||||
Dim Descuento As Decimal = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero, Cantidad, PU)
|
||||
Dim ObjDescuento As Descuentos = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero, Cantidad, PU)
|
||||
|
||||
TxtDescuentoPyME.Text = Descuento.FormatoNumero(2).Replace(","c, "")
|
||||
TxtDescuentoPyME.Text = ObjDescuento.ImporteDescuento.FormatoNumero(2).Replace(","c, "")
|
||||
|
||||
LblTotalPyME.Text = ((Cantidad * PU) - Descuento).FormatoNumero(2).Replace(","c, "")
|
||||
LblTotalPyME.Text = ((Cantidad * PU) - ObjDescuento.ImporteDescuento).FormatoNumero(2).Replace(","c, "")
|
||||
|
||||
If UsuarioActual.CveEmpresa = 80 Then
|
||||
'busca el precio de la sucursal
|
||||
@@ -25103,4 +25150,8 @@ Partial Class Ventas
|
||||
' ObjBancos.Dispose()
|
||||
' If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
||||
'End Sub
|
||||
Partial Class Descuentos
|
||||
Public ImporteDescuento As Decimal = 0
|
||||
Public CvePromocionDetalle As Integer = -1
|
||||
End Class
|
||||
End Class
|
||||
Reference in New Issue
Block a user