diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 194981e48..91663ea7a 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -4190,7 +4190,7 @@ Partial Class Compras_Compras
Dim TCPago As Decimal = GlobalTipoCambio(TxtFechaPago.Text.ToDate).ToString.ToDecimal
Dim CveMonedaPago As Integer = DdlMoneda.SelectedValue.ToEntero
- If RBLPago.SelectedValue.ToEntero = 2 AndAlso ArrAnticipos.Count = 0 Then 'Contado
+ If RBLPago.SelectedValue.ToEntero = 2 Then 'Contado
If RBLContado.SelectedValue = "1" Then
ImportePago = TxtDocumentoImporte.Text.Trim.ToDecimal
@@ -6740,7 +6740,7 @@ Partial Class Compras_Compras
' End If
'End If
- For Each Ant As Anticipos In ArrAnticipos
+ For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
Dim ConceptoContableAnticipo, ConceptoContableAnticipoComplementaria As Integer
Dim CveCompraNC As Integer = CveCompra
@@ -7327,7 +7327,7 @@ Partial Class Compras_Compras
Dim PorcentajePago As Decimal
Dim CveConceptoAnt As Integer = 21
Dim CveCompraNC As Integer
- For Each Ant As Anticipos In ArrAnticipos
+ For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
CveCompraNC = CveCompra
Dim CveConceptoPago As Integer = 17
Select Case Ant.TipoMovto
@@ -8840,7 +8840,7 @@ Partial Class Compras_Compras
Dim ImporteAnticipo As Decimal = 0
If ArrAnticipos.Count > 0 Then
- For Each Ant As Anticipos In ArrAnticipos
+ For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
ImporteAnticipo += Ant.Importe
Next
End If
@@ -12255,7 +12255,7 @@ Partial Class Compras_Compras
Select Case RBLContado.SelectedValue
Case "1" ' Bancos
PnlContadoBancos.Visible = True
- TxtDocumentoImporte.Text = TxtTotal.Text
+ TxtDocumentoImporte.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero
Case "2" ' F y E
PnlContadoFyE.Visible = True
CargaFuncionariosEmpleados()
@@ -12270,7 +12270,7 @@ Partial Class Compras_Compras
CargaAcreedores()
Case "6" ' Caja Chica
PnlContadoCajaChica.Visible = True
- TxtDocumentoImporteCaja.Text = TxtTotal.Text
+ TxtDocumentoImporteCaja.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero
End Select
UpContado.Update()
@@ -14596,7 +14596,7 @@ Partial Class Compras_Compras
'ANTICIPOS COMPRA
Dim ImporteAnticipo As Decimal = 0
If ArrAnticipos.Count > 0 Then
- For Each Ant As Anticipos In ArrAnticipos
+ For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
ImporteAnticipo += Ant.Importe
Next
End If
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index 1fde65c90..7134269b9 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -890,6 +890,7 @@ Partial Class PopUpVerFactura
Vta.Cliente.Mail = dtVentas(0)("Mail").ToString
Vta.RefDocto = dtVentas(0)("Ref").ToString
Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero
+ Vta.NumeroCuenta = dtVentas(0)("NumCtaPago").ToString
Vta.Version = dtVentas(0)("Version").ToString
Vta.NumeroContrato = dtVentas(0)("NumeroContrato").ToString
diff --git a/Compras/RepComprasPrecios.aspx b/Compras/RepComprasPrecios.aspx
index 6adade2de..adc382397 100644
--- a/Compras/RepComprasPrecios.aspx
+++ b/Compras/RepComprasPrecios.aspx
@@ -83,9 +83,9 @@
-
-
-
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 4d035618e..fe15775f5 100644
--- a/OC/OC.aspx.vb
+++ b/OC/OC.aspx.vb
@@ -1,5 +1,4 @@
Option Explicit On
-Option Strict On
Imports System.Data
Imports Extensiones
@@ -176,7 +175,7 @@ Partial Class OC
End Property
Private Property NumCotizacionesEvaluar As Integer
Get
- NumCotizacionesEvaluar = IfNull(ViewState("NumCotizacionesEvaluar"), "-1", ViewState("NumCotizacionesEvaluar")).ToString().ToEntero()
+ NumCotizacionesEvaluar = IfNull(ViewState("NumCotizacionesEvaluar"), "0", ViewState("NumCotizacionesEvaluar")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("NumCotizacionesEvaluar") = value
@@ -1509,7 +1508,7 @@ Partial Class OC
'Si requiere cotizacion y el estatus siguiente es el final, desabilitar el combo del estatus
- If ChkCotizacion.Checked AndAlso objOC.CveEstatusSiguiente = CveEstatusFinalOK AndAlso (gvCotizaciones.Rows.Count = 0 Or NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1) Then
+ If UsuarioActual.Empresa.Funcionalidad(556) = "1" AndAlso ChkCotizacion.Checked AndAlso objOC.CveEstatusSiguiente = CveEstatusFinalOK AndAlso (gvCotizaciones.Rows.Count = 0 Or NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1) Then
CboE.Enabled = False
LblMsgEstatus.Visible = True
LblMsgEstatus.Text = "Cotización requerida para avanzar"
@@ -1669,7 +1668,7 @@ Partial Class OC
'If ChkCotizacion.Checked AndAlso objOC.CveEstatusSiguiente = CveEstatusFinalOK AndAlso NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1 Then
- If ChkCotizacion.Checked AndAlso CveEstatusSiguiente = CveEstatusFinalOK AndAlso NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1 Then
+ If UsuarioActual.Empresa.Funcionalidad(556) = "1" AndAlso ChkCotizacion.Checked AndAlso CveEstatusSiguiente = CveEstatusFinalOK AndAlso NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1 Then
CboE.Enabled = False
LblMsgEstatus.Visible = True
LblMsgEstatus.Text = "Cotización requerida para avanzar"
@@ -1745,6 +1744,11 @@ Partial Class OC
DdlProveedores.DataSource = GlobalDTCompProveedores(CveEmpresaActual)
DdlProveedores.DataBind()
DdlProveedores.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ DdlProveedorCot.DataSource = GlobalDTCompProveedores(CveEmpresaActual)
+ DdlProveedorCot.DataBind()
+ DdlProveedorCot.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
UPProv.Update() : UPPEmp.Update()
End Sub
@@ -2766,9 +2770,9 @@ Partial Class OC
If UsuarioActual.Empresa.Funcionalidad(565) = "1" Then
If CveConfianzaProveedor > 0 Then
- If CveConfianzaProveedor = 1 AndAlso Me.NumCotizaciones >= 1 Then
+ If CveConfianzaProveedor = 1 AndAlso Me.NumCotizacionesEvaluar >= 1 Then
TieneError = GeneraOrdenes(OC, Conta, ObjInventarios)
- ElseIf CveConfianzaProveedor = 2 AndAlso Me.NumCotizaciones >= 2 Then
+ ElseIf CveConfianzaProveedor = 2 AndAlso Me.NumCotizacionesEvaluar >= 2 Then
TieneError = GeneraOrdenes(OC, Conta, ObjInventarios)
Else
TieneError = True
@@ -2878,7 +2882,7 @@ Partial Class OC
Promocion = TxtPromocion.Text.Trim
Try
- If ChkCotizacion.Checked Then
+ If ChkCotizacion.Checked AndAlso gvCotizaciones.Rows.Count > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then
Dim CveProveedor = -1
Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0, PorIVA = 0.0, Porcentaje = 0.0
Dim IdPoliza = -1
@@ -2932,6 +2936,7 @@ Partial Class OC
HuboError = True
Exit For
End If
+
End If
'AGREGA DETALLES
@@ -4174,7 +4179,7 @@ Partial Class OC
' uppOpciones.Update()
'End If
- If ChkCotizacion.Checked AndAlso CveEstatusSiguiente = CveEstatusFinalOK AndAlso (gvCotizaciones.Rows.Count = 0 Or NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1) Then
+ If UsuarioActual.Empresa.Funcionalidad(556) = "1" AndAlso ChkCotizacion.Checked AndAlso CveEstatusSiguiente = CveEstatusFinalOK AndAlso (gvCotizaciones.Rows.Count = 0 Or NumCotizacionesGanadoras < gvCotizaciones.Rows.Count - 1) Then
CboE.Enabled = False
LblMsgEstatus.Visible = True
LblMsgEstatus.Text = "Cotización requerida para avanzar"
@@ -7307,4 +7312,173 @@ Partial Class OC
#End Region
+#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)
+ 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 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 " & 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
+ 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
+ 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
+ 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")
+ }).QueryToDataTable(True)
+
+
+
+ Dim Folio As String = ""
+ Dim CveProveedor As Integer = DdlProveedorCot.SelectedValue.ToEntero()
+
+ If CveProveedor > 0 Then
+ If objCotizacion.AddCotizacion(CveOrdenCompra, CveProveedor, -1, Folio, TxtFecha.Text, "", DdlMoneda.SelectedValue.ToEntero, 0, UsuarioActual.CveUsuario) Then
+ For Each dr As DataRow In dt.Rows
+ Dim RowPS = DtOCDetalle.FiltroPrimero(String.Format("Codigo='{0}'", dr("Codigo").ToString()))
+
+ Dim CveOrdenCompraDetalle As Integer = RowPS("CveOrdenCompraDetalle").ToString().ToEntero()
+ Dim CvePS As Integer = RowPS("CvePS").ToString().ToEntero()
+ Dim CveUnidadMedida As Integer = RowPS("CveUnidadMedida").ToString().ToEntero()
+ Dim Fecha As String = If(String.IsNullOrEmpty(dr("FechaEntrega").ToString()), "", If(IsDate(dr("FechaEntrega").ToString()), dr("FechaEntrega").ToString(), ""))
+
+ TieneError = Not objCotizacion.AddCotizacionDetalle(objCotizacion.CveCotizacion, CvePS, dr("PrecioUnitario").ToString().ToDecimal(), dr("Cantidad").ToString().ToDouble, CveUnidadMedida,
+ dr("Cantidad").ToString().ToDouble, Fecha, dr("Observacion").ToString(), CveOrdenCompraDetalle)
+ If TieneError = True Then Exit For
+ Next
+ End If
+ Else
+ TieneError = False
+ 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
+ objCotizacion.Dispose()
+ End Try
+
+ End If
+ End Sub
+#End Region
+
End Class
diff --git a/Ventas/ActualizarPrecios.aspx b/Ventas/ActualizarPrecios.aspx
index 4b2761db4..e5afac7e9 100644
--- a/Ventas/ActualizarPrecios.aspx
+++ b/Ventas/ActualizarPrecios.aspx
@@ -229,11 +229,11 @@
+ CssClass="table table-striped table-smallpadding table-advance table-hover Widthall" OnRowDataBound="gvSucursal_RowDataBound" Style="text-align: center;" GridLines="None">
-
+
@@ -415,6 +415,9 @@
$('.CsMCheckGvSucursal').find('input[type=checkbox]').prop('checked', false);
}
}
+ function FncSeleccionaChk(chk) {
+ chk.checked = true;
+ }
diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb
index 4c4fe1ea9..1969944e1 100644
--- a/Ventas/ActualizarPrecios.aspx.vb
+++ b/Ventas/ActualizarPrecios.aspx.vb
@@ -468,7 +468,12 @@ Partial Class Ventas_ActualizarPrecios
End While
Return dataTable
- End Function
+ End Function
#End Region
-
+
+ Protected Sub gvSucursal_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ e.Row.FCTextBox("TxtPrecioMinimo").Attributes.Add("onKeyUp", String.Format("FncSeleccionaChk({0});", e.Row.FCCheckBox("chkSucursal").ClientID))
+ End If
+ End Sub
End Class
\ No newline at end of file