Merge branch 'master' of http://agonzalez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -53,21 +53,21 @@ 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;
|
||||
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
318
OC/OC.aspx.vb
318
OC/OC.aspx.vb
@@ -6082,51 +6082,51 @@ Partial Class OC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
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 unnamed As Integer = 0
|
||||
Dim cols As Integer
|
||||
Dim columns As String()
|
||||
Dim curRow As Integer = 0
|
||||
Dim curCol As Integer = 0
|
||||
Dim dataTable As DataTable = New DataTable()
|
||||
Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0)
|
||||
|
||||
For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
|
||||
|
||||
If firstRowHasHeaders Then
|
||||
|
||||
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
|
||||
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
|
||||
Else
|
||||
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
|
||||
End If
|
||||
|
||||
curRow = 1
|
||||
Else
|
||||
dataTable.Columns.Add("Column " & (cols + 1))
|
||||
End If
|
||||
Next
|
||||
|
||||
While curRow < worksheet.Rows.Count
|
||||
columns = New String(cols - 1) {}
|
||||
|
||||
For curCol = 0 To cols - 1
|
||||
|
||||
If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then
|
||||
columns(curCol) = ""
|
||||
Else
|
||||
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
|
||||
End If
|
||||
Next
|
||||
|
||||
dataTable.Rows.Add(columns)
|
||||
curRow += 1
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
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 unnamed As Integer = 0
|
||||
Dim cols As Integer
|
||||
Dim columns As String()
|
||||
Dim curRow As Integer = 0
|
||||
Dim curCol As Integer = 0
|
||||
Dim dataTable As DataTable = New DataTable()
|
||||
Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0)
|
||||
|
||||
For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
|
||||
|
||||
If firstRowHasHeaders Then
|
||||
|
||||
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
|
||||
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
|
||||
Else
|
||||
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
|
||||
End If
|
||||
|
||||
curRow = 1
|
||||
Else
|
||||
dataTable.Columns.Add("Column " & (cols + 1))
|
||||
End If
|
||||
Next
|
||||
|
||||
While curRow < worksheet.Rows.Count
|
||||
columns = New String(cols - 1) {}
|
||||
|
||||
For curCol = 0 To cols - 1
|
||||
|
||||
If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then
|
||||
columns(curCol) = ""
|
||||
Else
|
||||
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
|
||||
End If
|
||||
Next
|
||||
|
||||
dataTable.Rows.Add(columns)
|
||||
curRow += 1
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
End Function
|
||||
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||
@@ -7469,131 +7469,131 @@ Partial Class OC
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "C A R G A R E X C E L "
|
||||
#Region "C A R G A R E X C E L "
|
||||
Protected Sub BtnCargaExcelCot_Click(sender As Object, e As EventArgs)
|
||||
If TxtExcelCot.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcelCot.getfiles().Archivos(0)
|
||||
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
|
||||
CargarArchivoCot(Directorio, file.filename)
|
||||
|
||||
CargaCotizaciones(CveOrdenCompra)
|
||||
RegistraScript("$('#DivCargaExcelCotizaciones').modal('hide');")
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
If TxtExcelCot.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcelCot.getfiles().Archivos(0)
|
||||
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
|
||||
CargarArchivoCot(Directorio, file.filename)
|
||||
|
||||
CargaCotizaciones(CveOrdenCompra)
|
||||
RegistraScript("$('#DivCargaExcelCotizaciones').modal('hide');")
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnDescargarFormatoCot_Click(sender As Object, e As EventArgs)
|
||||
'cantidad, Producto, Precio Unitario, Fecha Entrega, Observación
|
||||
Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim DtExcel As DataTable = (From row As GridViewRow In GvD.Rows
|
||||
Join rowPS In DtPS On rowPS("CvePS").ToString().ToEntero() Equals row.DataKey("CvePS").ToEntero()
|
||||
Where row.RowType = DataControlRowType.DataRow
|
||||
Select New With
|
||||
{
|
||||
.Cantidad = row.DataKey("Cantidad"),
|
||||
.Codigo = rowPS("Codigo"),
|
||||
.Producto = rowPS("PSCodigo"),
|
||||
.PrecioUnitario = row.DataKey("Importe").ToDecimal(),
|
||||
.FechaEntrega = "",
|
||||
.Observacion = row.DataKey("Observacion")
|
||||
}).QueryToDataTable(True)
|
||||
If DtExcel.Rows.Count < 2 Then
|
||||
Alert("No hay resutados en la busqueda.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtExcel.TableName = "Cotización"
|
||||
'DtExcel.Columns("Codigo").ColumnName = "Código"
|
||||
'DtExcel.Columns("PS").ColumnName = "Producto / Servicio"
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim FileExcel As New ExcelFile()
|
||||
|
||||
Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
|
||||
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
|
||||
|
||||
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
||||
For i = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
|
||||
FileExcel.Save(Response, "Cotizacion.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
End Sub
|
||||
Protected Sub CargarArchivoCot(Ruta As String, FileName As String)
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim dt As DataTable = Nothing
|
||||
Dim ErrorArchivo = False
|
||||
|
||||
Try
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
|
||||
If Not ErrorArchivo AndAlso dt IsNot Nothing Then
|
||||
'cantidad, Producto, Precio Unitario, Fecha Entrega, Observación
|
||||
If DdlProveedorCot.SelectedValue.ToEntero() <= 0 Then
|
||||
Alert("Debe Seleccionar la lista de precios a cargar. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(0).ColumnName = "Cantidad" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
Join rowPS In DtPS On rowPS("CvePS").ToString().ToEntero() Equals row.DataKey("CvePS").ToEntero()
|
||||
Where row.RowType = DataControlRowType.DataRow
|
||||
Select New With
|
||||
{
|
||||
.Cantidad = row.DataKey("Cantidad"),
|
||||
.Codigo = rowPS("Codigo"),
|
||||
.Producto = rowPS("PSCodigo"),
|
||||
.PrecioUnitario = row.DataKey("Importe").ToDecimal(),
|
||||
.FechaEntrega = "",
|
||||
.Observacion = row.DataKey("Observacion")
|
||||
}).QueryToDataTable(True)
|
||||
If DtExcel.Rows.Count < 2 Then
|
||||
Alert("No hay resutados en la busqueda.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtExcel.TableName = "Cotización"
|
||||
'DtExcel.Columns("Codigo").ColumnName = "Código"
|
||||
'DtExcel.Columns("PS").ColumnName = "Producto / Servicio"
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim FileExcel As New ExcelFile()
|
||||
|
||||
Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
|
||||
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
|
||||
|
||||
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
||||
For i = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
|
||||
FileExcel.Save(Response, "Cotizacion.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
End Sub
|
||||
Protected Sub CargarArchivoCot(Ruta As String, FileName As String)
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim dt As DataTable = Nothing
|
||||
Dim ErrorArchivo = False
|
||||
|
||||
Try
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
|
||||
If Not ErrorArchivo AndAlso dt IsNot Nothing Then
|
||||
'cantidad, Producto, Precio Unitario, Fecha Entrega, Observación
|
||||
If DdlProveedorCot.SelectedValue.ToEntero() <= 0 Then
|
||||
Alert("Debe Seleccionar la lista de precios a cargar. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(1).ColumnName = "Codigo" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(2).ColumnName = "Producto" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(3).ColumnName = "PrecioUnitario" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'PrecioUnitario'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
If Not dt.Columns(0).ColumnName = "Cantidad" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(4).ColumnName = "FechaEntrega" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'FechaEntrega'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
If Not dt.Columns(1).ColumnName = "Codigo" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "Observacion" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Observacion'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
dt.TableName = "Datos"
|
||||
Dim ProductosNoCargados As New StringBuilder()
|
||||
Dim RowsCargados As Integer = 0
|
||||
If Not dt.Columns(2).ColumnName = "Producto" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(3).ColumnName = "PrecioUnitario" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'PrecioUnitario'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(4).ColumnName = "FechaEntrega" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'FechaEntrega'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "Observacion" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Observacion'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
dt.TableName = "Datos"
|
||||
Dim ProductosNoCargados As New StringBuilder()
|
||||
Dim RowsCargados As Integer = 0
|
||||
Dim RowsNoCargados As Integer = 0
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Dim objCotizacion As New ClsOC
|
||||
objCotizacion.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
Try
|
||||
Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim DtOCDetalle As DataTable = (From row As GridViewRow In GvD.Rows
|
||||
Join rowPS In DtPS On rowPS("CvePS").ToString().ToEntero() Equals row.DataKey("CvePS").ToEntero()
|
||||
Where row.RowType = DataControlRowType.DataRow
|
||||
Select New With
|
||||
{
|
||||
.CvePS = row.DataKey("CvePS").ToEntero(),
|
||||
.CveUnidadMedida = rowPS("CveUnidadMedida").ToString().ToEntero(),
|
||||
.CveOrdenCompraDetalle = row.DataKey("CveOrdenCompraDetalle").ToString().ToEntero(),
|
||||
.Codigo = rowPS("Codigo")
|
||||
Select New With
|
||||
{
|
||||
.CvePS = row.DataKey("CvePS").ToEntero(),
|
||||
.CveUnidadMedida = rowPS("CveUnidadMedida").ToString().ToEntero(),
|
||||
.CveOrdenCompraDetalle = row.DataKey("CveOrdenCompraDetalle").ToString().ToEntero(),
|
||||
.Codigo = rowPS("Codigo")
|
||||
}).QueryToDataTable(True)
|
||||
|
||||
|
||||
@@ -7618,23 +7618,23 @@ Partial Class OC
|
||||
End If
|
||||
Else
|
||||
TieneError = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al cargar las cotizaciones.", ex)
|
||||
Finally
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al cargar las cotizaciones.", ex)
|
||||
Finally
|
||||
If TieneError Then
|
||||
objCotizacion.RollBack()
|
||||
Alert("Ocurrió un error al cargar las cotizaciones.")
|
||||
Else
|
||||
objCotizacion.Commit()
|
||||
Alert("Las cotizaciones se cargaron correctamente.")
|
||||
End If
|
||||
End If
|
||||
objCotizacion.Dispose()
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user