This commit is contained in:
Antonio Gonzalez
2020-03-23 18:08:21 -07:00
13 changed files with 1309 additions and 1219 deletions

View File

@@ -4609,26 +4609,10 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function GetMonedas() As Boolean
Public Function GetAgrupadoresSAT() As Boolean
Dim Retorno As Boolean = False
DataAdapter(" SELECT * FROM Monedas ".ToString, CommandType.Text)
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al consultar las Monedas.", ex)
End Try
Return Retorno
End Function
Public Function GetAgrupadoresSAT(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter(" SELECT CveAgrupadorSAT, Codigo + REPLICATE(' ', 10 - len(Codigo)) + ' - ' + Nombre AS CodigoNombre FROM AgrupadoresSAT where CveEmpresa= '" & CveEmpresa & "'", CommandType.Text)
DataAdapter("PA_Conta_AgrupadoresSATGet")
Try
SqlAdapter.Fill(Data)
Retorno = True

View File

@@ -1175,7 +1175,7 @@ Public Class ClsPaginas
ObjPS.Dispose()
End Get
End Property
Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1) As DataTable
Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable
Get
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa)
If CveEmpresa <> -1 Then
@@ -1195,6 +1195,7 @@ Public Class ClsPaginas
If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo))
If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus))
If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta))
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
Try
GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable

View File

@@ -529,6 +529,24 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function GetPagos(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasPagosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el Pago de la Venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function RemoveVta_VentaPago(CveVenta As Integer, CveMetodoPago As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasPagoRemove")
@@ -2786,7 +2804,7 @@ Public Class ClsVentas
Try
Dim objServicio As Cancelacion.CancelacionSoapClient = New Cancelacion.CancelacionSoapClient()
Dim resp As Cancelacion.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890")
Dim resp As Cancelacion.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890")
If resp.Estado = 0 Then
Dim XmlPendientes As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml))
Dim theReader As IO.StringReader = New IO.StringReader(XmlPendientes)

View File

@@ -4001,7 +4001,7 @@ Namespace Modelos
Dim TieneAlmacen As Boolean = False
'VALIDA QUE LA FACTURA NO TENGA PAGOS
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
If Not EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
@@ -4033,7 +4033,7 @@ Namespace Modelos
End If
If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
Retorno.Mensaje = "La factura no se puede cancelar debido a que el anticipo ha sido amortizado."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
Return Retorno

View File

@@ -380,7 +380,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
End If
If usuario.Empresa.Funcionalidad(558) = "1" Then
If usuario.Empresa.Funcionalidad(558) = "1" AndAlso DtPSRetorno IsNot Nothing Then
Try
Dim NombreFiltroColumna As String = DtPSRetorno.Columns(3).ColumnName
DtPSRetorno = DtPSRetorno.FiltraParametros("", String.Format("{0} DESC,PSCodigo", NombreFiltroColumna))

View File

@@ -16717,7 +16717,7 @@ Partial Class Compras_Compras
Dim DiferenciaPermitida = 0.6
If Math.Abs(DifTotales) > DiferenciaPermitida Then
Alert("Los importes de los conceptos (Productos/Servicios) no cuadran con el total. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Alert(String.Format("Los importes de los conceptos (Productos/Servicios) no cuadran con el total. Por favor verifique y vuelva a intentar.[{0}]", Math.Abs(DifTotales) - DiferenciaPermitida), TipoMensaje.MsgAdvertencia)
EsValido = False
ElseIf DifTotales <> 0 Then
TxtSubTotal2.Text = (TxtSubTotal2.Text.ToDouble + DifTotales).ToString

View File

@@ -54,20 +54,20 @@ public partial class Contabilidad_ContabilizacionCompras : ClsPaginas
//DdlProveedores.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
//DdlProveedores.DataBind();
DdlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa);
DdlPersonal.DataBind();
DdlPlantillasPolizas.DataSource = get_GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa);
DdlPlantillasPolizas.Items.Insert(0, new ListItem("Todos", "-1"));
DdlPlantillasPolizas.DataBind();
txtFechaI.Text = DateTime.Now.FirstDayOfMonth().AddMonths(-1).ToShortDateString();
txtFechaF.Text = DateTime.Now.ToShortDateString();
//CargaDatos();
}
DdlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa);
DdlPersonal.DataBind();
DdlPlantillasPolizas.DataSource = get_GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa);
DdlPlantillasPolizas.Items.Insert(0, new ListItem("Todos", "-1"));
DdlPlantillasPolizas.DataBind();
txtFechaI.Text = DateTime.Now.FirstDayOfMonth().AddMonths(-1).ToShortDateString();
txtFechaF.Text = DateTime.Now.ToShortDateString();
if (UsuarioActual.CveRol == 1 || UsuarioActual.CveUsuario == 17 || UsuarioActual.CveUsuario == 171 || UsuarioActual.TienePermisoProceso(221))
{
TienePermisoEditar = true;

View File

@@ -111,19 +111,13 @@ Partial Class Contabilidad2_CatCuentas
End Sub
Private Sub CargaMonedas()
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObJConta As New ClsContabilidad
If ObJConta.GetMonedas() Then
DdlMoneda.DataSource = ObJConta.DtResultados
End If
ObJConta.Dispose()
DdlMoneda.DataSource = GlobalDTMonedas
DdlMoneda.DataBind()
End Sub
Private Sub CargaAgrupadorSAT()
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
If ObjConta.GetAgrupadoresSAT(UsuarioActual.CveEmpresa) Then

View File

@@ -503,7 +503,7 @@
<Width>7.52397in</Width>
<Page>
<PageHeader>
<Height>2.22362cm</Height>
<Height>3.05745cm</Height>
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<ReportItems>
@@ -686,6 +686,37 @@
</Border>
</Style>
</Image>
<Textbox Name="Filtros">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!Filtros.Value</Value>
<MarkupType>HTML</MarkupType>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Filtros</rd:DefaultName>
<Top>2.40001cm</Top>
<Left>0.06614cm</Left>
<Height>0.6cm</Height>
<Width>18.9786cm</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Style>
<Border>
@@ -972,6 +1003,12 @@
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
<ReportParameter Name="Filtros">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>40c94aad-a12a-44fb-ab0d-ea36a9656792</rd:ReportID>

View File

@@ -6084,7 +6084,7 @@ Partial Class OC
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excelFile As ExcelFile = excelFile.Load(flatFilePath)
Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath)
Dim unnamed As Integer = 0
Dim cols As Integer

View File

@@ -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>

View File

@@ -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,

View File

@@ -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
@@ -25155,4 +25202,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