Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4,6 +4,7 @@ Option Explicit On
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports CrystalDecisions.[Shared].Json
|
||||
Imports DocumentFormat.OpenXml.Presentation
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Ajax.Utilities
|
||||
Imports Profact.TimbraCFDI40
|
||||
@@ -2283,7 +2284,9 @@ Public Class ClsRH
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveUsuario As Integer, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False) As Boolean
|
||||
Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveUsuario As Integer, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double,
|
||||
SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False, Optional ActualizaSalarioV As Boolean = False,
|
||||
Optional OrigenU As String = "") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
SqlDataAdapter("PA_RH_PersonalUpdateSalarios")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -2296,6 +2299,8 @@ Public Class ClsRH
|
||||
.Add("@SDI", SqlDbType.Money).Value = SDI
|
||||
.Add("@SalarioDiarioSS", SqlDbType.Money).Value = SalarioDiarioSS
|
||||
.Add("@CalcularSDI", SqlDbType.Bit).Value = CalcularSDI
|
||||
.Add("@ActualizaSalarioV", SqlDbType.Bit).Value = ActualizaSalarioV
|
||||
.Add("@OrigenU", SqlDbType.Bit).Value = OrigenU
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
@@ -420,5 +420,24 @@ Public Class ClsTransportes
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Public Function VIA_FormularioTrip(cveTrip As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_VIA_FormularioTrip", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveTrip", SqlDbType.Int).Value = cveTrip
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = cveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el importe.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
|
||||
@@ -3962,14 +3962,14 @@ Namespace Modelos
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
For Each Row2 As DataRow In DT.Rows
|
||||
importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} AND CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString.ToDecimal) * ValorMultiplicador)
|
||||
importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} AND CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("PorcentajeIVA").ToString.ToDecimal)).ToString.ToDecimal) * ValorMultiplicador)
|
||||
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, ClsPaginas.GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}"
|
||||
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
||||
'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas
|
||||
'Nota cuando es Nota de crédito, debe de tomar el devoluciones y rebajas
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMX, ConceptoContableAplicar, Referencia, Concepto, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then
|
||||
@@ -3996,10 +3996,10 @@ Namespace Modelos
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
For Each Row2 As DataRow In DT.Rows
|
||||
importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString.ToDecimal) * ValorMultiplicador
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, ClsPaginas.GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
||||
Concepto = $"{ObjFactura.SerieFolio} {ClsPaginas.GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero).FiltroPrimeroValor("Clasificacion")} - {ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString.ToEntero}") }"
|
||||
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
||||
'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas
|
||||
@@ -4013,7 +4013,6 @@ Namespace Modelos
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
importeMovimiento = 0
|
||||
|
||||
@@ -6641,7 +6640,7 @@ Namespace Modelos
|
||||
|
||||
If Not ObjOS.LiberarVentaOS(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "No se pudo actualizar el estatus de almacen del pedido"
|
||||
MensajeError = "No se pudo liberar la remisión de la Orden de servicio"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
@@ -703,11 +703,11 @@
|
||||
total = total * TC;
|
||||
}
|
||||
|
||||
debugger
|
||||
debugger;
|
||||
if ($("#" + Chk.id).is(":checked")) {
|
||||
$('#' + Obj).attr('disabled', false);
|
||||
if (ToDouble($get('TxtImporte').value) != total) {
|
||||
|
||||
|
||||
if ((ToDouble($get('TxtImporte').value) + saldo) > total) {
|
||||
$('#' + Obj).val(saldo - (ToDouble($get('TxtImporte').value) + saldo - total));
|
||||
$get('TxtImporte').value = (total / TC).toFixed(2)
|
||||
|
||||
@@ -1181,7 +1181,7 @@ Partial Class Bancos_PopIECompras
|
||||
e.Row.FCTextBox("TxtSaldoDeudor").Attributes.Add("onKeyUp", "AjustaTextboxDeudores();")
|
||||
e.Row.FCTextBox("LbTipoMoneda").Text = If(e.Row.DataKey("CveMoneda").ToString.ToEntero = 1, "USD", " MXN")
|
||||
|
||||
Dim rv As RangeValidator = CType(e.Row.FindControl("RVSaldoDeudor"), RangeValidator)
|
||||
'Dim rv As RangeValidator = CType(e.Row.FindControl("RVSaldoDeudor"), RangeValidator)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
@@ -1456,12 +1456,13 @@ Partial Class Bancos_PopIECompras
|
||||
End If
|
||||
|
||||
If MsgError = "" Then
|
||||
Dim tc As Decimal = If(rw.DataKey("CveMoneda").ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
|
||||
Dim VentaActual As New Venta(UsuarioActual) With {.CveVenta = rw.DataKey("CveVenta").ToEntero, .ClienteNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveCliente = rw.DataKey("CveCliente").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero, .TC = rw.DataKey("TipoCambio").ToDecimal}
|
||||
Dim PagoVenta As New VentaPago
|
||||
PagoVenta.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
|
||||
PagoVenta.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
PagoVenta.ImportePagoVenta = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
PagoVenta.TCPago = rw.DataKey("TipoCambio").ToDecimal
|
||||
PagoVenta.TCPago = tc
|
||||
PagoVenta.CveCompraRelacionada = CompraActual.CveCompra
|
||||
PagoVenta.TipoPago = "Venta"
|
||||
If AplicaPrePolizaPagoVenta(VentaActual, PagoVenta, CvePrePoliza, ObjMov) Then
|
||||
|
||||
@@ -724,21 +724,39 @@ Partial Class Compras_Proveedores
|
||||
Dim ObjeFacturas As New ClsCompras
|
||||
If ObjeFacturas.GetFacturas(CveFactura, "-1", NowADS().AddYears(-2), NowADS(), "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) Then
|
||||
Dim XMLDoc As New XmlDocument
|
||||
Dim SXML As String
|
||||
Dim dr As DataRow = ObjeFacturas.DtResultados.FiltroPrimero("")
|
||||
If dr IsNot Nothing Then
|
||||
Dim Archivo As String = String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, dr("RFCDe"), dr("XML"))
|
||||
Try
|
||||
SXML = File.ReadAllText(Archivo).Replace("<br>", "").Replace("<", "").Replace("o;?", "").Replace(ChrW(&HFEFF), "")
|
||||
'SXML = SXML.TrimStart(vbCr, vbLf, vbNullChar)
|
||||
'SXML = SXML.TrimEnd(vbCr, vbLf, vbNullChar)
|
||||
SXML = SXML.Trim(New Char() {""c})
|
||||
SXML = SXML.Replace("o;?", "")
|
||||
|
||||
Try
|
||||
Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0)
|
||||
XMLDoc.LoadXml(SXML)
|
||||
Catch ex As Exception
|
||||
Try
|
||||
Dim oReader As New StreamReader(Archivo, Encoding.GetEncoding("ISO-8859-1"))
|
||||
XMLDoc.Load(oReader)
|
||||
oReader.Dispose()
|
||||
Catch ex2 As Exception
|
||||
GuardaLog("Error al intentar leer el XML del SAT. Error:" & ex2.ToString())
|
||||
End Try
|
||||
End Try
|
||||
If XMLDoc.InnerXml = "" Then
|
||||
Alert("No se pudo procesar el archivo xml.", TipoMensaje.MsgError)
|
||||
Return 0
|
||||
End If
|
||||
Else
|
||||
Alert("No se encontró el documento para cargarlo.", TipoMensaje.MsgError)
|
||||
Return 0
|
||||
End If
|
||||
|
||||
|
||||
Dim SXML As String = File.ReadAllText(UsuarioActual.Empresa.Ruta & "Compras\" & dr("RFCDe").ToString & "\" & dr("XML").ToString)
|
||||
'SXML = SXML.TrimStart(vbCr, vbLf, vbNullChar)
|
||||
'SXML = SXML.TrimEnd(vbCr, vbLf, vbNullChar)
|
||||
SXML = SXML.Trim(New Char() {""c})
|
||||
SXML = SXML.Replace("o;?", "")
|
||||
|
||||
XMLDoc.LoadXml(SXML)
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
|
||||
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
|
||||
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
|
||||
|
||||
Dim nodo As XmlNode = XMLDoc.DocumentElement
|
||||
Dim Version As String = ValorXml(nodo, "Version")
|
||||
@@ -756,55 +774,51 @@ Partial Class Compras_Proveedores
|
||||
|
||||
'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
' XMLDoc.LoadXml(File.ReadAllText(Archivo).Replace("<br>", "").Replace("<", "").Replace("o;?", "").Replace(ChrW(&HFEFF), ""))
|
||||
|
||||
|
||||
Dim node As XmlNode
|
||||
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Emisor", Prefijo), namespaces)
|
||||
If node IsNot Nothing Then
|
||||
TxtRFC.Text = ValorXml(node, "rfc")
|
||||
If node IsNot Nothing Then
|
||||
TxtRFC.Text = ValorXml(node, "rfc")
|
||||
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
TxtRazonSocial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
TxtNombreComercial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
ChkEstado.Checked = True
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
TxtRazonSocial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
TxtNombreComercial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
ChkEstado.Checked = True
|
||||
|
||||
Dim CodigoRegimenFiscal As String = ValorXml(node, "RegimenFiscal")
|
||||
Dim CodigoRegimenFiscal As String = ValorXml(node, "RegimenFiscal")
|
||||
|
||||
If Version = "4.0" Or CodigoRegimenFiscal.Trim.Length > 0 Then
|
||||
If Version = "4.0" Or CodigoRegimenFiscal.Trim.Length > 0 Then
|
||||
|
||||
|
||||
Dim CveRegimenFiscal As Integer = GlobalDTRegimenesFiscales(-1).FiltroPrimeroValor("CveRegimenFiscal", $" CodigoRegimenFiscal = '{ CodigoRegimenFiscal }'").ToEntero
|
||||
DdlRegimenFiscal.SelectedValueExist(CveRegimenFiscal)
|
||||
Dim CveRegimenFiscal As Integer = GlobalDTRegimenesFiscales(-1).FiltroPrimeroValor("CveRegimenFiscal", $" CodigoRegimenFiscal = '{ CodigoRegimenFiscal }'").ToEntero
|
||||
DdlRegimenFiscal.SelectedValueExist(CveRegimenFiscal)
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
TxtRazonSocial.Text = HttpUtility.HtmlDecode(ValorXml(node, "nombre"))
|
||||
TxtNombreComercial.Text = HttpUtility.HtmlDecode(ValorXml(node, "nombre"))
|
||||
Dim nodeDomicilio As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:DomicilioFiscal", Prefijo), namespaces)
|
||||
TxtDireccion.Text = ValorXml(nodeDomicilio, "calle") & " " & ValorXml(nodeDomicilio, "noExterior")
|
||||
ChkEstado.Checked = True
|
||||
Else
|
||||
TxtRazonSocial.Text = HttpUtility.HtmlDecode(ValorXml(node, "nombre"))
|
||||
TxtNombreComercial.Text = HttpUtility.HtmlDecode(ValorXml(node, "nombre"))
|
||||
Dim nodeDomicilio As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:DomicilioFiscal", Prefijo), namespaces)
|
||||
TxtDireccion.Text = ValorXml(nodeDomicilio, "calle") & " " & ValorXml(nodeDomicilio, "noExterior")
|
||||
ChkEstado.Checked = True
|
||||
|
||||
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Impuestos", Prefijo), namespaces)
|
||||
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
|
||||
'Dim nodeRetenciones As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Retencion", Prefijo), namespaces)
|
||||
'Dim nodeRet As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Retenciones", Prefijo), namespaces)
|
||||
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Impuestos", Prefijo), namespaces)
|
||||
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
|
||||
'Dim nodeRetenciones As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Retencion", Prefijo), namespaces)
|
||||
'Dim nodeRet As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Retenciones", Prefijo), namespaces)
|
||||
|
||||
Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Traslado", Prefijo), namespaces)
|
||||
For Each traslado As XmlNode In nodeTraslados
|
||||
If traslado.Attributes("impuesto").Value = "IVA" Then
|
||||
TxtIVA.Text = traslado.Attributes("tasa").Value.ToDouble.ToString("N2")
|
||||
'Retenciones
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Traslado", Prefijo), namespaces)
|
||||
For Each traslado As XmlNode In nodeTraslados
|
||||
If traslado.Attributes("impuesto").Value = "IVA" Then
|
||||
TxtIVA.Text = traslado.Attributes("tasa").Value.ToDouble.ToString("N2")
|
||||
'Retenciones
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert(String.Format("No se pudo cargar la información ({0})", ex.Message), TipoMensaje.MsgAdvertencia)
|
||||
Return 0
|
||||
End Try
|
||||
End If
|
||||
|
||||
End If
|
||||
Return 1
|
||||
@@ -5847,11 +5861,8 @@ Partial Class Compras_Proveedores
|
||||
Protected Sub LnkDownLoadDoc_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim Adjunto As String = GvRow.DataKey("Adjunto")
|
||||
|
||||
|
||||
Dim stringDescargaDocumento As String = UsuarioActual.Empresa.Ruta & String.Format("Edoc\\Proveedor\{0}\{1}", CveProveedor, Adjunto)
|
||||
|
||||
|
||||
Dim File As New FileInfo(stringDescargaDocumento)
|
||||
|
||||
If File.Exists Then
|
||||
|
||||
@@ -3,6 +3,7 @@ Option Explicit On
|
||||
Imports System.Data
|
||||
Imports System.Math
|
||||
Imports ClosedXML.Excel
|
||||
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||
Imports Extensiones
|
||||
|
||||
|
||||
@@ -1549,7 +1550,7 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
|
||||
'P R O V E E D O R E S - F A C T U R A S
|
||||
ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "18" Then
|
||||
ElseIf RblFormato.SelectedValue = "3" Then
|
||||
|
||||
#Region "P R O V E E D O R E S - F A C T U R A S"
|
||||
|
||||
@@ -1774,14 +1775,314 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
ObjCompras.Dispose()
|
||||
|
||||
ElseIf RblFormato.SelectedValue = "18" Then
|
||||
|
||||
Dim ObjCompras As New ClsCompras
|
||||
Dim ErrorCompras As Boolean = False
|
||||
Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL())
|
||||
Dim CveCompra As Integer
|
||||
Dim CvePrePoliza As Integer
|
||||
'Dim Contador As Integer = 0
|
||||
Dim ExisteCompra As Boolean = False
|
||||
Dim DtProveedores As New DataTable
|
||||
Dim NoEncontrados As Integer = 0
|
||||
Dim Encontrados As Integer = 0
|
||||
Dim RFC As String = ""
|
||||
|
||||
|
||||
Try
|
||||
DtProveedores = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim drr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
Dim CvePS As Integer = drr("CvePS").ToString().ToEntero()
|
||||
Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString().ToEntero()
|
||||
Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero()
|
||||
Dim dtsubp As DataTable = GlobalDTSubProyectos(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim CountRow As Integer = 1
|
||||
Dim LastSerieFolioTipoDoc As String = String.Empty
|
||||
Dim EsDetalle As Boolean = False
|
||||
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
|
||||
Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'")
|
||||
RFC = Row("RFC").ToString().Trim
|
||||
Dim Serie As String = Row("Serie").ToString().Trim
|
||||
Dim Folio As String = Row("Folio").ToString().Trim
|
||||
Dim Fecha As Date = Row("Fecha").ToString().ToDate
|
||||
Dim TipoDocto As String = Row("Tipo Documento").ToString().Trim.ToUpper
|
||||
Dim CveProveedor As Integer = 0
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
CveProveedor = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RazonSocial = '{RFC}'").ToString().ToEntero()
|
||||
Else
|
||||
CveProveedor = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString().ToEntero()
|
||||
End If
|
||||
GuardaLog(Sucursal + " - " + Row("Sucursal").ToString())
|
||||
Dim Moneda As String = Row("Moneda").ToString()
|
||||
Dim TipoCambio As String = If(dt.Columns.Contains("Tipo Cambio"), Row("Tipo Cambio").ToString(), "1")
|
||||
Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate
|
||||
Dim CveMoneda As Integer = 1
|
||||
Dim CveProveedorSucursal As Integer = If(dt.Columns.Contains("CveProveedorSucursal"), Row("CveProveedorSucursal").ToString(), "0").ToEntero
|
||||
Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Row("PorcentajeIVA").ToString(), "0").ToDecimal.RoundSQL
|
||||
Dim ImpuestosLocales As Decimal = If(dt.Columns.Contains("ImpuestosLocales"), Row("ImpuestosLocales").ToString(), "0").ToDecimal
|
||||
Dim RetIVAPorcentaje As Decimal = If(dt.Columns.Contains("RetIVAPorcentaje"), Row("RetIVAPorcentaje").ToString(), "0").ToDecimal
|
||||
Dim RetISRPorcentaje As Decimal = If(dt.Columns.Contains("RetISRPorcentaje"), Row("RetISRPorcentaje").ToString(), "0").ToDecimal
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", String.Format("SubProyecto='{0}'", If(dt.Columns.Contains("SubProyecto"), Row("SubProyecto").ToString(), ""))).ToEntero
|
||||
If CveSubProyecto = 0 Then CveSubProyecto = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero
|
||||
|
||||
If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorCompras = True
|
||||
If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorCompras = True
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con la razon social: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For
|
||||
Else
|
||||
If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For
|
||||
End If
|
||||
If Not CveProveedorSucursal > 0 Then CveProveedorSucursal = -1
|
||||
|
||||
|
||||
If LastSerieFolioTipoDoc = $"{Folio}" AndAlso UsuarioActual.CveEmpresa = 189 Then
|
||||
EsDetalle = True
|
||||
Else
|
||||
LastSerieFolioTipoDoc = $"{Folio}"
|
||||
EsDetalle = False
|
||||
End If
|
||||
|
||||
|
||||
Dim SubTotal As Decimal = 0
|
||||
Dim IVA As Decimal = 0
|
||||
Dim Total As Decimal = 0
|
||||
Dim Saldo As Decimal = 0
|
||||
Dim RetIVA As Decimal = 0
|
||||
Dim RetISR As Decimal = 0
|
||||
Dim IEPS As Decimal = 0
|
||||
|
||||
|
||||
If UsuarioActual.CveEmpresa = 189 AndAlso Not EsDetalle Then
|
||||
For Each item As DataRow In dt.FiltraParametros($"RFC <> '' AND Folio = '{Row("Folio").ToString()}'").Rows
|
||||
SubTotal += item("SubTotal").ToString().ToDecimal.RoundSQL
|
||||
IVA += item("IVA").ToString().ToDecimal.RoundSQL
|
||||
Total += item("Total").ToString().ToDecimal.RoundSQL
|
||||
Saldo += item("Saldo").ToString().ToDecimal.RoundSQL
|
||||
RetIVA += item("Ret IVA").ToString().ToDecimal.RoundSQL
|
||||
RetISR += item("Ret ISR").ToString().ToDecimal.RoundSQL
|
||||
IEPS += If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal.RoundSQL
|
||||
Next
|
||||
Else
|
||||
SubTotal = Row("SubTotal").ToString().ToDecimal.RoundSQL
|
||||
IVA = Row("IVA").ToString().ToDecimal.RoundSQL
|
||||
Total = Row("Total").ToString().ToDecimal.RoundSQL
|
||||
Saldo = Row("Saldo").ToString().ToDecimal.RoundSQL
|
||||
RetIVA = Row("Ret IVA").ToString().ToDecimal.RoundSQL
|
||||
RetISR = Row("Ret ISR").ToString().ToDecimal.RoundSQL
|
||||
IEPS = If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal.RoundSQL
|
||||
End If
|
||||
|
||||
If PorcentajeIVA > 0 AndAlso IVA = 0 Then PorcentajeIVA = 0
|
||||
|
||||
Dim RetIVAConcepto As String = If(dt.Columns.Contains("RetIVAConcepto"), Row("RetIVAConcepto").ToString(), "").ToUpper
|
||||
Dim RetISRConcepto As String = If(dt.Columns.Contains("RetISRConcepto"), Row("RetISRConcepto").ToString(), "").ToUpper
|
||||
Dim CveRetIVAConcepto As Integer = If(RetIVAConcepto = "HONORARIOS", 1, If(RetIVAConcepto = "FLETES", 2, If(RetIVAConcepto = "ARRENDAMIENTO", 4, -1)))
|
||||
Dim CveRetISRConcepto As Integer = If(RetISRConcepto = "HONORARIOS", 1, If(RetISRConcepto = "ARRENDAMIENTO", 2, If(RetISRConcepto = "RESICO", 4, -1)))
|
||||
|
||||
TipoDocto = IIf(TipoDocto.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA", "FACTURAS", ""), "Fac", "NC").ToString()
|
||||
|
||||
'RMF. falta validación de totales.
|
||||
'Temporalmente SE BORRARA
|
||||
Dim Transaccion As String = "" 'Row("Transaccion2").ToString()
|
||||
Dim Folio2 As String = "" 'Row("Folio2").ToString()
|
||||
Dim CodProvee As String = "" 'Row("CodProvee2").ToString()
|
||||
|
||||
'Moneda
|
||||
If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN", "MONEDA NACIONAL") Then
|
||||
CveMoneda = 1
|
||||
ElseIf Moneda.ToUpper.Contiene("DOLARES", "DOLAR", "USD", "DÓLARES", "DÓLAR") Then
|
||||
CveMoneda = 2
|
||||
End If
|
||||
|
||||
'Si no se especifica TC, se manda como pesos.
|
||||
If TipoCambio = "" Then TipoCambio = "1"
|
||||
If CveMoneda = 2 AndAlso TipoCambio = "1" Then
|
||||
TipoCambio = GlobalTipoCambio(Fecha).ToString
|
||||
End If
|
||||
|
||||
|
||||
Dim IEPSDetalle As Decimal = 0
|
||||
Dim CantidadDetalle As Decimal = 0
|
||||
Dim PUDetalle As Decimal = 0
|
||||
Dim IVADetalle As Decimal = 0
|
||||
|
||||
If RblFormato.SelectedValue = "18" Then
|
||||
|
||||
Dim CodigoDetalle As String = Row("Codigo").ToString
|
||||
If CodigoDetalle.Trim.Length > 0 Then
|
||||
Dim DrDetalles As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = '{CodigoDetalle}'")
|
||||
|
||||
If DrDetalles IsNot Nothing Then
|
||||
CvePS = DrDetalles("CvePS").ToString().ToEntero()
|
||||
CveUnidadMedida = DrDetalles("CveUnidadMedida").ToString().ToEntero()
|
||||
CveClasificacion = DrDetalles("CveClasificacion").ToString().ToEntero()
|
||||
Else
|
||||
Alert($"El código del producto no se encontro, error en registro {CountRow}")
|
||||
ErrorCompras = True
|
||||
End If
|
||||
|
||||
Else
|
||||
Alert($"El código es requerido, error en registro {CountRow}")
|
||||
ErrorCompras = True
|
||||
End If
|
||||
|
||||
|
||||
IEPSDetalle = Row("IEPS").ToString.ToDecimal
|
||||
CantidadDetalle = Row("Cantidad").ToString.ToDecimal
|
||||
PUDetalle = Row("PU").ToString.ToDecimal
|
||||
IVADetalle = Row("IVA").ToString.ToDecimal
|
||||
|
||||
If CantidadDetalle = 0 Then
|
||||
Alert($"No se especifico la cantidad, error en registro {CountRow}")
|
||||
ErrorCompras = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'PrePóliza
|
||||
If Not EsDetalle Then
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Compras/SaldoInicial", 1, Total, Total, CveMoneda, Fecha, String.Format("{0}-{1}", Serie, Folio), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If Not CvePrePoliza > 0 Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then
|
||||
FechaVencimiento = Fecha
|
||||
End If
|
||||
|
||||
If Not EsDetalle Then
|
||||
If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal + ImpuestosLocales, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento,
|
||||
False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal,
|
||||
NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto, CveRetIVAConcepto:=CveRetIVAConcepto, CveRetISRConcepto:=CveRetISRConcepto) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
CveCompra = ObjCompras.CveCompra
|
||||
|
||||
SubTotal = Row("SubTotal").ToString().ToDecimal
|
||||
IVA = Row("IVA").ToString().ToDecimal
|
||||
Total = Row("Total").ToString().ToDecimal
|
||||
Saldo = Row("Saldo").ToString().ToDecimal
|
||||
RetIVA = Row("Ret IVA").ToString().ToDecimal
|
||||
RetISR = Row("Ret ISR").ToString().ToDecimal
|
||||
IEPS = Row("IEPS").ToString().ToDecimal
|
||||
End If
|
||||
|
||||
'Compra Detalle
|
||||
If RblFormato.SelectedValue = "18" Then
|
||||
|
||||
Dim TotalDetalles As Decimal = SubTotal
|
||||
If PUDetalle > 0 Then
|
||||
TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle
|
||||
End If
|
||||
|
||||
If Math.Abs(TotalDetalles - Total) > 0.01 Then
|
||||
ErrorCompras = True
|
||||
Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, CantidadDetalle, PUDetalle, (CantidadDetalle * PUDetalle) * PorcentajeIVA, TotalDetalles, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje, IEPSPS:=IEPSDetalle) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, SubTotal, SubTotal * PorcentajeIVA, SubTotal, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If ImpuestosLocales > 0 Then 'se agrega como parte de la partida, sin iva.
|
||||
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, ImpuestosLocales, ImpuestosLocales, ImpuestosLocales, 0, "Carga Inicial", -1, IVAPorcentaje:=0, RetIVAPorcentaje:=0, RetISRPorcentaje:=0) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Dim ConceptoContablePago As Integer = 17
|
||||
If TipoDocto = "NC" Then ConceptoContablePago = 60
|
||||
|
||||
If Not EsDetalle Then
|
||||
|
||||
SubTotal = 0
|
||||
IVA = 0
|
||||
Total = 0
|
||||
Saldo = 0
|
||||
RetIVA = 0
|
||||
RetISR = 0
|
||||
IEPS = 0
|
||||
|
||||
For Each item As DataRow In dt.FiltraParametros($"RFC <> '' AND Folio = '{Row("Folio").ToString()}'").Rows
|
||||
SubTotal += item("SubTotal").ToString().ToDecimal.RoundSQL
|
||||
IVA += item("IVA").ToString().ToDecimal.RoundSQL
|
||||
Total += item("Total").ToString().ToDecimal.RoundSQL
|
||||
Saldo += item("Saldo").ToString().ToDecimal.RoundSQL
|
||||
RetIVA += item("Ret IVA").ToString().ToDecimal.RoundSQL
|
||||
RetISR += item("Ret ISR").ToString().ToDecimal.RoundSQL
|
||||
IEPS += If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal.RoundSQL
|
||||
Next
|
||||
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Total, IIf(TipoDocto = "Fac", 5, 18).ToString().ToEntero(), Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, SubTotal, 6, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero(), Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
|
||||
If IVA > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, IVA, 14, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
End If
|
||||
|
||||
If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, IEPS, 25, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
|
||||
If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, RetIVA, 15, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
If RetISR > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetISR, RetISR, 16, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
'If ImpuestosLocales > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImpuestosLocales, ImpuestosLocales, 27, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For
|
||||
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, ConceptoContablePago, Folio.ToString(), Folio.ToString(), CveCompra:=CveCompra, CveProveedor:=CveProveedor, Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, 95, Folio.ToString(), Folio.ToString(), CveCompra:=CveCompra, CveProveedor:=CveProveedor, Contabilizable:=False) Then ErrorCompras = True : Exit For
|
||||
End If
|
||||
End If
|
||||
Encontrados = Encontrados + 1
|
||||
|
||||
CountRow = CountRow + 1
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al cargar los datos", ex)
|
||||
ErrorCompras = True
|
||||
End Try
|
||||
|
||||
If Not ErrorCompras Then
|
||||
|
||||
'If Encontrados > 0 Then
|
||||
' Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.<br>Se Omitieron: <b>{1}</b> Compras ya que ya se encuentran registradas.", Encontrados, NumRows - 1 - Encontrados), TipoMensaje.MsgInformacion)
|
||||
'Else
|
||||
' Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.", Encontrados), TipoMensaje.MsgInformacion)
|
||||
'End If
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.", Encontrados), TipoMensaje.MsgInformacion)
|
||||
'Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente. RFC:{1} ", Encontrados, RFC), TipoMensaje.MsgInformacion)
|
||||
|
||||
ObjCompras.Commit()
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
Alert(String.Format("NO Se agregaron: <b>{0}</b> Compras.", NumRows), TipoMensaje.MsgError)
|
||||
ObjCompras.RollBack()
|
||||
End If
|
||||
ObjCompras.Dispose()
|
||||
|
||||
#End Region
|
||||
|
||||
'C L I E N T E S - F A C T U R A S
|
||||
ElseIf RblFormato.SelectedValue = "4" Or RblFormato.SelectedValue = "17" Then
|
||||
ElseIf RblFormato.SelectedValue = "4" Then
|
||||
|
||||
#Region "C L I E N T E S - F A C T U R A S"
|
||||
|
||||
|
||||
Dim NoEncontrados As Integer = 0
|
||||
Dim Encontrados As Integer = 0
|
||||
Dim StrRFCNoencontrados As New StringBuilder
|
||||
@@ -2089,11 +2390,397 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
|
||||
|
||||
ElseIf RblFormato.SelectedValue = "17" Then
|
||||
Dim NoEncontrados As Integer = 0
|
||||
Dim Encontrados As Integer = 0
|
||||
Dim StrRFCNoencontrados As New StringBuilder
|
||||
Dim drr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero("AplicaParaVenta = 1")
|
||||
If drr Is Nothing Then
|
||||
Alert("No existen productos para venta. favor de crear uno e intentar de nuevo", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjIE As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
||||
Dim ErrorVentas As Boolean = False
|
||||
Dim CveVenta As Integer
|
||||
Dim CvePrePoliza As Integer
|
||||
Dim DtClientes As New DataTable
|
||||
'Dim ExisteVenta As Boolean = False
|
||||
'Dim Contador As Integer = 0
|
||||
DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1)
|
||||
Dim CvePS As Integer = drr("CvePS").ToString().ToEntero()
|
||||
Dim CveUnidadMedida As Integer = drr("CveUnidadMedida").ToString().ToEntero()
|
||||
Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero()
|
||||
|
||||
If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True
|
||||
' If Not CveSucursal > 0 Then Alert("No se encontró la sucursal.", TipoMensaje.MsgError) : ErrorVentas = True
|
||||
If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorVentas = True
|
||||
Dim dtsubp As DataTable = GlobalDTSubProyectos(UsuarioActual.CveEmpresa)
|
||||
|
||||
'For Each drt As DataRow In dt.FiltraParametros("RFC <> ''", DistinctColumns:={"RFC"}).Rows
|
||||
' Dim RFC As String = drt("RFC").ToString().Trim.Replace("-", "").Replace(" ", "")
|
||||
' Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString().ToEntero()
|
||||
' If CveCliente <= 0 Then
|
||||
' Dim OBJ As New ClsClientes
|
||||
' OBJ.AgregarClienteNoFrecuente(RFC, RFC, "", "", "", "", "", 26, RFC, "", "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1)
|
||||
' OBJ.Dispose()
|
||||
' End If
|
||||
'Next
|
||||
'GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
|
||||
'DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1)
|
||||
Dim CountRow As Integer = 1
|
||||
Dim LastSerieFolioTipoDoc As String = String.Empty
|
||||
Dim EsDetalle As Boolean = False
|
||||
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
|
||||
Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'")
|
||||
Dim TipoDocto As String = Row("Tipo Documento").ToString().Trim
|
||||
Dim RFC As String = Row("RFC").ToString().Trim.Replace("-", "").Replace(" ", "")
|
||||
Dim Serie As String = Row("Serie").ToString().Trim
|
||||
Dim Folio As Integer = Row("Folio").ToString().ToEntero()
|
||||
Dim Fecha As Date = Row("Fecha").ToString().ToDate
|
||||
Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate
|
||||
Dim ImpuestoLocal As Decimal = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString().ToDecimal, 0D)
|
||||
Dim Amortizacion As Decimal = If(dt.Columns.Contains("Amort.Ant"), Row("Amort.Ant").ToString().ToDecimal, 0)
|
||||
Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString().ToEntero()
|
||||
|
||||
If LastSerieFolioTipoDoc = $"{Serie}{Folio}{TipoDocto}" AndAlso UsuarioActual.CveEmpresa = 189 Then
|
||||
EsDetalle = True
|
||||
Else
|
||||
LastSerieFolioTipoDoc = $"{Serie}{Folio}{TipoDocto}"
|
||||
EsDetalle = False
|
||||
End If
|
||||
|
||||
|
||||
Dim SubTotal As Decimal = 0
|
||||
Dim IVA As Decimal = 0
|
||||
Dim Total As Decimal = 0
|
||||
Dim Saldo As Decimal = 0
|
||||
Dim RetIVA As Decimal = 0
|
||||
Dim RetISR As Decimal = 0
|
||||
Dim IEPS As Decimal = 0
|
||||
|
||||
If UsuarioActual.CveEmpresa = 189 AndAlso Not EsDetalle Then
|
||||
|
||||
For Each item As DataRow In dt.FiltraParametros($"RFC <> '' AND Folio = '{Row("Folio").ToString()}' AND Serie = '{Row("Serie").ToString()}' AND [Tipo Documento] = '{Row("Tipo Documento").ToString()}' ").Rows
|
||||
SubTotal += item("SubTotal").ToString().ToDecimal
|
||||
IVA += item("IVA").ToString().ToDecimal
|
||||
Total += item("Total").ToString().ToDecimal
|
||||
Saldo += item("Saldo").ToString().ToDecimal
|
||||
RetIVA += item("Ret IVA").ToString().ToDecimal
|
||||
RetISR += item("Ret ISR").ToString().ToDecimal
|
||||
IEPS += item("IEPS").ToString().ToDecimal
|
||||
Next
|
||||
Else
|
||||
SubTotal = Row("SubTotal").ToString().ToDecimal
|
||||
IVA = Row("IVA").ToString().ToDecimal
|
||||
Total = Row("Total").ToString().ToDecimal
|
||||
Saldo = Row("Saldo").ToString().ToDecimal
|
||||
RetIVA = Row("Ret IVA").ToString().ToDecimal
|
||||
RetISR = Row("Ret ISR").ToString().ToDecimal
|
||||
IEPS = Row("IEPS").ToString().ToDecimal
|
||||
End If
|
||||
|
||||
Dim Moneda As String = Row("Moneda").ToString()
|
||||
Dim TipoCambio As String = Row("Tipo Cambio").ToString()
|
||||
Dim CveMoneda As Integer = 1
|
||||
Dim Vendedor As String = If(dt.Columns.Contains("Vendedor"), Row("Vendedor").ToString(), "")
|
||||
Dim CveVendedor As Integer = 0
|
||||
|
||||
Dim CveClienteSucursal As Integer = 0 'Row("CveClienteSucursal").ToString().ToEntero()
|
||||
Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString(), "")
|
||||
Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString().ToDecimal, 2), 0)
|
||||
Dim PorcentajeRetIVA As Decimal = If(dt.Columns.Contains("PorcentajeRetIVA"), Round(Row("PorcentajeRetIVA").ToString().ToDecimal, 4), 0)
|
||||
Dim PorcentajeRetISR As Decimal = If(dt.Columns.Contains("PorcentajeRetISR"), Round(Row("PorcentajeRetISR").ToString().ToDecimal, 4), 0)
|
||||
Dim PedidoContrato As String = If(dt.Columns.Contains("Pedido"), Row("Pedido").ToString(), "")
|
||||
|
||||
GuardaLog(Sucursal + "-" + Row("Folio").ToString())
|
||||
'Temporalmente SE BORRARA
|
||||
Dim Transaccion As String = "" ' Row("Transaccion2").ToString()
|
||||
Dim Folio2 As String = "" ' Row("Folio2").ToString()
|
||||
Dim CodCliente As String = "" 'Row("CodCliente2").ToString()
|
||||
|
||||
Dim IEPSDetalle As Decimal = 0
|
||||
Dim CantidadDetalle As Decimal = 0
|
||||
Dim PUDetalle As Decimal = 0
|
||||
Dim IVADetalle As Decimal = 0
|
||||
Dim PorcentajeIEPS As Decimal = 0
|
||||
|
||||
If IEPS > 0 Then
|
||||
PorcentajeIEPS = If(dt.Columns.Contains("PorcentajeIEPS"), Round(Row("PorcentajeIEPS").ToString().ToDecimal, 4), 0)
|
||||
End If
|
||||
|
||||
If RblFormato.SelectedValue = "17" Then
|
||||
|
||||
Dim CodigoDetalle As String = Row("Codigo").ToString
|
||||
If CodigoDetalle.Trim.Length > 0 Then
|
||||
Dim DrDetalles As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = '{CodigoDetalle}'")
|
||||
|
||||
If DrDetalles IsNot Nothing Then
|
||||
CvePS = DrDetalles("CvePS").ToString().ToEntero()
|
||||
CveUnidadMedida = DrDetalles("CveUnidadMedida").ToString().ToEntero()
|
||||
CveClasificacion = DrDetalles("CveClasificacion").ToString().ToEntero()
|
||||
Else
|
||||
Alert($"El código del producto no se encontro, error en registro {CountRow}")
|
||||
ErrorVentas = True
|
||||
End If
|
||||
Else
|
||||
Alert($"El código es requerido, error en registro {CountRow}")
|
||||
ErrorVentas = True
|
||||
End If
|
||||
|
||||
IEPSDetalle = Row("IEPS").ToString.ToDecimal
|
||||
CantidadDetalle = Row("Cantidad").ToString.ToDecimal
|
||||
PUDetalle = Row("PU").ToString.ToDecimal
|
||||
IVADetalle = Row("IVA").ToString.ToDecimal
|
||||
|
||||
If CantidadDetalle = 0 Then
|
||||
Alert($"No se especifico la cantidad, error en registro {CountRow}")
|
||||
ErrorVentas = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If dt.Columns.Contains("Cliente Sucursal") AndAlso Row("Cliente Sucursal").ToString() <> "" Then
|
||||
|
||||
Dim ObjCliente As New ClsClientes
|
||||
If ObjCliente.GetSucursales(CveCliente) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
CveClienteSucursal = ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "SucursalCliente = '" & Row("Cliente Sucursal").ToString().Trim & "'").ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjCliente.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
'If Not CveCliente > 0 Then Alert(String.Format("No se encontró el cliente con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorVentas = True : RFC.GuardaLog : Exit For
|
||||
TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESO", "INGRESOS", "ING", "FACTURA", "FACTURAS"), "Ing", IIf(TipoDocto.ToUpper.Contiene("EGRESO", "EGRESOS", "EGS"), "Egs", "Rem")).ToString()
|
||||
'PrePóliza
|
||||
If Not EsDetalle Then
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Venta/SaldoInicial", 1, Total, Total, 1, Fecha, String.Format("{0}-{1}", Serie, Folio), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
End If
|
||||
|
||||
If Vendedor <> "" Then
|
||||
CveVendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString().ToEntero()
|
||||
If Not CveVendedor > 0 Then CveVendedor = 0
|
||||
Else
|
||||
CveVendedor = 0
|
||||
End If
|
||||
|
||||
'Moneda
|
||||
If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then
|
||||
CveMoneda = 1
|
||||
TipoCambio = "1"
|
||||
ElseIf Moneda.ToUpper.Contiene("DÓLAR", "DÓLARES", "DOLARES", "USD") Then
|
||||
CveMoneda = 2
|
||||
|
||||
If TipoCambio.Trim.ToDecimal < 10 Then
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
|
||||
TipoCambio = GlobalTipoCambio(Fecha.AddDays(-1)).ToString()
|
||||
Else
|
||||
TipoCambio = GlobalTipoCambio(Fecha).ToString()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Si no se especifica TC, se manda como pesos.
|
||||
If TipoCambio = "" Then TipoCambio = "1"
|
||||
|
||||
If Not CveClienteSucursal > 0 Then CveClienteSucursal = -1
|
||||
|
||||
If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then
|
||||
FechaVencimiento = Fecha
|
||||
End If
|
||||
|
||||
|
||||
'Venta
|
||||
If CveCliente > 0 Then
|
||||
|
||||
|
||||
If TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
||||
GuardaLog(Serie & "-" & Folio)
|
||||
If Not EsDetalle Then
|
||||
If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero(), CveClienteSucursal, SubTotal, 0, Amortizacion, IVA, RetIVA, RetISR, Total, CveMoneda, TipoCambio.ToDouble,
|
||||
0, 0, 0, FechaVencimiento, Fecha, "", "", Fecha, CveVendedor, Folio2, "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, 0, CvePrePoliza,
|
||||
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero(), CveSubProyectoEjecucion:=Sucursal.ToEntero(),
|
||||
CveSubProyectoCobranza:=Sucursal.ToEntero(), IEPS:=IEPS, ObservacionesAlmacen:=Transaccion, Entrega:=CodCliente, ImpuestoLocal:=ImpuestoLocal,
|
||||
PedidoContrato:=PedidoContrato, CveMetodoPago33:=3) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
CveVenta = ObjVentas.CveVenta
|
||||
End If
|
||||
|
||||
If Not EsDetalle Then
|
||||
SubTotal = Row("SubTotal").ToString().ToDecimal
|
||||
IVA = Row("IVA").ToString().ToDecimal
|
||||
Total = Row("Total").ToString().ToDecimal
|
||||
Saldo = Row("Saldo").ToString().ToDecimal
|
||||
RetIVA = Row("Ret IVA").ToString().ToDecimal
|
||||
RetISR = Row("Ret ISR").ToString().ToDecimal
|
||||
IEPS = Row("IEPS").ToString().ToDecimal
|
||||
End If
|
||||
|
||||
If RblFormato.SelectedValue = "17" Then
|
||||
|
||||
Dim TotalDetalles As Decimal = SubTotal
|
||||
If PUDetalle > 0 Then
|
||||
TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle
|
||||
End If
|
||||
|
||||
If Math.Abs(TotalDetalles - Total) > 0.01 Then
|
||||
ErrorVentas = True
|
||||
Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle, IVADetalle, TotalDetalles, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0,
|
||||
PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle, PorcentajeRetISR:=PorcentajeRetISR, PorcentajeIEPS:=PorcentajeIEPS) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Else
|
||||
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=0) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim ConceptoContable As Integer = 1
|
||||
Dim ConceptoContablePago As Integer = 2
|
||||
If TipoDocto = "Egs" Then
|
||||
ConceptoContable = 12
|
||||
ConceptoContablePago = 91
|
||||
End If
|
||||
|
||||
If FolioFiscal <> "" Then
|
||||
If Not ObjVentas.UpdateVentaFolioFiscal(FolioFiscal, CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim UsaComplementaria As Boolean = False
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then UsaComplementaria = True
|
||||
|
||||
If Not EsDetalle Then
|
||||
|
||||
SubTotal = 0
|
||||
IVA = 0
|
||||
Total = 0
|
||||
Saldo = 0
|
||||
RetIVA = 0
|
||||
RetISR = 0
|
||||
For Each item As DataRow In dt.FiltraParametros($"RFC <> '' AND Folio = '{Row("Folio").ToString()}' AND Serie = '{Row("Serie").ToString()}' AND [Tipo Documento] = '{Row("Tipo Documento").ToString()}' ").Rows
|
||||
SubTotal += item("SubTotal").ToString().ToDecimal
|
||||
IVA += item("IVA").ToString().ToDecimal
|
||||
Total += item("Total").ToString().ToDecimal
|
||||
Saldo += item("Saldo").ToString().ToDecimal
|
||||
RetIVA += item("Ret IVA").ToString().ToDecimal
|
||||
RetISR += item("Ret ISR").ToString().ToDecimal
|
||||
IEPS += item("IEPS").ToString().ToDecimal
|
||||
Next
|
||||
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, SubTotal, 4, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero(), PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Total, ConceptoContable, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
|
||||
If IVA > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, IVA, 13, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If IEPS > 0 Then
|
||||
'AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio, 38, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS)
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, IEPS, 38, Folio.ToString, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
|
||||
End If
|
||||
|
||||
If RetIVA > 0 Then
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If RetISR > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If ImpuestoLocal > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, ImpuestoLocal, 27, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
|
||||
If UsaComplementaria Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Total * TipoCambio.ToDecimal - Total, 203, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, TipoCambio:=TipoCambio.ToDecimal, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, ConceptoContablePago, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, 95, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
If Not EsDetalle Then
|
||||
|
||||
SubTotal = 0
|
||||
IVA = 0
|
||||
Total = 0
|
||||
Saldo = 0
|
||||
RetIVA = 0
|
||||
RetISR = 0
|
||||
For Each item As DataRow In dt.FiltraParametros($"RFC <> '' AND Folio = '{Row("Folio").ToString()}' AND Serie = '{Row("Serie").ToString()}' AND [Tipo Documento] = '{Row("Tipo Documento").ToString()}' ").Rows
|
||||
SubTotal += item("SubTotal").ToString().ToDecimal
|
||||
IVA += item("IVA").ToString().ToDecimal
|
||||
Total += item("Total").ToString().ToDecimal
|
||||
Saldo += item("Saldo").ToString().ToDecimal
|
||||
RetIVA += item("Ret IVA").ToString().ToDecimal
|
||||
RetISR += item("Ret ISR").ToString().ToDecimal
|
||||
IEPS += item("IEPS").ToString().ToDecimal
|
||||
Next
|
||||
|
||||
'ANTICIPOS
|
||||
Dim CveIE As Integer = ObjIE.AddBancos_IE(1, 1, Fecha, Folio.ToString(), "", Total, 1,
|
||||
1, "Anticipo Cliente", "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Total, 30, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Total, 66, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveIE:=CveIE, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
End If
|
||||
Encontrados = Encontrados + 1
|
||||
|
||||
Else
|
||||
NoEncontrados = NoEncontrados + 1
|
||||
StrRFCNoencontrados.AppendFormat("{0}<br/>", RFC)
|
||||
'ErrorVentas = True
|
||||
'Exit For
|
||||
End If
|
||||
|
||||
CountRow = CountRow + 1
|
||||
Next
|
||||
If Not ErrorVentas Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Ventas correctamente. <b>{1} no encontrados</b><br/>{2} ", Encontrados, NoEncontrados, StrRFCNoencontrados), TipoMensaje.MsgInformacion)
|
||||
ObjVentas.Commit()
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
Alert(String.Format("Error al registrar : <b>{0}</b> Ventas correctamente. <b>{1} no encontrados</b><br/>{2} ", Encontrados, NoEncontrados, StrRFCNoencontrados), TipoMensaje.MsgError)
|
||||
ObjVentas.RollBack()
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
' R H - P E R S O N A L
|
||||
ElseIf RblFormato.SelectedValue = "6" Then
|
||||
|
||||
|
||||
BIN
Imagenes/autobus.png
Normal file
BIN
Imagenes/autobus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Imagenes/sprinter.png
Normal file
BIN
Imagenes/sprinter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -54,7 +54,7 @@ Partial Class Inventarios_Default
|
||||
DivListasPrecios2.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
If UsuarioActual.TienePermisoProceso(387) Then
|
||||
LnkBsucarSerie.Visible = True
|
||||
End If
|
||||
|
||||
|
||||
@@ -19,14 +19,25 @@
|
||||
<li>
|
||||
<a target="_blank" class="ayuda" href="../Documentacion/DocumentacionInventarios.aspx#RecepcionAlmacen"> </a>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="true" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
|
||||
</li>
|
||||
|
||||
<%--
|
||||
<li>
|
||||
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="true" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
|
||||
</li>
|
||||
--%>
|
||||
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional" RenderMode="Inline">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkAgregarExcel" Visible="true" OnClick="LnkAgregarExcel_Click" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<asp:UpdatePanel ID="uppCargaBitacora" runat="server" UpdateMode="Conditional" RenderMode="Inline">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="HplCargaBitacora" runat="server" Visible="false" OnClick="HplCargaBitacora_Click" Style="color: #686868;"><i class="fa fa-file-load-o" style="color: #686868;"></i> Cargar Bitácora</asp:LinkButton>
|
||||
<asp:LinkButton ID="HplCargaBitacora" runat="server" Visible="false" OnClick="HplCargaBitacora_Click" Style="color: #686868;"><i class="fa fa-book" aria-hidden="true"></i> Cargar Bitácora</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
@@ -837,7 +848,7 @@
|
||||
<asp:Label Text="" ID="LbCantidad" runat="server" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="trRegistroSerie" runat="server">
|
||||
<td width="80px">Serie:</td>
|
||||
<td>
|
||||
<asp:TextBox runat="server" ID="TxtSerie" Width="300px" ClientIDMode="Static" />
|
||||
|
||||
@@ -7,6 +7,7 @@ Imports System.Text
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Org.BouncyCastle.Asn1.X509
|
||||
|
||||
Partial Class Inventarios_RecepcionAlmacen
|
||||
Inherits ClsPaginas
|
||||
@@ -154,12 +155,21 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
ViewState("PUSerie") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveConsecSerie As Integer
|
||||
'Private Property CveConsecSerie As Integer
|
||||
' Get
|
||||
' Return CType(ViewState("CveConsecSerie"), Integer)
|
||||
' End Get
|
||||
' Set(value As Integer)
|
||||
' ViewState("CveConsecSerie") = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
Private Property CveCompraDetalle As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveConsecSerie"), Integer)
|
||||
Return CType(ViewState("CveCompraDetalle"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveConsecSerie") = value
|
||||
ViewState("CveCompraDetalle") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TotalGV As Decimal
|
||||
@@ -412,6 +422,11 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Property
|
||||
Private Property ArchivoBitacora As String
|
||||
Get
|
||||
|
||||
If ViewState("ArchivoBitacora") Is Nothing Then
|
||||
ViewState("ArchivoBitacora") = ""
|
||||
End If
|
||||
|
||||
Return CType(ViewState("ArchivoBitacora"), String)
|
||||
End Get
|
||||
Set(value As String)
|
||||
@@ -420,6 +435,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Property
|
||||
Private Property ArchivoBitacoraDetalle As String
|
||||
Get
|
||||
If ViewState("ArchivoBitacoraDetalle") Is Nothing Then
|
||||
ViewState("ArchivoBitacoraDetalle") = ""
|
||||
End If
|
||||
|
||||
Return CType(ViewState("ArchivoBitacoraDetalle"), String)
|
||||
End Get
|
||||
Set(value As String)
|
||||
@@ -427,8 +446,6 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Private Property CveImportacionSeleccionada As Integer
|
||||
Get
|
||||
|
||||
@@ -444,8 +461,6 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Private Property CveFleteSeleccionado As Integer
|
||||
Get
|
||||
|
||||
@@ -469,10 +484,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
If Not IsPostBack Then
|
||||
|
||||
InicializaValores()
|
||||
|
||||
CargaUrlParametros()
|
||||
CargaPendientes()
|
||||
|
||||
CargaPermisos()
|
||||
|
||||
Dim PermisoEspecialCambioFecha As Boolean = False
|
||||
@@ -482,10 +495,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
TxtFecha.Enabled = False
|
||||
ImgFecha.Visible = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -497,6 +507,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
GvInv.Columns(8).Visible = TienePermisoImportes
|
||||
GvInv.Columns(10).Visible = TienePermisoImportes
|
||||
'permiso para bloquear la captura de la serie por este medio y que sea solo por lectura del ps y luego serie
|
||||
If UsuarioActual.TienePermisoProceso(388) Then
|
||||
BtnAgregarPS.Enabled = False
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
@@ -1461,11 +1475,12 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
'If e.Row.DBCampo("CveMetodoInventario").ToString = "5" Then
|
||||
e.Row.FCButton("BtnSerie").Visible = True
|
||||
e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"))
|
||||
e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}°{6}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("CveCompraDetalle"))
|
||||
|
||||
e.Row.FCTextBox("TbCantidadF").Enabled = False
|
||||
e.Row.FCCheckBox("cbInv").Enabled = False
|
||||
Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count
|
||||
'Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count
|
||||
Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", e.Row.DataKey("CveCompraDetalle"))).Rows.Count
|
||||
e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString
|
||||
|
||||
'' Empresa Acumuladores
|
||||
@@ -1572,9 +1587,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
e.Row.FCCheckBox("cbInv").Visible = False
|
||||
End If
|
||||
|
||||
|
||||
e.Row.FCLabel("LbTotal").Text = ((e.Row.DBCampo("PU").ToDecimal + e.Row.DBCampo("CostoIndirecto").ToDecimal) * e.Row.DBCampo("CantidadF").ToDecimal).FormatoNumero
|
||||
|
||||
TotalGV += (e.Row.DBCampo("PU").ToDecimal + e.Row.DBCampo("CostoIndirecto").ToDecimal) * e.Row.DBCampo("CantidadF").ToDecimal
|
||||
|
||||
End If
|
||||
@@ -1617,7 +1630,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
TdSeriePS.Visible = True
|
||||
TxtSeriePS.Focus()
|
||||
|
||||
CveConsecSerie = Gvr.DataKey("Consec").ToEntero
|
||||
'CveConsecSerie = Gvr.DataKey("Consec").ToEntero
|
||||
CveCompraDetalle = Gvr.DataKey("CveCompraDetalle").ToEntero
|
||||
CvePSSerie = Gvr.DataKey("CvePS").ToEntero
|
||||
CveUMSerie = Gvr.DataKey("CveUM").ToEntero
|
||||
Exit Sub
|
||||
@@ -1717,7 +1731,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
CvePSSerie = Argumentos(0).ToEntero
|
||||
CveUMSerie = Argumentos(1).ToEntero
|
||||
PUSerie = Argumentos(2).ToDecimal
|
||||
CveConsecSerie = Argumentos(5).ToEntero
|
||||
'CveConsecSerie = Argumentos(5).ToEntero
|
||||
CveCompraDetalle = Argumentos(6).ToEntero
|
||||
|
||||
CargaSerie(1)
|
||||
|
||||
@@ -1732,6 +1747,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
DtDatosDetalle.Columns.Add("PU", GetType(Decimal))
|
||||
DtDatosDetalle.Columns.Add("Serie", GetType(String))
|
||||
DtDatosDetalle.Columns.Add("FechaCaducidad", GetType(String))
|
||||
DtDatosDetalle.Columns.Add("CveCompraDetalle", GetType(Integer))
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -1747,11 +1764,13 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
'RegistraScript("document.getElementById(""TxtSerie"").focus();")
|
||||
RegistraScript("$('#DivSerie').modal();", "ModalLote")
|
||||
|
||||
GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
|
||||
'GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
|
||||
GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle), "Consec DESC")
|
||||
GvSerie.DataBind()
|
||||
|
||||
'VALIDA QUE SIGA AGREGANDO
|
||||
If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then
|
||||
'If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then
|
||||
If Not DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle)).Rows.Count < LbCantidad.Text.ToEntero Then
|
||||
BtnAgregarPS.Enabled = True
|
||||
If CerrarCompletado Then
|
||||
RegistraScript("$('#DivSerie').modal('hide');")
|
||||
@@ -1759,12 +1778,18 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Else
|
||||
BtnAgregarPS.Enabled = True
|
||||
End If
|
||||
If UsuarioActual.TienePermisoProceso(388) Then
|
||||
BtnAgregarPS.Enabled = False
|
||||
trRegistroSerie.Visible = False
|
||||
End If
|
||||
|
||||
'SI TIENE ENTRADA POR SERIE LOTE, BLOQUEAMOS CHECK Y TXTCANTIDAD
|
||||
Dim Contador As Integer = 0
|
||||
For Each Gvr As GridViewRow In GvInv.Rows
|
||||
If Gvr.DataKey("CvePS").ToEntero = CvePSSerie Then
|
||||
Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count
|
||||
'Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count
|
||||
Contador = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", Gvr.DataKey("CveCompraDetalle"))).Rows.Count
|
||||
|
||||
Gvr.FCCheckBox("cbInv").Enabled = False
|
||||
Gvr.FCTextBox("TbCantidadF").Enabled = False
|
||||
If DtDatosDetalle IsNot Nothing AndAlso Contador > 0 Then
|
||||
@@ -1776,7 +1801,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim Dr As DataRow = DtInv.Select($"Consec = {Gvr.DataKey("Consec")}")(0)
|
||||
'Dim Dr As DataRow = DtInv.Select($"Consec = {Gvr.DataKey("Consec")}")(0)
|
||||
Dim Dr As DataRow = DtInv.Select($"CveCompraDetalle = {Gvr.DataKey("CveCompraDetalle")}")(0)
|
||||
Dr("CantidadSurtidaPantalla") = Gvr.FCTextBox("TbCantidadF").Text.ToDecimal
|
||||
DtInv.AcceptChanges()
|
||||
Next
|
||||
@@ -1810,7 +1836,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltroPrimero("", "PS")
|
||||
|
||||
For Each Serie In SeriesArreglo
|
||||
DtDuplicado = DtDatosDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{Serie}'")
|
||||
'DtDuplicado = DtDatosDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{Serie}'")
|
||||
DtDuplicado = DtDatosDetalle.FiltraParametros($"CveCompraDetalle = {CveCompraDetalle} AND Serie = '{Serie}'")
|
||||
|
||||
|
||||
If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then
|
||||
MensajeAlert.Append($"<br/> El numero de Serie <b>""{Serie}""</b> proporcionado ya se encuentra ingresado.")
|
||||
TxtSerie.Text = ""
|
||||
@@ -1836,7 +1865,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim Index As Integer = 0
|
||||
Dim Cantidad As Integer = LbCantidad.Text.ToEntero
|
||||
|
||||
If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "Consec = " & CveConsecSerie).ToEntero
|
||||
'If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "Consec = " & CveConsecSerie).ToEntero
|
||||
If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "CveCompraDetalle = " & CveCompraDetalle).ToEntero
|
||||
'DtInv
|
||||
|
||||
For Each Serie In SeriesArreglo
|
||||
@@ -1847,7 +1877,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
If Index > Cantidad Then Exit For
|
||||
|
||||
'VALIDA QUE SIGA AGREGANDO
|
||||
If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < Cantidad Then
|
||||
'If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < Cantidad Then
|
||||
If Not DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle)).Rows.Count < Cantidad Then
|
||||
MensajeAlert.Append("series cargadas en su totalidad") : Exit For
|
||||
End If
|
||||
|
||||
@@ -1867,7 +1898,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End If
|
||||
End If
|
||||
|
||||
Row("ConsecId") = CveConsecSerie
|
||||
'Row("ConsecId") = CveConsecSerie
|
||||
Row("CveCompraDetalle") = CveCompraDetalle
|
||||
Row("Consec") = DtDatosDetalle.Rows.Count + 1
|
||||
Row("CvePS") = CvePSSerie
|
||||
Row("CveUM") = CveUMSerie
|
||||
@@ -1922,6 +1954,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim dtt As New DataTable
|
||||
dtt.ReadXml(ArchivoBitacoraDetalle)
|
||||
DtDatosDetalle = dtt
|
||||
If Not DtDatosDetalle.Columns.Contains("CveCompraDetalle") Then
|
||||
DtDatosDetalle.Columns.Add("CveCompraDetalle", GetType(Integer))
|
||||
DtDatosDetalle.AcceptChanges()
|
||||
End If
|
||||
Alert("Registro(s) Recuperados", TipoMensaje.ToastInformacion)
|
||||
End If
|
||||
CargaGVInv()
|
||||
@@ -1975,18 +2011,21 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
CvePSSerie = Argumentos(0).ToEntero
|
||||
CveUMSerie = Argumentos(1).ToEntero
|
||||
PUSerie = Argumentos(2).ToDecimal
|
||||
CveConsecSerie = Argumentos(5).ToEntero
|
||||
'CveConsecSerie = Argumentos(5).ToEntero
|
||||
CveCompraDetalle = Argumentos(6).ToEntero
|
||||
|
||||
CargaLote(1)
|
||||
End Sub
|
||||
Private Sub CargaLote(Tipo As Integer, Optional CerrarCompletado As Boolean = False)
|
||||
RegistraScript("$('#DivLote').modal();", "ModalLote")
|
||||
GvLote.Columns(2).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
|
||||
GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
|
||||
'GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
|
||||
GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle), "Consec DESC")
|
||||
GvLote.DataBind()
|
||||
|
||||
'VALIDA QUE SIGA AGREGANDO
|
||||
If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("ConsecId = {0}", CveConsecSerie)) < LbLoteCantidad2.Text.ToDecimal Then
|
||||
'If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("ConsecId = {0}", CveConsecSerie)) < LbLoteCantidad2.Text.ToDecimal Then
|
||||
If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("CveCompraDetalle = {0}", CveCompraDetalle)) < LbLoteCantidad2.Text.ToDecimal Then
|
||||
BtnAddPSLote.Enabled = False
|
||||
If CerrarCompletado Then
|
||||
RegistraScript("$('#DivLote').modal('hide');")
|
||||
@@ -1999,7 +2038,9 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim Contador As Decimal = 0
|
||||
For Each Gvr As GridViewRow In GvInv.Rows
|
||||
If Gvr.DataKey("CvePS").ToEntero = CvePSSerie Then
|
||||
Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("ConsecId = {0}", Gvr.DataKey("Consec")))
|
||||
'Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("ConsecId = {0}", Gvr.DataKey("Consec")))
|
||||
Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("CveCompraDetalle = {0}", Gvr.DataKey("CveCompraDetalle")))
|
||||
|
||||
Gvr.FCCheckBox("cbInv").Enabled = False
|
||||
Gvr.FCTextBox("TbCantidadF").Enabled = False
|
||||
If DtDatosLoteDetalle IsNot Nothing AndAlso Contador > 0 Then
|
||||
@@ -2049,7 +2090,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim DtSeriesNuevas As New DataTable
|
||||
DtSeriesNuevas.Columns.Add("Serie", GetType(String))
|
||||
|
||||
DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Lote = '{Lote}' ")
|
||||
'DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Lote = '{Lote}' ")
|
||||
DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"CveCompraDetalle = {CveCompraDetalle} AND Lote = '{Lote}' ")
|
||||
If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then
|
||||
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
|
||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
@@ -2078,7 +2120,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End If
|
||||
End If
|
||||
|
||||
Row("ConsecId") = CveConsecSerie
|
||||
'Row("ConsecId") = CveConsecSerie
|
||||
Row("CveCompraDetalle") = CveCompraDetalle
|
||||
Row("Consec") = DtDatosDetalle.Rows.Count + 1
|
||||
Row("Cantidad") = CantidadLote
|
||||
Row("CvePS") = CvePSSerie
|
||||
@@ -2716,8 +2759,12 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
PUExtranjero = DtInv.Rows(gvr.RowIndex)("PUExtranjero").ToString.ToDecimal
|
||||
|
||||
'SI FUE POR SERIE LOTE
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
|
||||
DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
|
||||
'DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
|
||||
'DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
|
||||
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", gvr.DataKey("CveCompraDetalle").ToEntero))
|
||||
DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", gvr.DataKey("CveCompraDetalle").ToEntero))
|
||||
|
||||
If DtDetalle.Rows.Count > 0 Then
|
||||
Dim ContDt As Integer = 0
|
||||
' por redondeo
|
||||
@@ -3655,7 +3702,9 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
ErrorMovInv = True
|
||||
End Try
|
||||
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
RenombrarBitacoras()
|
||||
End If
|
||||
|
||||
'FINAL
|
||||
If Not ErrorMovInv Then
|
||||
@@ -3759,6 +3808,26 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub RenombrarBitacoras()
|
||||
|
||||
|
||||
Dim fechaActual As String = DateTime.Now.ToString("yyyyMMddHHmmss")
|
||||
|
||||
Dim fib As New FileInfo(ArchivoBitacora)
|
||||
Dim fibd As New FileInfo(ArchivoBitacoraDetalle)
|
||||
|
||||
If fib.Exists() Then
|
||||
Dim nuevoNombre As String = Path.Combine(fib.DirectoryName, Path.GetFileNameWithoutExtension(fib.Name) & "_" & fechaActual & ".xml")
|
||||
fib.MoveTo(nuevoNombre)
|
||||
End If
|
||||
|
||||
If fibd.Exists() Then
|
||||
Dim nuevoNombreDetalle As String = Path.Combine(fibd.DirectoryName, Path.GetFileNameWithoutExtension(fibd.Name) & "_" & fechaActual & ".xml")
|
||||
fibd.MoveTo(nuevoNombreDetalle)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GenerarMovimientoAlmacenVenta(CveAlmacen As Integer, CveConceptoAlmacen As Integer, CveVenta As Integer, CveMovimientoRelacionado As Integer, DtDetalle As DataTable, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, EsContabilizable As Boolean, Modulo As String) As MMovimientoAlmacen
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim Retorno As New MMovimientoAlmacen
|
||||
@@ -4816,7 +4885,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Alert("El nombre de la segunda columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(2).ColumnName = "Producto" Then
|
||||
If Not (dt.Columns(2).ColumnName = "Producto" Or dt.Columns(2).ColumnName = "Producto/Servicio") Then
|
||||
Alert("El nombre de la tercera columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -4851,7 +4920,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim CveProducto As Integer = RowPS("CvePS").ToString().ToEntero()
|
||||
Dim CveUnidadMedida As Integer = RowPS("CveUM").ToString().ToEntero()
|
||||
CvePSSerie = CveProducto
|
||||
CveConsecSerie = DtInv.FiltroPrimeroValor("Consec", "CvePS=" & CvePSSerie).ToEntero
|
||||
'CveConsecSerie = DtInv.FiltroPrimeroValor("Consec", "CvePS=" & CvePSSerie).ToEntero
|
||||
CveCompraDetalle = DtInv.FiltroPrimeroValor("CveCompraDetalle", "CvePS=" & CvePSSerie).ToEntero
|
||||
|
||||
Dim Cantidad As Double = RowExcel("Cantidad").ToString().ToDecimal()
|
||||
Dim Serie As String = RowExcel("Serie").ToString()
|
||||
@@ -4875,7 +4945,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
|
||||
If Valido Then
|
||||
CveConsecSerie = RowPS("Consec").ToString.ToEntero
|
||||
'CveConsecSerie = RowPS("Consec").ToString.ToEntero
|
||||
CveCompraDetalle = RowPS("CveCompraDetalle").ToString.ToEntero
|
||||
AgregaSerie(RowExcel("Serie").ToString, 1, False)
|
||||
|
||||
'AgregarPS(Cantidad, CveProducto, CveUnidadMedida, Observaciones, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(Not String.IsNullOrEmpty(Serie), Serie, ""), Lote:=Lote, FechaCaducidad:=FechaCaducidad, Limpia:=False)
|
||||
@@ -4887,7 +4958,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
Else
|
||||
RowsNoCargados = RowsNoCargados + 1
|
||||
ProductosNoCargados.AppendFormat("{0},", RowExcel("Producto").ToString())
|
||||
ProductosNoCargados.AppendFormat("{0},", RowExcel("Producto/Servicio").ToString())
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@@ -4896,12 +4967,20 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Finally
|
||||
|
||||
Dim MensajeFinal As New StringBuilder()
|
||||
|
||||
If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then
|
||||
MensajeFinal.Append("Los productos se cargaron correctamente. <br/><br/>")
|
||||
End If
|
||||
|
||||
If RowsCargados > 0 Then
|
||||
MensajeFinal.Append("Se cargaron <b>" & RowsCargados & "</b> productos correctamente.")
|
||||
|
||||
TxtExcel.Text = "[]"
|
||||
UpConcepto.Update()
|
||||
RegistraScript("$('#DivCargaExcel').modal('hide');")
|
||||
|
||||
End If
|
||||
|
||||
If RowsNoCargados > 0 Then
|
||||
MensajeFinal.Append("No se pudieron cargar <b>" & RowsNoCargados & "</b> productos. <br/>Los siguientes productos no se pudieron cargar: " & ProductosNoCargados.ToString())
|
||||
End If
|
||||
@@ -4922,32 +5001,67 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Sub
|
||||
|
||||
Public Sub DescargarFormato()
|
||||
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoRecepcionAlmacen.xlsx"
|
||||
Dim dtt As New DataTable
|
||||
dtt = DtInv.Copy()
|
||||
dtt.Columns.Remove("Cantidad")
|
||||
dtt.Columns("CantidadF").ColumnName = "Cantidad"
|
||||
dtt.Columns("PS").ColumnName = "Producto"
|
||||
dtt.Columns("Codigo").ColumnName = "Código"
|
||||
Dim PathArchivo As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoRecepcionAlmacen.xlsx"
|
||||
|
||||
Dim existingcol As New List(Of String) '= {"Cantidad", "Producto", "Código"}
|
||||
If System.IO.File.Exists(PathArchivo) Then
|
||||
|
||||
For Each col As DataColumn In dtt.Columns
|
||||
If Not col.ColumnName.Contiene("Cantidad", "Producto", "Código") Then
|
||||
existingcol.Add(col.ColumnName)
|
||||
End If
|
||||
Next
|
||||
Response.Clear()
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=FormatoRecepcionAlmacen.xlsx")
|
||||
Response.TransmitFile(Directorio)
|
||||
Response.End()
|
||||
|
||||
For Each colName As String In existingcol
|
||||
dtt.Columns.Remove(colName)
|
||||
Next
|
||||
End If
|
||||
|
||||
dtt.Columns("Cantidad").SetOrdinal(0)
|
||||
dtt.Columns("Código").SetOrdinal(1)
|
||||
dtt.Columns("Producto").SetOrdinal(2)
|
||||
|
||||
dtt.Columns.Add("Serie", GetType(String))
|
||||
dtt.ExportToExcel("FormatoRecepcionAlmacen.xlsx")
|
||||
'Dim dtt As New DataTable
|
||||
'dtt = DtInv.Copy()
|
||||
|
||||
'If dtt.Columns.Contains("Cantidad") Then
|
||||
' dtt.Columns.Remove("Cantidad")
|
||||
'End If
|
||||
|
||||
'If dtt.Columns.Contains("CantidadF") Then
|
||||
' dtt.Columns("CantidadF").ColumnName = "Cantidad"
|
||||
'End If
|
||||
|
||||
'If dtt.Columns.Contains("PS") Then
|
||||
' dtt.Columns("PS").ColumnName = "Producto"
|
||||
'End If
|
||||
|
||||
'If dtt.Columns.Contains("Codigo") Then
|
||||
' dtt.Columns("Codigo").ColumnName = "Código"
|
||||
'End If
|
||||
|
||||
|
||||
'Dim existingcol As New List(Of String) '= {"Cantidad", "Producto", "Código"}
|
||||
|
||||
'For Each col As DataColumn In dtt.Columns
|
||||
' If Not col.ColumnName.Contiene("Cantidad", "Producto", "Código") Then
|
||||
' existingcol.Add(col.ColumnName)
|
||||
' End If
|
||||
'Next
|
||||
|
||||
'For Each colName As String In existingcol
|
||||
' dtt.Columns.Remove(colName)
|
||||
'Next
|
||||
|
||||
'Try
|
||||
' dtt.Columns("Cantidad").SetOrdinal(0)
|
||||
' dtt.Columns("Código").SetOrdinal(1)
|
||||
' dtt.Columns("Producto").SetOrdinal(2)
|
||||
'Catch ex As Exception
|
||||
|
||||
'End Try
|
||||
|
||||
|
||||
'If Not dtt.Columns.Contains("PS") Then
|
||||
' dtt.Columns.Add("Serie", GetType(String))
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
'dtt.ExportToExcel("FormatoRecepcionAlmacen.xlsx")
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -4957,7 +5071,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
'Create a DataTable.
|
||||
Dim dt As New DataTable()
|
||||
|
||||
dt.Columns.AddRange(New DataColumn(9) {New DataColumn("CodBarra", GetType(String)),
|
||||
dt.Columns.AddRange(New DataColumn(10) {New DataColumn("CodBarra", GetType(String)),
|
||||
New DataColumn("OVenta", GetType(String)),
|
||||
New DataColumn("Factura", GetType(String)),
|
||||
New DataColumn("FechaFac", GetType(String)),
|
||||
@@ -4966,7 +5080,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
New DataColumn("Producto", GetType(String)),
|
||||
New DataColumn("Serie", GetType(String)),'CodigoUnico
|
||||
New DataColumn("Cantidad", GetType(Integer)),
|
||||
New DataColumn("Código", GetType(String))})
|
||||
New DataColumn("Código", GetType(String)),
|
||||
New DataColumn("CveCompraDetalle", GetType(Integer))})
|
||||
FolioFactura = FolioFactura.Replace("-", "")
|
||||
|
||||
'Read the contents of CSV file.
|
||||
@@ -5049,5 +5164,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Class
|
||||
|
||||
|
||||
Protected Sub LnkAgregarExcel_Click(sender As Object, e As EventArgs)
|
||||
TxtExcel.Text = "[]"
|
||||
UpConcepto.Update()
|
||||
RegistraScript("$('#DivCargaExcel').modal('show');")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -555,7 +555,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
private void CargaTiposPeriodo()
|
||||
{
|
||||
set_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa, null);
|
||||
DdlTipoPeriodo.DataSource = get_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa);
|
||||
DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource;
|
||||
DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource;
|
||||
|
||||
@@ -318,6 +318,7 @@ Partial Class OS_OrdenesServicios
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If Not IsPostBack Then
|
||||
|
||||
'DATOS CLIENTE
|
||||
CveCliente = 0
|
||||
NombreCliente = ""
|
||||
@@ -453,7 +454,7 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
|
||||
BtnCancelar.Text = "Cancelar Cirugía"
|
||||
HplRegresar.NavigateUrl = "/OS/RepOSMedicas.aspx"
|
||||
@@ -2979,57 +2980,55 @@ Partial Class OS_OrdenesServicios
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkAccionesMaterialUtilizado_Click(sender As Object, e As EventArgs)
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
|
||||
LnkModalMaterialUtilizado.Visible = True
|
||||
DTSolicitudDev = New DataTable
|
||||
Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
|
||||
LnkModalMaterialUtilizado.Visible = True
|
||||
DTSolicitudDev = New DataTable
|
||||
Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
|
||||
|
||||
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||
Case 1, 2 ' *Fuera de liena *pago directo
|
||||
Opcion = 1
|
||||
Case 3 ' por el momento ya no se usa
|
||||
Opcion = 2
|
||||
Case 5 ' consignacion uso
|
||||
Opcion = 3
|
||||
Case 6 ' a vista uso de material
|
||||
Opcion = 4
|
||||
Case Else
|
||||
Opcion = 1
|
||||
End Select
|
||||
|
||||
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||
Case 1, 2 ' *Fuera de liena *pago directo
|
||||
Opcion = 1
|
||||
Case 3 ' por el momento ya no se usa
|
||||
Opcion = 2
|
||||
Case 5 ' consignacion uso
|
||||
Opcion = 3
|
||||
Case 6 ' a vista uso de material
|
||||
Opcion = 4
|
||||
Case Else
|
||||
Opcion = 1
|
||||
End Select
|
||||
Dim ObjOS As New ClsOS
|
||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, If(UsuarioActual.Empresa.Funcionalidad(578) = "1", CvePedido, CveVenta), Opcion, UsuarioActual.CveEmpresa) Then
|
||||
DTSolicitudDev = ObjOS.DtResultados
|
||||
GvMU.DataSource = DTSolicitudDev
|
||||
GvMU.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
|
||||
GvMU.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
|
||||
GvMU.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
GvMU.DataBind()
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, If(UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1, CvePedido, CveVenta), Opcion, UsuarioActual.CveEmpresa) Then
|
||||
DTSolicitudDev = ObjOS.DtResultados
|
||||
GvMU.DataSource = DTSolicitudDev
|
||||
GvMU.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
|
||||
GvMU.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
|
||||
GvMU.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
GvMU.DataBind()
|
||||
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
|
||||
|
||||
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal();")
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal();")
|
||||
If EsDevolucionVenta Then
|
||||
Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
|
||||
LnkModalMaterialUtilizado.Visible = False
|
||||
End If
|
||||
|
||||
If EsDevolucionVenta Then
|
||||
Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
|
||||
LnkModalMaterialUtilizado.Visible = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
TxtPacienteModal.Text = TxtPaciente.Text
|
||||
TxtEpisodioModal.Text = TxtIdentificadorCliente.Text
|
||||
TxtFolioRemisionModal.Text = TxtFolioAdicional.Text
|
||||
End If
|
||||
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
DvTxtFolioRemisionModal.Visible = False
|
||||
Else
|
||||
DvTxtFolioRemisionModal.Visible = True
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
DvTxtFolioRemisionModal.Visible = False
|
||||
Else
|
||||
DvTxtFolioRemisionModal.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
UpModalMaterialUtilizado.Update()
|
||||
|
||||
End Sub
|
||||
@@ -3047,7 +3046,10 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
Dim ProcesoOK As Boolean = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
Dim CveAlmacenDestino As Integer = -1
|
||||
Dim CveSubProyectoPedido As Integer
|
||||
'---------------- INICIO VALIDACIONES -----------------
|
||||
If TxtPacienteModal.Text.Trim.Length = 0 Then
|
||||
Alert("Debe de proporcionar el paciente.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -3057,350 +3059,349 @@ Partial Class OS_OrdenesServicios
|
||||
Alert("Debe de proporcionar el episodio.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim TieneArchivos As Boolean = False
|
||||
Dim Filesgral As List(Of Archivo) = AnexoManerialUtilizado.getfiles().Archivos
|
||||
For Each fileItem As Archivo In Filesgral
|
||||
TieneArchivos = True
|
||||
Exit For
|
||||
Next
|
||||
If Not TieneArchivos Then
|
||||
Alert("Debe de agregar un documento de confirmación (5 máximo).")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim TieneArchivos As Boolean = False
|
||||
Dim Filesgral As List(Of Archivo) = AnexoManerialUtilizado.getfiles().Archivos
|
||||
For Each fileItem As Archivo In Filesgral
|
||||
TieneArchivos = True
|
||||
Exit For
|
||||
Next
|
||||
If Not TieneArchivos Then
|
||||
Alert("Debe de agregar un documento de confirmación (5 máximo).")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
|
||||
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
|
||||
Dim CveSubProyectoPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveSubProyecto").ToEntero
|
||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
Dim CveAlmacenDestino As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
||||
Dim CveVentaRemisionGenerada As Integer = -1
|
||||
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim TotalSeleccionado As Decimal = 0
|
||||
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
TotalSeleccionado = TotalSeleccionado + GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Next
|
||||
If TotalSeleccionado = 0 Then
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
|
||||
If Not CveAlmacenDestino > 0 Then
|
||||
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim ObjV As New ClsVentas
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||
Dim GenerarRemisionMovimientos As Boolean = False
|
||||
|
||||
If DdlTipoVenta.SelectedValue = "5" Then 'Consignación - Uso Material
|
||||
'genera una salida de almacen.
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtilConsig")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
Dim CantidadRegistro As Decimal = GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = GVRow.DataKey("CvePS").ToEntero
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
Dim Serie As String = GVRow.DataKey("Serie")
|
||||
Dim Lote As String = GVRow.DataKey("Lote")
|
||||
Dim CveUM As Integer = GVRow.DataKey("CveUM").ToEntero
|
||||
Dim FechaCaducidad As DateTime = GVRow.DataKey("FechaCaducidad").ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadRegistro, CveUM, CvePS, 0, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
|
||||
If CveOSEstatusFinalizada > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Else
|
||||
Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado Consigna"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil5", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim ImporteAlmacen As Decimal = 0
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 95, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If DdlTipoVenta.SelectedValue = "5" Then
|
||||
If TotalSeleccionado = 0 Then
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
CveSubProyectoPedido = DTSolicitudDev.FiltroPrimeroValor("CveSubProyecto").ToEntero
|
||||
CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
||||
If Not CveAlmacenDestino > 0 Then
|
||||
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If TotalSeleccionado > 0 AndAlso Not TxtFolioRemisionModal.Text.Trim.Length > 0 Then
|
||||
Alert("El campo Folio es requerido por favor ingréselo.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"})
|
||||
DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal))
|
||||
DT_Ventas_Detalles.AcceptChanges()
|
||||
'---------------- FIN VALIDACIONES -----------------
|
||||
|
||||
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
|
||||
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
|
||||
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
|
||||
|
||||
For Each gvRow As GridViewRow In GvMU.Rows
|
||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
Dim CveVentaRemisionGenerada As Integer = -1
|
||||
|
||||
Dim CantidadUsada As Decimal = gvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim ObjV As New ClsVentas
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||
Dim GenerarRemisionMovimientos As Boolean = False
|
||||
|
||||
If dRow("CvePS").ToString.ToDecimal = gvRow.DataKey("CvePS").ToDecimal AndAlso CantidadUsada > 0 Then
|
||||
If DdlTipoVenta.SelectedValue = "5" Then 'Consignación - Uso Material
|
||||
'genera una salida de almacen.
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtilConsig")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
dRow("CantidadUsada") = dRow("CantidadUsada").ToString.ToDecimal + CantidadUsada
|
||||
If CveMovimientoSalida > 0 Then
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
Dim CantidadRegistro As Decimal = GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = GVRow.DataKey("CvePS").ToEntero
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Next
|
||||
|
||||
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
|
||||
Dim CantidadUsada As Decimal = dRow("CantidadUsada").ToString.ToDecimal
|
||||
If dRow("CantidadUsada").ToString.ToDecimal < dRow("CantidadPedido").ToString.ToDecimal Then
|
||||
If Not ObjInventario.UpdatePedidoDetalleCantidad(dRow("CveVentaDetalle").ToString.ToEntero, CantidadUsada, 2) Then
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Else
|
||||
If ProcesoOK Then
|
||||
Dim AplicaDevolucion As Boolean = False
|
||||
For Each GvRow As GridViewRow In GvMU.Rows
|
||||
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
|
||||
Dim CantidadDev As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
|
||||
If CantidadRegistro > 0 Then
|
||||
Dim Serie As String = GVRow.DataKey("Serie")
|
||||
Dim Lote As String = GVRow.DataKey("Lote")
|
||||
Dim CveUM As Integer = GVRow.DataKey("CveUM").ToEntero
|
||||
Dim FechaCaducidad As DateTime = GVRow.DataKey("FechaCaducidad").ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadRegistro, CveUM, CvePS, 0, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
|
||||
If CveOSEstatusFinalizada > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Else
|
||||
Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
|
||||
ProcesoOK = False
|
||||
GenerarRemisionMovimientos = False
|
||||
AplicaDevolucion = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
Next
|
||||
If AplicaDevolucion Then
|
||||
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVentaPedido) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'ProcesoOK = False
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
Dim CveMovimientoSalida, CveMovimientoEntrada As Integer
|
||||
Dim ImporteAlmacen As Decimal
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If Not TxtFolioRemisionModal.Text.Trim.Length > 0 Then
|
||||
Alert("El campo Folio es requerido por favor ingréselo.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
GenerarRemisionMovimientos = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
|
||||
CveVentaRemisionGenerada = Respuesta.CveVenta
|
||||
If ObjV.GetVentaDetalle(Respuesta.CveVenta) Then
|
||||
Dim dtClon As DataTable = ObjV.DtResultados.Copy
|
||||
dtClon.DefaultView.Sort = "CveVentaDetalle ASC"
|
||||
Dim dtmat As DataTable = dtClon.DefaultView.ToTable()
|
||||
'una vez registrada, asocia los lotes/cad con el cveventadetalle para que se surta así
|
||||
DtVentaDetalle = Respuesta.dtdetalle
|
||||
For i = 0 To dtmat.Rows.Count - 1
|
||||
If DtVentaDetalle.Rows(i)("CvePS").ToString = dtmat.Rows(i)("CvePS").ToString Then
|
||||
DtVentaDetalle.Rows(i)("CveVentaDetalle") = dtmat.Rows(i)("CveVentaDetalle")
|
||||
DtVentaDetalle.Rows(i)("CveUM") = dtmat.Rows(i)("CveUM")
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado Consigna"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil5", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim ImporteAlmacen As Decimal = 0
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
Next
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 95, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
'asigno la cveventa, como concluido
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"})
|
||||
DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal))
|
||||
DT_Ventas_Detalles.AcceptChanges()
|
||||
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtil3")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
|
||||
For Each gvRow As GridViewRow In GvMU.Rows
|
||||
Dim CantidadUsada As Decimal = gvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
If dRow("CvePS").ToString.ToDecimal = gvRow.DataKey("CvePS").ToDecimal AndAlso CantidadUsada > 0 Then
|
||||
dRow("CantidadUsada") = dRow("CantidadUsada").ToString.ToDecimal + CantidadUsada
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
|
||||
Dim CantidadUsada As Decimal = dRow("CantidadUsada").ToString.ToDecimal
|
||||
If dRow("CantidadUsada").ToString.ToDecimal < dRow("CantidadPedido").ToString.ToDecimal Then
|
||||
If Not ObjInventario.UpdatePedidoDetalleCantidad(dRow("CveVentaDetalle").ToString.ToEntero, CantidadUsada, 2) Then
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
'' otros opciones <> 5
|
||||
If ProcesoOK Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each drr As DataRow In DtVentaDetalle.Rows
|
||||
Dim AplicaDevolucion As Boolean = False
|
||||
Dim StrCveVentasDetalle As New StringBuilder
|
||||
For Each GvRow As GridViewRow In GvMU.Rows
|
||||
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
|
||||
Dim CantidadDev As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
StrCveVentasDetalle.AppendFormat("{0},", CveVentaDetalle)
|
||||
|
||||
Dim Cantidad As Decimal = drr("Cantidad").ToString.ToDecimal
|
||||
'Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = drr("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = drr("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = drr("PU").ToString.ToDecimal
|
||||
|
||||
If Cantidad > 0 Then
|
||||
Dim CveVentaDetalle As Integer = drr("CveVentaDetalle").ToString.ToEntero 'DtVentaDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePadre = {GvRow.DataKey("CveVentaDetalle")}").ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = -1 'GvRow.DataKey("CveMovimientoDetalle").ToEntero
|
||||
|
||||
If CveVentaDetalle <= 0 Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim Serie As String = drr("Serie").ToString
|
||||
Dim Lote As String = drr("Lote").ToString
|
||||
Dim FechaCaducidad As DateTime = drr("FechaCaducidad").ToString.ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
|
||||
ProcesoOK = False
|
||||
GenerarRemisionMovimientos = False
|
||||
AplicaDevolucion = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
IndexMov1 = IndexMov1 + 1
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
Next
|
||||
If AplicaDevolucion Then
|
||||
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVentaPedido) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
' obtiene las ventasdetalle del pedido/rem, para recorrerlas y si hay alguna solo solicitada pero no surtida, que no siga pendiente de surtir.
|
||||
If ProcesoOK AndAlso ObjV.GetVentaDetalle(CveVentaPedido) Then
|
||||
Dim DtVentasDetalle As DataTable = ObjV.DtResultados
|
||||
Dim dtt As DataTable = DtVentasDetalle.FiltraParametros($"CveVentaDetalle NOT IN ({StrCveVentasDetalle.ToString} -1)")
|
||||
For Each dr As DataRow In dtt.Rows
|
||||
ObjInventario.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) 'para no surtirse
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
Dim CveMovimientoSalida, CveMovimientoEntrada As Integer
|
||||
Dim ImporteAlmacen As Decimal
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
|
||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="OS/MatUtil2")
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
Dim IndexMov2 As Integer = 0
|
||||
For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
|
||||
Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
Dim CveVentaDetalle As Integer = dRow("CveVentaDetalle").ToString.ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
CveVentaRemisionGenerada = Respuesta.CveVenta
|
||||
If ObjV.GetVentaDetalle(Respuesta.CveVenta) Then
|
||||
Dim dtClon As DataTable = ObjV.DtResultados.Copy
|
||||
dtClon.DefaultView.Sort = "CveVentaDetalle ASC"
|
||||
Dim dtmat As DataTable = dtClon.DefaultView.ToTable()
|
||||
'una vez registrada, asocia los lotes/cad con el cveventadetalle para que se surta así
|
||||
DtVentaDetalle = Respuesta.dtdetalle
|
||||
For i = 0 To dtmat.Rows.Count - 1
|
||||
If DtVentaDetalle.Rows(i)("CvePS").ToString = dtmat.Rows(i)("CvePS").ToString Then
|
||||
DtVentaDetalle.Rows(i)("CveVentaDetalle") = dtmat.Rows(i)("CveVentaDetalle")
|
||||
DtVentaDetalle.Rows(i)("CveUM") = dtmat.Rows(i)("CveUM")
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim Lote As String = dRow("Lote").ToString
|
||||
Dim Serie As String = dRow("Serie").ToString
|
||||
Dim FechaCaducidad As DateTime = dRow("FechaCaducidad").ToString.ToDateTime
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtil3")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each drr As DataRow In DtVentaDetalle.Rows
|
||||
|
||||
Dim Cantidad As Decimal = drr("Cantidad").ToString.ToDecimal
|
||||
'Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = drr("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = drr("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = drr("PU").ToString.ToDecimal
|
||||
|
||||
If Cantidad > 0 Then
|
||||
Dim CveVentaDetalle As Integer = drr("CveVentaDetalle").ToString.ToEntero 'DtVentaDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePadre = {GvRow.DataKey("CveVentaDetalle")}").ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = -1 'GvRow.DataKey("CveMovimientoDetalle").ToEntero
|
||||
|
||||
If CveVentaDetalle <= 0 Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
IndexMov2 = IndexMov2 + 1
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
|
||||
Dim LigaVenta As String = String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoEntrada, Folio, "Material utilizado")
|
||||
Dim Serie As String = drr("Serie").ToString
|
||||
Dim Lote As String = drr("Lote").ToString
|
||||
Dim FechaCaducidad As DateTime = drr("FechaCaducidad").ToString.ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
IndexMov1 = IndexMov1 + 1
|
||||
Next
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
If ProcesoOK Then
|
||||
|
||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="OS/MatUtil2")
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
Dim IndexMov2 As Integer = 0
|
||||
For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
Dim CveVentaDetalle As Integer = dRow("CveVentaDetalle").ToString.ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
|
||||
Dim Lote As String = dRow("Lote").ToString
|
||||
Dim Serie As String = dRow("Serie").ToString
|
||||
Dim FechaCaducidad As DateTime = dRow("FechaCaducidad").ToString.ToDateTime
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
IndexMov2 = IndexMov2 + 1
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
|
||||
Dim LigaVenta As String = String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoEntrada, Folio, "Material utilizado")
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(Respuesta.CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(Respuesta.CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Observaciones:=TxtObservacionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Observaciones:=TxtObservacionModal.Text.Trim) Then
|
||||
If Not ObjOS.UpdateVentaOS(-1, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(-1, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
If ProcesoOK Then
|
||||
ProcesoOK = GuardarArchivoConfirmacion(ObjV.IniciaTransacSQL, CveOS, CveVentaRemisionGenerada)
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
ProcesoOK = GuardarArchivoConfirmacion(ObjV.IniciaTransacSQL, CveOS, CveVentaRemisionGenerada)
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
|
||||
If ProcesoOK Then
|
||||
|
||||
ObjV.Commit()
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||
Else
|
||||
If GenerarRemisionMovimientos = False Then
|
||||
Alert("El material sera recibido en almacén.")
|
||||
ObjV.Commit()
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||
Else
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
If GenerarRemisionMovimientos = False Then
|
||||
Alert("El material sera recibido en almacén.")
|
||||
Else
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
End If
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||
CargaEventoBitacora()
|
||||
Else
|
||||
ObjV.RollBack()
|
||||
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||
CargaEventoBitacora()
|
||||
Else
|
||||
ObjV.RollBack()
|
||||
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
|
||||
ObjV.Dispose()
|
||||
End If
|
||||
|
||||
ObjV.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -3535,6 +3536,7 @@ Partial Class OS_OrdenesServicios
|
||||
ObjFactura.Paciente = TxtPacienteModal.Text.Trim
|
||||
ObjFactura.Episodio = TxtEpisodioModal.Text.Trim
|
||||
ObjFactura.Alfa1 = TxtFolioRemisionModal.Text.Trim
|
||||
ObjFactura.CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=10).FiltroPrimeroValor("CveAlmacen").ToEntero
|
||||
ObjFactura.CveVendedor = tCveVendedor
|
||||
|
||||
Dim TmpDTMat As New DataTable
|
||||
@@ -3578,7 +3580,7 @@ Partial Class OS_OrdenesServicios
|
||||
If ProcesoOK Then
|
||||
ObjFactura.CalculaTotales()
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL)
|
||||
Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL, Modulo:="OS/Remision")
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.CveVenta = Resp.CveVenta
|
||||
@@ -3607,13 +3609,10 @@ Partial Class OS_OrdenesServicios
|
||||
End Class
|
||||
Protected Sub LnkActualizarUsaurioAtendio_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
|
||||
If DdlUsuarioAtendio.SelectedValue.ToEntero > 0 Then
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
ObjOS.IniciaTransacSQL()
|
||||
|
||||
Dim ProcesoOk As Boolean = True
|
||||
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
@@ -3635,13 +3634,10 @@ Partial Class OS_OrdenesServicios
|
||||
Alert($"Se presento un error al actualizar el técnico.")
|
||||
CargaHistorial()
|
||||
End If
|
||||
|
||||
Else
|
||||
Alert("Debe de seleccionar un ténico para actualziar", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
|
||||
@@ -3690,7 +3686,6 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Dim CveEstatusOrdenServicioCancelacion As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", " TipoEstatus = 5 ").ToEntero
|
||||
Dim CveAlmacenDevolucion As Integer
|
||||
Dim CveMotivoCancelacion As Integer = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMotivoCancelacion", "CveSATMotivoCancelacion IN (3)").ToEntero
|
||||
@@ -3708,9 +3703,7 @@ Partial Class OS_OrdenesServicios
|
||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CvePedido, UsuarioActual.CveEmpresa, EsCancelacion:=True, VerificaAlmacen:=True)
|
||||
|
||||
Try
|
||||
|
||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
|
||||
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
|
||||
|
||||
Dim SWatch As New Stopwatch
|
||||
@@ -3726,16 +3719,11 @@ Partial Class OS_OrdenesServicios
|
||||
Alert($"Se presento un error al cancelar la orden de servicio, {resp.Mensaje}".ToString(), TipoMensaje.MsgError)
|
||||
Else
|
||||
Alert($"la orden de servicio se cancelada correctamente, {resp.Mensaje}", resp.TipoMensaje, " location.reload(true); ")
|
||||
|
||||
Dim objGeneral As New ClsGenerales
|
||||
objGeneral.AddHistorialBitacora(256, -1, -1, -1, CveOS, -1, -1, -1, "Cancelada", DdlEstatusOS.SelectedItem.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "")
|
||||
objGeneral.Dispose()
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al cancelar la orden de servicio")
|
||||
End Try
|
||||
|
||||
@@ -468,9 +468,10 @@
|
||||
<div class="col-md-12" >
|
||||
<asp:GridView ID="GvPS" CssClass="table table-striped table-hover Widthall mysmallbtn" GridLines="None" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS" OnRowDataBound="GvPS_RowDataBound" >
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" ItemStyle-Width="60px" DataFormatString="{0:#,###.##}" />
|
||||
<asp:BoundField HeaderText="Solicitado" DataField="CantidadSolicitada" ItemStyle-Width="60px" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="Entregado" DataField="Cantidad" ItemStyle-Width="60px" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" />
|
||||
<asp:BoundField HeaderText="Utilizado" DataField="CantidadRemision" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Utilizado" DataField="CantidadRemision" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Center" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
@@ -609,18 +609,24 @@ Partial Class OS_RepServiciosMedicos
|
||||
Dim tCve As Integer = ObjOS.CveVenta 'busca la remisión
|
||||
If tCve <= 0 Then tCve = ObjOS.CveCotizacion 'sino hay remisión toma el pedido
|
||||
If tCve > 0 Then
|
||||
'Dim objv As New ClsVentas
|
||||
Dim dttps As New DataTable
|
||||
|
||||
If ObjOS.GetDetalleMateriales(-1, CveOsConsultar) Then
|
||||
dttps = ObjOS.DtResultados
|
||||
End If
|
||||
'If objv.GetVentaDetalle(tCve) Then
|
||||
' dttps = objv.DtResultados
|
||||
'End If
|
||||
'objv.Dispose()
|
||||
|
||||
GvPS.DataSource = dttps
|
||||
GvPS.DataBind()
|
||||
|
||||
'sino hay información, cargamos los productos a surtir
|
||||
'If dttps IsNot Nothing AndAlso dttps.Rows.Count > 0 AndAlso ObjOS.CveCotizacion > 0 Then
|
||||
' Dim objv As New ClsVentas
|
||||
' If objv.GetVentaDetalle(tCve) Then
|
||||
' dttps = objv.DtResultados
|
||||
' End If
|
||||
' objv.Dispose()
|
||||
'End If
|
||||
|
||||
End If
|
||||
Dim TipoEstatus As Integer = 0
|
||||
TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", ObjOS.CveEstatusOrdenServicio), "CveEstatusOrdenServicio ASC").ToEntero
|
||||
|
||||
@@ -520,7 +520,8 @@ public partial class RH_CalculoSBC : ClsPaginas
|
||||
SDI = Salariodiario * factordeintegracion;
|
||||
SalarioCotizacion = Salariovariable + SDI;
|
||||
if (objpersonal.UpdateSalarios(CvePersonal, txtfechacargamasiva.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
Salariodiario.ToString().ToDouble(), SDI.ToString().ToDouble(), SalarioCotizacion.ToString().ToDouble(), Salariodiario.ToString().ToDouble()))
|
||||
Salariodiario.ToString().ToDouble(), SDI.ToString().ToDouble(), SalarioCotizacion.ToString().ToDouble(), Salariodiario.ToString().ToDouble(),
|
||||
false,true,"C"))
|
||||
{
|
||||
|
||||
{
|
||||
@@ -753,7 +754,9 @@ public partial class RH_CalculoSBC : ClsPaginas
|
||||
double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble();
|
||||
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
|
||||
if (continuar && (item.FCCheckBox("chkUpdate").Checked) &&//SalarioDiarioSSNuevo != SalarioDiarioSS &&
|
||||
(continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario)))
|
||||
(continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario,
|
||||
false,true,"D"
|
||||
)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -41,14 +41,26 @@ Partial Class RH_CatTurno
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarTurno.Click
|
||||
|
||||
Dim ComidaDe As String = If(TxtComidade.Text.Trim = "", "00:00:00", TxtComidade.Text.Trim)
|
||||
Dim ComidaA As String = If(TxtComidaA.Text.Trim = "", "00:00:00", TxtComidaA.Text.Trim)
|
||||
|
||||
|
||||
Dim horaInicios As String = If(TxtHorarioDe.Text.Trim = "", "00:00:00", TxtHorarioDe.Text.Trim)
|
||||
Dim horaSalidaS As String = If(TxtHorarioA.Text.Trim = "", "00:00:00", TxtHorarioA.Text.Trim)
|
||||
|
||||
Dim horaInicio As TimeSpan = TimeSpan.Parse(horaInicios)
|
||||
Dim horaSalida As TimeSpan = TimeSpan.Parse(horaSalidaS)
|
||||
|
||||
If Not validaHorasTurno(horaInicio, horaSalida) Then
|
||||
Exit Sub
|
||||
End If
|
||||
Exit Sub
|
||||
|
||||
Using ObjRH As New ClsRH
|
||||
Dim Estatus As Boolean = False
|
||||
Dim comida As Integer = If(chkComida.Checked, 1, 0)
|
||||
|
||||
Dim ComidaDe As String = If(TxtComidade.Text.Trim = "", "00:00:00", TxtComidade.Text.Trim)
|
||||
Dim ComidaA As String = If(TxtComidaA.Text.Trim = "", "00:00:00", TxtComidaA.Text.Trim)
|
||||
|
||||
|
||||
If ChkEstatus.Checked Then Estatus = True
|
||||
If HdnModalidad.Value = "A" Then
|
||||
If ObjRH.AddTurno(TxtTurno.Text, TxtHorarioDe.Text, TxtHorarioA.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlChecadorHorario.SelectedValue.ToEntero(),
|
||||
@@ -72,6 +84,25 @@ Partial Class RH_CatTurno
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function validaHorasTurno(horaInicio As TimeSpan, horaSalida As TimeSpan) As Boolean
|
||||
|
||||
If horaInicio > horaSalida Then
|
||||
horaSalida = horaSalida.Add(TimeSpan.FromDays(1))
|
||||
End If
|
||||
|
||||
|
||||
Dim diferencia As TimeSpan = horaSalida - horaInicio
|
||||
|
||||
If diferencia.TotalHours > 13 Then
|
||||
Alert("Las horas de entrada y salida no son validas. El rango de horas supera las 13 horas.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
@@ -7050,7 +7050,9 @@ Partial Class RH_Personal
|
||||
TxtSalarioDiarioIntegrado.Text = TxtFISalarioDiarioIntegrado.Text
|
||||
Using ObjPersonal As ClsRH = New ClsRH()
|
||||
ObjPersonal.IniciaTransacSQL()
|
||||
If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioImSS.Text.ToDecimal(), TxtSalarioDiarioM.Text.ToDecimal()) Then
|
||||
If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioImSS.Text.ToDecimal(),
|
||||
TxtSalarioDiarioM.Text.ToDecimal(), False, False, "A") Then
|
||||
|
||||
|
||||
ObjPersonal.Commit()
|
||||
@@ -7085,7 +7087,7 @@ Partial Class RH_Personal
|
||||
Using ObjPersonal As ClsRH = New ClsRH()
|
||||
ObjPersonal.IniciaTransacSQL()
|
||||
If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodIMSSSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
TxtSalarioDiario.Text.ToDecimal(), TxtMImssSDI.Text.ToDecimal(), TxtMImssSalarioDiarioImSS.Text.ToDecimal(), -1) Then
|
||||
TxtSalarioDiario.Text.ToDecimal(), TxtMImssSDI.Text.ToDecimal(), TxtMImssSalarioDiarioImSS.Text.ToDecimal(), -1, False, True, "B") Then
|
||||
|
||||
|
||||
ObjPersonal.Commit()
|
||||
|
||||
@@ -1,19 +1,323 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="TripsChecks.aspx.cs" Inherits="VYA_TripsChecks" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
.trip-button {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
text-align: center;
|
||||
margin: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.trip-button img {
|
||||
width: 150px;
|
||||
height: auto;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.trip-button img:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.trip-button p {
|
||||
font-family: Arial, sans-serif;
|
||||
margin-top: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.odometer-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.odometer-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
background-color: #e0e0e0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-ok {
|
||||
background-color: green;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-detected {
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-next {
|
||||
background-color: blue;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
.gridview-style {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.gridview-style td {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.requerido{color:darkred}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12">
|
||||
|
||||
<asp:Panel ID="PnlPaso1" runat="server">
|
||||
|
||||
<div class="portlet light xspadding bordered" id="idnecesaria1">
|
||||
<div class="portlet-title ">
|
||||
<div class="tools">
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
Paso 1: Seleccione el Tipo de Unidad
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-4">
|
||||
<!-- Botón para Trip Autobus -->
|
||||
<asp:ImageButton ID="imgBtnAutobus" runat="server" ImageUrl="~/imagenes/autobus.png" OnClick="ImgBtnAutobus_Click" CssClass="trip-button" />
|
||||
<p>TRIP AUTOBUS</p>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<!-- Botón para Trip Sprinter -->
|
||||
<asp:ImageButton ID="imgBtnSprinter" runat="server" ImageUrl="~/imagenes/sprinter.png" OnClick="ImgBtnSprinter_Click" CssClass="trip-button" />
|
||||
<p>TRIP SPRINTER</p>
|
||||
</div>
|
||||
<div class="col-sm-4"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Panel>
|
||||
<asp:Panel ID="PnlPaso2" runat="server">
|
||||
|
||||
<div class="portlet light xspadding bordered" id="idnecesaria">
|
||||
<div class="portlet-title ">
|
||||
<div class="tools">
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
Paso 2: CHECK PT
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>Tipo de Unidad</label>
|
||||
<asp:DropDownList ID="DdlTipoUnidad" data-text="Todos" AppendDataBoundItems="true" AutoPostBack="true"
|
||||
DataTextField="TipoActivoFijo" DataValueField="CveTipoActivoFijo" OnSelectedIndexChanged="DdlTipoUnidad_SelectedIndexChanged"
|
||||
CssClass="form-control ddlFiltros input-sm select2me Widthall" ClientIDMode="Static"
|
||||
Style="width: 100%;" runat="server">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>Unidad</label>
|
||||
<asp:DropDownList ID="DdlAF" DataValueField="CveActivoFijo" DataTextField="CodDesc" Class="form-control select2me" Width="100%" runat="server">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="odometro">Folio</label>
|
||||
<asp:TextBox ID="TxtFolio" runat="server" CssClass="form-control text-right" Text="0" Style="width: 100%;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>Fecha</label>
|
||||
|
||||
<div style="width: 115px">
|
||||
<div class="input-group input-sm input-small date date-picker "
|
||||
data-date-format="dd/mm/yyyy"
|
||||
style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control"
|
||||
MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendario" class="btn default" Text="<i class='fa fa-calendar'></i>"
|
||||
runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI"
|
||||
Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI"
|
||||
PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>Chofer</label>
|
||||
<asp:DropDownList ID="DdlChofer" data-text="Todos" AppendDataBoundItems="true"
|
||||
DataTextField="NombreCompleto" DataValueField="CvePersonal" CssClass="form-control ddlFiltros input-sm select2me Widthall" ClientIDMode="Static"
|
||||
Style="width: 100%;" runat="server">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="odometro">ODÓMETRO</label>
|
||||
<div class="odometer-container">
|
||||
<button type="button" class="odometer-btn" onclick="updateOdometer(-1)">-</button>
|
||||
<asp:TextBox ID="txtOdometer" runat="server" CssClass="form-control text-center" Text="0" Style="width: 80px;" />
|
||||
<button type="button" class="odometer-btn" onclick="updateOdometer(1)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right">
|
||||
|
||||
<asp:Button ID="btnContinuar" runat="server" CssClass="btn btn-primary" Text="Continuar" OnClientClick="setPaso(3); return false;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Panel>
|
||||
<asp:Panel ID="PnlPaso3" runat="server">
|
||||
|
||||
<div class="portlet light xspadding bordered" id="idnecesaria3">
|
||||
<div class="portlet-title ">
|
||||
<div class="tools">
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
Paso 3:
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="expand" data-original-title="" title=""></a>
|
||||
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display:none;">
|
||||
<div>
|
||||
<h4>
|
||||
<asp:Label ID="lblFormulario" runat="server" Font-Bold="True" />
|
||||
</h4>
|
||||
<asp:GridView ID="gvPreguntas" runat="server" GridLines="none" AutoGenerateColumns="False" ShowHeader="false" DataKeyNames="CvePregunta,Valor"
|
||||
CssClass="gridview-style" OnRowDataBound="gvPreguntas_RowDataBound" >
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<h4>
|
||||
<asp:Label ID="lblPregunta" runat="server" Text='<%# Eval("Pregunta") %>'></asp:Label>*<br />
|
||||
</h4>
|
||||
|
||||
<asp:Button ID="btnOk" runat="server" Text="OK" OnClick="btnOk_Click" />
|
||||
<asp:Button ID="btnDetected" runat="server" Text="Detectado" OnClick="btnDetected_Click" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<div class="form-group">
|
||||
<h4>
|
||||
<asp:Label ID="lblFormularioobserv" runat="server"></asp:Label><br />
|
||||
</h4>
|
||||
<asp:TextBox ID="TxtObservaciones" runat="server" TextMode="multiline" CssClass="Widthall" Columns="50" Rows="5"></asp:TextBox>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
|
||||
<asp:Button ID="btnAnt" runat="server" CssClass="btn btn-default" Text="Anterior" OnClick="btnAnt_Click" />
|
||||
<asp:Button ID="BtnCancel" runat="server" CssClass="btn btn-default" Text="Cancelar" OnClick="BtnCancel_Click" />
|
||||
<asp:Button ID="btnNext" runat="server" CssClass="btn btn-default" Text="Siguiente" OnClick="btnNext_Click" />
|
||||
<asp:Button ID="btnGuardar" runat="server" CssClass="btn btn-primary" Text="Guardar" OnClick="btnGuardar_Click" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script>
|
||||
function setPaso(id){
|
||||
if (id == 3) {
|
||||
|
||||
}
|
||||
}
|
||||
function updateOdometer(change) {
|
||||
// Get the odometer input field
|
||||
var odometerInput = document.getElementById('<%= txtOdometer.ClientID %>');
|
||||
|
||||
// Convert the current value to a number and update it by the change amount
|
||||
var currentValue = parseInt(odometerInput.value, 10);
|
||||
if (isNaN(currentValue)) {
|
||||
currentValue = 0;
|
||||
}
|
||||
|
||||
// Update the value
|
||||
odometerInput.value = currentValue + change;
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -1,13 +1,274 @@
|
||||
using System;
|
||||
using CrystalDecisions.Shared.Json;
|
||||
using System;
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
|
||||
public partial class VYA_TripsChecks : System.Web.UI.Page
|
||||
public partial class VYA_TripsChecks : ClsPaginas
|
||||
{
|
||||
|
||||
#region "Propiedades"
|
||||
|
||||
private int Paso
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["Paso"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
PnlPaso1.Visible = (value == 1);
|
||||
PnlPaso2.Visible = (value == 2 || value == 3);
|
||||
PnlPaso3.Visible = (value == 3 || value == 2);
|
||||
ViewState["Paso"] = value;
|
||||
}
|
||||
}
|
||||
private int _currentFormIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["_currentFormIndex"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["_currentFormIndex"] = value;
|
||||
}
|
||||
}
|
||||
private DataTable _dtPreguntas
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["_dtPreguntas"] != null)
|
||||
return (DataTable)ViewState["_dtPreguntas"];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["_dtPreguntas"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Paso = (Request["Paso"] != null && Request["Paso"].ToString().ToEntero() > 0) ? Request["Paso"].ToString().ToEntero() : 1;
|
||||
_currentFormIndex = (Request["FormIndex"] != null && Request["FormIndex"].ToString().ToEntero() > 0) ? Request["FormIndex"].ToString().ToEntero() : 1;
|
||||
CargaCombos();
|
||||
LoadData();
|
||||
BindForm();
|
||||
}
|
||||
}
|
||||
|
||||
public void CargaCombos()
|
||||
{
|
||||
|
||||
DataTable dttipoaf = get_GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("MedidaVehicularClave IN (2,3)");
|
||||
DdlTipoUnidad.DataSource = dttipoaf;
|
||||
DdlTipoUnidad.Items.Insert(0, new ListItem("Todos", "-1"));
|
||||
DdlTipoUnidad.DataBind();
|
||||
|
||||
//CvePuesto =702 valor fijo V&A
|
||||
DataTable dtchofer = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("CvePuesto = 702 and CveEstatusPersonal = 1", "NombreCompleto");
|
||||
DdlChofer.DataSource = dtchofer;
|
||||
DdlChofer.DataBind();
|
||||
DdlChofer.Items.Insert(0, new ListItem("-", "-1"));
|
||||
}
|
||||
public void cargaUnidades()
|
||||
{
|
||||
DataTable dt = get_GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format(" EstadoActivoFijo= 'Activo' ", DdlTipoUnidad.SelectedValue));
|
||||
DdlAF.DataSource = dt;
|
||||
DdlAF.DataBind();
|
||||
DdlAF.Items.Insert(0, new ListItem("-", "-1"));
|
||||
|
||||
}
|
||||
#region "Paso 1"
|
||||
protected void ImgBtnAutobus_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
DdlTipoUnidad.SelectedValue = "181";
|
||||
Paso = 2;
|
||||
cargaUnidades();
|
||||
}
|
||||
|
||||
protected void ImgBtnSprinter_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
DdlTipoUnidad.SelectedValue = "184";
|
||||
Paso = 2;
|
||||
cargaUnidades();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void DdlTipoUnidad_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
cargaUnidades();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region "Formulario"
|
||||
private void LoadData()
|
||||
{
|
||||
_dtPreguntas = new DataTable();
|
||||
using(ClsTransportes nom =new ClsTransportes())
|
||||
{
|
||||
if(nom.VIA_FormularioTrip(-1,UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa))
|
||||
{
|
||||
_dtPreguntas =nom.DtResultados;
|
||||
}
|
||||
}
|
||||
//// Para la demostración, aquí va un código para llenar el DataTable con datos ficticios.
|
||||
//_dtPreguntas.Columns.Add("CveFormulario", typeof(int));
|
||||
//_dtPreguntas.Columns.Add("Formulario", typeof(string));
|
||||
//_dtPreguntas.Columns.Add("CvePregunta", typeof(int));
|
||||
//_dtPreguntas.Columns.Add("Pregunta", typeof(string));
|
||||
//_dtPreguntas.Columns.Add("Valor", typeof(int));
|
||||
//_dtPreguntas.Columns.Add("OrdenPregunta", typeof(int));
|
||||
//_dtPreguntas.Columns.Add("OrdenFormulario", typeof(int));
|
||||
|
||||
//// Agregar datos de prueba
|
||||
//_dtPreguntas.Rows.Add(1, "Formulario 1", 1, "Pregunta 1", null, 1, 1);
|
||||
//_dtPreguntas.Rows.Add(1, "Formulario 1", 2, "Pregunta 2", null, 2, 1);
|
||||
//_dtPreguntas.Rows.Add(2, "Formulario 2", 3, "Pregunta 3", null, 1, 2);
|
||||
//_dtPreguntas.Rows.Add(2, "Formulario 2", 4, "Pregunta 4", null, 2, 2);
|
||||
//_dtPreguntas.Rows.Add(2, "Formulario 2", 5, "Pregunta 5", null, 1, 3);
|
||||
//_dtPreguntas.Rows.Add(2, "Formulario 2", 6, "Pregunta 6", null, 2, 3);
|
||||
}
|
||||
|
||||
private void BindForm()
|
||||
{
|
||||
var filteredRowsant = _dtPreguntas.FiltraParametros($"OrdenFormulario = {_currentFormIndex - 1}");
|
||||
var filteredRowsnext = _dtPreguntas.FiltraParametros($"OrdenFormulario = {_currentFormIndex + 1}");
|
||||
btnAnt.Visible = filteredRowsant.Rows.Count > 0;
|
||||
btnNext.Visible = filteredRowsnext.Rows.Count > 0;
|
||||
btnGuardar.Visible = !(filteredRowsnext.Rows.Count > 0);
|
||||
var filteredRows = _dtPreguntas.Select($"OrdenFormulario = {_currentFormIndex}");
|
||||
var sortedRows = filteredRows.CopyToDataTable();
|
||||
if(sortedRows.Rows.Count > 0)
|
||||
{
|
||||
lblFormulario.Text = $"{sortedRows.Rows[0]["Formulario"]}:";
|
||||
lblFormularioobserv.Text = $"Observaciones {sortedRows.Rows[0]["Formulario"]}";
|
||||
|
||||
}
|
||||
gvPreguntas.DataSource = sortedRows;
|
||||
gvPreguntas.DataBind();
|
||||
UpDatos.Update();
|
||||
}
|
||||
protected void gvPreguntas_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
string valor = e.Row.DataKey("Valor");
|
||||
|
||||
// Botón btnOk
|
||||
Button btnOk = (Button)e.Row.FindControl("btnOk");
|
||||
if (btnOk != null)
|
||||
{
|
||||
btnOk.CssClass = valor == "1" ? "btn btn-primary" : "btn btn-default";
|
||||
}
|
||||
|
||||
// Botón btnDetected
|
||||
Button btnDetected = (Button)e.Row.FindControl("btnDetected");
|
||||
if (btnDetected != null)
|
||||
{
|
||||
btnDetected.CssClass = valor == "0" ? "btn btn-primary" : "btn btn-default";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateValue(int cvePregunta, int newValue)
|
||||
{
|
||||
foreach (DataRow row in _dtPreguntas.Rows)
|
||||
{
|
||||
if (Convert.ToInt32(row["CvePregunta"]) == cvePregunta)
|
||||
{
|
||||
row["Valor"] = newValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button btnOk = (Button)sender;
|
||||
GridViewRow row = (GridViewRow)btnOk.NamingContainer;
|
||||
int cvePregunta = row.DataKey("CvePregunta").ToEntero();
|
||||
|
||||
UpdateValue(cvePregunta, 1);
|
||||
BindForm();
|
||||
}
|
||||
|
||||
protected void btnDetected_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button btnDetected = (Button)sender;
|
||||
GridViewRow row = (GridViewRow)btnDetected.NamingContainer;
|
||||
int cvePregunta = row.DataKey("CvePregunta").ToEntero();
|
||||
|
||||
UpdateValue(cvePregunta, 0);
|
||||
BindForm();
|
||||
}
|
||||
public bool ValidarGridView()
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
foreach (GridViewRow row in gvPreguntas.Rows)
|
||||
{
|
||||
// Obtener el valor del DataKey correspondiente a la fila actual
|
||||
string valor = row.DataKey("Valor");
|
||||
|
||||
// Verificar si el valor es diferente de '0' o '1'
|
||||
if (valor != "0" && valor != "1")
|
||||
{
|
||||
ok = false;
|
||||
|
||||
// Marcar lblPregunta como requerido si el valor es diferente
|
||||
Label lblPregunta = (Label)row.FindControl("lblPregunta");
|
||||
if (lblPregunta != null)
|
||||
{
|
||||
lblPregunta.CssClass = "requerido"; // Añade tu clase CSS para marcar como requerido
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
protected void btnNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ValidarGridView())
|
||||
{
|
||||
// Incrementar el índice del formulario
|
||||
_currentFormIndex++;
|
||||
BindForm();
|
||||
}
|
||||
}
|
||||
protected void btnAnt_Click(object sender, EventArgs e)
|
||||
{
|
||||
_currentFormIndex--;
|
||||
BindForm();
|
||||
}
|
||||
|
||||
protected void BtnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Paso = 1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
protected void btnGuardar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void btnContinuar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -2580,11 +2580,11 @@ Partial Class Clientes
|
||||
|
||||
|
||||
If Not ErrorProceso Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(404) = "30" AndAlso UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso DdlAlmacenAsignado.SelectedValue.ToEntero = -1 Then 'limpiar ddl alamcen temporal que se agrego temporalmente
|
||||
If Not GeneraGuardaAlmacenAsignado(TxtNombre.Text.Trim, ObjClientes.IniciaTransacSQL) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(404) = "30" AndAlso UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso DdlAlmacenAsignado.SelectedValue.ToEntero = -1 Then 'limpiar ddl alamcen temporal que se agrego temporalmente
|
||||
' If Not GeneraGuardaAlmacenAsignado(TxtNombre.Text.Trim, ObjClientes.IniciaTransacSQL) Then
|
||||
' ErrorProceso = True
|
||||
' End If
|
||||
'End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
@@ -2846,7 +2846,7 @@ Partial Class Clientes
|
||||
End Sub
|
||||
Private Sub GeneraGlobalDT()
|
||||
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
|
||||
|
||||
GlobalDTClientesTodosSucursales(UsuarioActual.CveEmpresa) = Nothing
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -499,8 +499,8 @@
|
||||
<div class="col-md-4">
|
||||
<asp:TextBox ID="TxtClaveAutorizacion" CssClass="form-control input-sm " runat="server" MaxLength="50" Width="100px" ClientIDMode="Static"></asp:TextBox>
|
||||
</div>
|
||||
<label class="col-md-2">¿Quién autorizó?:</label>
|
||||
<div class="col-md-4">
|
||||
<label class="col-md-3">¿Quién autorizó?:</label>
|
||||
<div class="col-md-3">
|
||||
<asp:TextBox ID="TxtAutorizo" CssClass="form-control input-sm " runat="server" MaxLength="50" Width="125px" ClientIDMode="Static"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -723,6 +723,42 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="DivListaPrecios" runat="server" visible="false">
|
||||
<div class="portlet xspadding light bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-briefcase font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Lista de Precios </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvMultiple" Width="100%" runat="server" GridLines="None" ClientIDMode="Static" AutoGenerateColumns="false" DataKeyNames="CvePrecioLista,PrecioLista,Precio"
|
||||
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" EmptyDataText="No se encontraron registros" OnRowDataBound="GvMultiple_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="PrecioLista" HeaderText="Lista de Precio" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
<asp:Label ID="LtlLista" runat="server">Precio</asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtPrecio" runat="server" MaxLength="39" onkeypress="return onlyNumberKey(event)" Style="text-align: right !important;"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
@@ -2672,7 +2708,19 @@
|
||||
}
|
||||
//TERMINA: ECOMMERCE
|
||||
|
||||
|
||||
function onlyNumberKey(evt) {
|
||||
|
||||
// Only ASCII character in that range allowed
|
||||
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
|
||||
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) {
|
||||
if (ASCIICode == 46) {
|
||||
return true
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -141,6 +141,15 @@ Partial Class ProductosyServicios
|
||||
ViewState("Imagen") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtPreciosMultiple As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtPreciosMultiple")), Nothing, CType(ViewState("DtPreciosMultiple"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtPreciosMultiple") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Private ReadOnly Property PermiteClasificacion2 As Boolean
|
||||
@@ -273,6 +282,9 @@ Partial Class ProductosyServicios
|
||||
'CargaFamilia(ViewState("CveSubFamilia").ToString.ToEntero)
|
||||
CargaSucursaless()
|
||||
CargaImpuestosLocales()
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
CargaListaPrecios()
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(122) Then
|
||||
BtnEliminar.Visible = False
|
||||
@@ -1714,6 +1726,10 @@ Partial Class ProductosyServicios
|
||||
Next
|
||||
End If
|
||||
|
||||
If Not TieneError AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
GuardarListasPrecios(ObjProductosServicios)
|
||||
End If
|
||||
|
||||
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
|
||||
TieneError = GuardaEcommerce()
|
||||
End If
|
||||
@@ -2967,6 +2983,58 @@ Partial Class ProductosyServicios
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "LISTA PRECIOS"
|
||||
|
||||
Private Sub CargaListaPrecios()
|
||||
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, -1, CveClasificacion:=-1, CvePS:=CvePS,
|
||||
CveProveedor:=-1, Estado:=-1, Marcas:="-1", CveModelo:=-1) Then
|
||||
DtPreciosMultiple = objPS.DtResultados.Copy()
|
||||
GvMultiple.DataSource = DtPreciosMultiple
|
||||
End If
|
||||
objPS.Dispose()
|
||||
DivListaPrecios.Visible = True
|
||||
GvMultiple.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(2).ToString().ToDecimal()
|
||||
|
||||
e.Row.FCTextBox("TxtPrecio").Text = Valor.FormatoNumero(2)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GuardarListasPrecios(ObjPS As ClsProductosServicios)
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Try
|
||||
For Each GvRow As GridViewRow In GvMultiple.Rows
|
||||
Dim CvePrecioLista As Integer = GvRow.DataKey("CvePrecioLista").ToEntero()
|
||||
Dim Precio As Decimal = GvRow.FCTextBox("TxtPrecio").Text.ToDecimal()
|
||||
|
||||
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
|
||||
|
||||
If TieneError Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar precios", ex)
|
||||
TieneError = True
|
||||
End Try
|
||||
|
||||
If TieneError Then
|
||||
Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "EXISTENCIAS"
|
||||
|
||||
Protected Sub GVExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkVerGrafica" OnClick="LnkVerGrafica_Click" runat="server">Ver Grafica</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkModalPorcentajes" OnClick="LnkModalPorcentajes_Click" runat="server" Visible="false"><i class="fa fa-list" aria-hidden="true"></i> Consultar porcentajes</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<li>
|
||||
@@ -275,6 +278,106 @@
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="DivModalPorcetajes" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UpModalPorcentajes" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content" style="width:700px!important">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Label ID="LblModalTituloPorcentajes" runat="server" ClientIDMode="Static" Text="">Consulta Porcentajes</asp:Label>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group form-md-line-input input-iconright date date-picker date date-picker" style="min-width: 135px; margin-top: -10px !important;">
|
||||
<label for="<%= TxtModalFechaInicio.ClientID.ToString()%>" style="color: #888888;">Fecha Inicio: </label>
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="TxtModalFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkTxtModalFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="METxtModalFechaInicio" runat="server" TargetControlID="TxtModalFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CETxtModalFechaInicio" TargetControlID="TxtModalFechaInicio" PopupButtonID="LnkTxtModalFechaInicio" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="RfvTxtModalFechaInicio" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalFechaInicio" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group form-md-line-input input-iconright date date-picker date date-picker" style="min-width: 135px; margin-top: -10px !important;">
|
||||
<label for="<%= TxtModalFechaFin.ClientID.ToString()%>" style="color: #888888;">Fecha Fin: </label>
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="TxtModalFechaFin" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkTxtModalFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="METxtModalFechaFin" runat="server" TargetControlID="TxtModalFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CETxtModalFechaFin" TargetControlID="TxtModalFechaFin" PopupButtonID="LnkTxtModalFechaFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="RfvLnkTxtModalFechaFin" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalFechaFin" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtModalPorcentaje" runat="server" CausesValidation="true" CssClass="form-control" MaxLength="13" Text="5" Enabled="true"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RfvTxtModalPorcentaje" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalPorcentaje" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Porcentaje''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
|
||||
<ajax:FilteredTextBoxExtender ID="FIETTxtModalPorcentaje" TargetControlID="TxtModalPorcentaje" FilterType="Numbers,Custom" ValidChars="-" runat="server" />
|
||||
<label for="<%= TxtModalPorcentaje.ClientID.ToString()%>">Porcentaje Menor a:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<asp:Button runat="server" ID="BtnModalConsultaPorcentaje" CssClass="btn btn-primary" Text="Consultar" CausesValidation="true" ValidationGroup="GrpModalPorcentaje" OnClick="BtnModalConsultaPorcentaje_Click" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="height:10px!important"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvPorcentajes" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas Utilidad con los filtros especificados"
|
||||
CssClass="table table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None" OnRowDataBound="GvPorcentajes_RowDataBound" >
|
||||
<Columns>
|
||||
|
||||
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderText="SubProyecto" DataField="SubProyecto" ItemStyle-Width="200px" />
|
||||
|
||||
<asp:HyperLinkField ItemStyle-HorizontalAlign="Center" HeaderText="Serie Folio" DataTextField="SerieFolio" DataTextFormatString="{0}" Target="_blank"
|
||||
DataNavigateUrlFields="CveVenta"
|
||||
DataNavigateUrlFormatString="Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField ItemStyle-HorizontalAlign="Center" HeaderText="Fecha" DataField="FechaVenta" DataFormatString="{0:d}" ItemStyle-Width="100px" />
|
||||
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N}" ItemStyle-Width="100px" />
|
||||
|
||||
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Costo" DataField="Costo" DataFormatString="{0:N}" ItemStyle-Width="100px" />
|
||||
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Neto" DataField="PorNeto" DataFormatString="{0:N}" ItemStyle-Width="100px" />
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UPModalProd" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
@@ -288,18 +391,20 @@
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
|
||||
<label class="col-md-1 truncate">Ver:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlVer" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlVer_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Neto" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Rentabilidad" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Ver:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlVer" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlVer_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Neto" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Rentabilidad" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
|
||||
<br />
|
||||
<div id="chartdiv"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
@@ -307,6 +412,10 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
|
||||
@@ -32,19 +32,37 @@ Partial Class Ventas_RepVentasUtilidadPadre
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
'If UsuarioActual.Empresa.Funcionalidad(382) <> "1" Then
|
||||
' GvDatos.Columns(3).Visible = False
|
||||
' GvDatos.Columns(5).Visible = False
|
||||
'End If
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
LnkModalPorcentajes.Visible = True
|
||||
End If
|
||||
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Property SubProyectoConf As String
|
||||
Get
|
||||
If ViewState("SubProyectoConf") Is Nothing Then
|
||||
ViewState("SubProyectoConf") = ""
|
||||
End If
|
||||
Return ViewState("SubProyectoConf").ToString
|
||||
End Get
|
||||
|
||||
Set(value As String)
|
||||
ViewState("SubProyectoConf") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " INICIALIZA VALORES "
|
||||
Private Sub CargaCombos()
|
||||
|
||||
TxtModalFechaInicio.Text = NowADS().FirstDayOfMonth.ToShortDateString
|
||||
TxtModalFechaFin.Text = NowADS().LastDayOfMonth.ToShortDateString
|
||||
|
||||
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
|
||||
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
|
||||
|
||||
@@ -108,6 +126,12 @@ Partial Class Ventas_RepVentasUtilidadPadre
|
||||
|
||||
LblNeto.Text = "0"
|
||||
LblPorNeto.Text = "0"
|
||||
|
||||
|
||||
Dim LblSubProyectoConf As New Label
|
||||
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoConf)
|
||||
SubProyectoConf = LblSubProyectoConf.Text
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
@@ -315,4 +339,42 @@ Partial Class Ventas_RepVentasUtilidadPadre
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub LnkModalPorcentajes_Click(sender As Object, e As EventArgs)
|
||||
|
||||
GvPorcentajes.DataSource = Nothing
|
||||
GvPorcentajes.DataBind()
|
||||
UpModalPorcentajes.Update()
|
||||
RegistraScript("$('#DivModalPorcetajes').modal(`show`);")
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnModalConsultaPorcentaje_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
Dim FechaI As Date = TxtModalFechaInicio.Text.ToDate
|
||||
Dim FechaF As Date = TxtModalFechaFin.Text.ToDate
|
||||
If TxtModalFechaInicio.Text = "" Then FechaI = MinFecha
|
||||
If TxtModalFechaFin.Text = "" Then FechaF = MaxFecha
|
||||
|
||||
If ObjVentas.GetReporteVentasUtilidad("-1", -1, "-1", FechaI, FechaF, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1) Then
|
||||
GvPorcentajes.DataSource = ObjVentas.DtResultados.FiltraParametros($" CveVenta > 0 AND PorNeto <= {TxtModalPorcentaje.Text.ToDecimal} AND TipoDocto = 'Ing' AND CveEstatusFactura IN(2,3) ")
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
GvPorcentajes.DataBind()
|
||||
|
||||
ObjVentas.Dispose()
|
||||
UpModalPorcentajes.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvPorcentajes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.Header Then
|
||||
e.Row.Cells(0).Text = SubProyectoConf
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -602,13 +602,13 @@
|
||||
|
||||
<tr runat="server" id="TrVentasMedicas2" visible="false">
|
||||
<td runat="server" id="TdRequiereTecnico1" visible="true">
|
||||
<b>Requiere Técnico:</b>
|
||||
<b>Req. Técnico:</b>
|
||||
</td>
|
||||
<td runat="server" id="TdRequiereTecnico2" visible="true">
|
||||
<asp:CheckBox ID="ChkRequiereTecnico" runat="server" CssClass="chksino" OnCheckedChanged="ChkRequiereTecnico_CheckedChanged" AutoPostBack="true" Text="Requiere Técnico:" Checked="false" />
|
||||
</td>
|
||||
<td runat="server" id="TdFechaOS1" visible="true">
|
||||
<b>Fecha de Cirugía:</b>
|
||||
<b>Fecha de Cx:</b>
|
||||
</td>
|
||||
<td runat="server" id="TdFechaOS2" visible="true">
|
||||
<asp:TextBox ID="TxtFechaOS" type="datetime-local" runat="server" CausesValidation="true" CssClass="fechahora" Style="width: 130px; line-height: 22px;"></asp:TextBox>
|
||||
@@ -8840,11 +8840,11 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
|
||||
<asp:DropDownList ID="DdlSolCreditoTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
|
||||
<asp:ListItem Value="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
|
||||
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
|
||||
<label for="<%= DdlSolCreditoTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
|
||||
</div>
|
||||
<div id="DivAutorizacion" runat="server" class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlTipoAutorizacion" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
|
||||
|
||||
@@ -14194,7 +14194,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso EsVentaMedica Then
|
||||
Dim CveClientesucursatTemp As Integer = DdlClienteSucursalSucursal()
|
||||
If CveClientesucursatTemp > 0 Then
|
||||
@@ -14227,20 +14226,19 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If RBLTipoVenta.SelectedValue = "2" Then
|
||||
If Not ChkRequiereTecnico.Checked Then
|
||||
If DdlTipoComprobante.SelectedValue = "Rem" Then 'Not ChkRequiereTecnico.Checked, antes
|
||||
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
|
||||
ElseIf DdlTipoComprobante.SelectedValue = "Ped" Then
|
||||
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 4 AND Almacen like '%Pago%' AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
If CveAlmacenTraspasoDestino <= 0 Then
|
||||
ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado.")
|
||||
End If
|
||||
|
||||
Else
|
||||
If CveAlmacenTraspasoDestino <= 0 Then
|
||||
ErrorList.Add("Ocurrió un error al seleccionar el almacen de resguardo del cliente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim TotalImpuestoLocal As Double = 0
|
||||
@@ -14297,13 +14295,11 @@ Partial Class Ventas
|
||||
RFCReceptor = factura.ClienteSucursal.RFC
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim DescripcionVenta As String = ""
|
||||
If TxtDescripcionVenta.Text <> "" Then DescripcionVenta = TxtDescripcionVenta.Text
|
||||
|
||||
|
||||
Dim CveMedico As Integer = -1
|
||||
Dim CveProcedimiento As Integer = -1
|
||||
Dim CveTipoVentaGuardar As Integer = -1
|
||||
@@ -14701,8 +14697,11 @@ Partial Class Ventas
|
||||
ErrorList.Add("Ocurrió un error al actualizar el estatus del pedido2")
|
||||
End If
|
||||
End If
|
||||
Dim GenerarOS As Boolean = ChkRequiereTecnico.Checked
|
||||
'si es pago directo, genera siempre OS
|
||||
If RBLTipoVenta.SelectedValue = "2" Then GenerarOS = True
|
||||
|
||||
If EsVentaMedica AndAlso ErrorList.Count = 0 AndAlso ChkRequiereTecnico.Checked Then
|
||||
If EsVentaMedica AndAlso ErrorList.Count = 0 AndAlso GenerarOS Then
|
||||
|
||||
GeneraOS(ObjVentas.IniciaTransacSQL, ErrorList, CveVentaOS:=factura.CveVenta, SerieFolioOS:=factura.SerieFolio)
|
||||
|
||||
@@ -37022,7 +37021,7 @@ Partial Class Ventas
|
||||
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click
|
||||
Dim DiasVencidos As Integer = 0
|
||||
Dim CveEstatus As Integer = 0
|
||||
Dim TipoDocto As String = DdlTipoDocto.SelectedValue
|
||||
Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue
|
||||
Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero()
|
||||
If CveTipoAutorizacion <= 0 Then
|
||||
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
|
||||
@@ -37036,7 +37035,7 @@ Partial Class Ventas
|
||||
Dim Motivo As String = TxtMotivoAutorizacion.Text
|
||||
|
||||
Dim ObjPS As New ClsVentas
|
||||
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then
|
||||
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlSolCreditoTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then
|
||||
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
|
||||
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
|
||||
'signal
|
||||
@@ -37053,8 +37052,8 @@ Partial Class Ventas
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
|
||||
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
|
||||
Protected Sub DdlSolCreditoTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSolCreditoTipoDocto.SelectedIndexChanged
|
||||
Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue.ToString()
|
||||
Select Case TipoDocto
|
||||
Case "Ing"
|
||||
If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then
|
||||
@@ -38565,10 +38564,7 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub ChkRequiereTecnico_CheckedChanged(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
TdFechaOS1.Visible = ChkRequiereTecnico.Checked
|
||||
|
||||
|
||||
UpCliente.Update()
|
||||
End Sub
|
||||
|
||||
@@ -38732,14 +38728,12 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlClienteSucursalCliente() > 0 Then
|
||||
CveClienteOS = DdlClienteSucursalCliente()
|
||||
Else
|
||||
Alert("Debe de seleccionar un hospital.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Else
|
||||
If DdlClienteSucursalCliente() > 0 Then
|
||||
ViewState("CveCliente") = DdlClienteSucursalCliente()
|
||||
@@ -38778,8 +38772,8 @@ Partial Class Ventas
|
||||
|
||||
ChkRequiereTecnico.Checked = ChkRequiereTecnicoModal.Checked
|
||||
TxtFechaOS.Text = TxtFechaModal.Text
|
||||
TdFechaOS1.Visible = ChkRequiereTecnicoModal.Checked
|
||||
TdFechaOS2.Visible = ChkRequiereTecnicoModal.Checked
|
||||
'TdFechaOS1.Visible = ChkRequiereTecnicoModal.Checked
|
||||
'TdFechaOS2.Visible = ChkRequiereTecnicoModal.Checked
|
||||
DdlMedico.SelectedValueExist(DdlMedicoModal.SelectedValue)
|
||||
DdlProcedimiento.SelectedValueExist(DdlProcedimientoModal.SelectedValue)
|
||||
|
||||
@@ -38797,18 +38791,18 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión")
|
||||
End If
|
||||
ElseIf RBLTipoVenta.SelectedValue.Contiene("3") Then ' A vista
|
||||
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Pedido", "Ped"))
|
||||
DdlTipoComprobante.SelectedValueExist("Ped")
|
||||
TrVentasMedicas1.Visible = False
|
||||
TrVentasMedicas2.Visible = False
|
||||
ChkRequiereTecnico.Enabled = True
|
||||
ElseIf RBLTipoVenta.SelectedValue.Contiene("4") Then ' consignacion
|
||||
DdlTipoComprobante.SelectedValueExist("Ing")
|
||||
TrVentasMedicas1.Visible = False
|
||||
TrVentasMedicas2.Visible = False
|
||||
ChkRequiereTecnico.Enabled = True
|
||||
Else
|
||||
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Pedido", "Ped"))
|
||||
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Pedido", "Ped"))
|
||||
DdlTipoComprobante.SelectedValueExist("Ped")
|
||||
TrVentasMedicas1.Visible = False
|
||||
TrVentasMedicas2.Visible = False
|
||||
ChkRequiereTecnico.Enabled = True
|
||||
ElseIf RBLTipoVenta.SelectedValue.Contiene("4") Then ' consignacion
|
||||
DdlTipoComprobante.SelectedValueExist("Ing")
|
||||
TrVentasMedicas1.Visible = False
|
||||
TrVentasMedicas2.Visible = False
|
||||
ChkRequiereTecnico.Enabled = True
|
||||
Else
|
||||
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Pedido", "Ped"))
|
||||
DdlTipoComprobante.SelectedValueExist("Ped")
|
||||
TrVentasMedicas1.Visible = True
|
||||
TrVentasMedicas2.Visible = True
|
||||
@@ -38895,7 +38889,7 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub ChkRequiereTecnicoModal_CheckedChanged(sender As Object, e As EventArgs)
|
||||
|
||||
DvModalRequiereOSFecha.Visible = ChkRequiereTecnicoModal.Checked
|
||||
'DvModalRequiereOSFecha.Visible = ChkRequiereTecnicoModal.Checked
|
||||
UpDvModalTipoVenta.Update()
|
||||
|
||||
End Sub
|
||||
@@ -38921,7 +38915,6 @@ Partial Class Ventas
|
||||
For Each GvRow As GridViewRow In GvProductosProcedimiento.Rows
|
||||
If RBLTipoVenta.SelectedValue = "2" Then
|
||||
|
||||
|
||||
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero
|
||||
Dim Abreviatura As String = GvRow.DataKey("Abreviatura").ToString
|
||||
@@ -38937,13 +38930,11 @@ Partial Class Ventas
|
||||
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
|
||||
|
||||
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
|
||||
|
||||
If ObjPrecioSugerido.CvePrecioLista > 0 AndAlso DivPrecioLista.Visible Then
|
||||
DdlPrecioLista.SelectedValueExist(ObjPrecioSugerido.CvePrecioLista)
|
||||
End If
|
||||
|
||||
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
|
||||
|
||||
GvRow.FCTextBox("TxtPrecio").Text = PrecioSugerido.ToString("#,###.####")
|
||||
|
||||
End If
|
||||
@@ -38955,21 +38946,20 @@ Partial Class Ventas
|
||||
Private Function GeneraOS(ByRef TransacSQL As SqlClient.SqlTransaction, ByRef errorList As List(Of String), CveVentaOS As Integer, SerieFolioOS As String) As Boolean
|
||||
|
||||
Dim Errores As Boolean = False
|
||||
|
||||
Dim ObjOrdenServicio As New ClsOS(TransacSQL)
|
||||
|
||||
Dim CveOSTipo As Integer = -1
|
||||
|
||||
If ObjOrdenServicio.GetTipoOrdenesServicios(UsuarioActual.CveEmpresa) Then
|
||||
CveOSTipo = ObjOrdenServicio.DtResultados.FiltroPrimeroValor("CveOrdenServicioTipo", " Estatus = 'Activo' ").ToEntero
|
||||
End If
|
||||
Dim CveVentaAdicional As Integer = -1
|
||||
If RBLTipoVenta.SelectedValue.Contiene("5", "6") Then
|
||||
Dim CveOSTipo As Integer = GlobalDTTipoOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveOrdenServicioTipo", " Estatus = 'Activo' ").ToEntero
|
||||
Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero
|
||||
|
||||
'If RBLTipoVenta.SelectedValue.Contiene("5", "6") Then
|
||||
' CveVentaAdicional = CveVentaOS
|
||||
'End If
|
||||
|
||||
If RBLTipoVenta.SelectedValue.Contiene("2") AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then 'pago directo, sino require técnico, que pase de estatus
|
||||
EstatusOrdenServicio = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero 'tipo: 4.finalizada.3.en proceso
|
||||
CveVentaAdicional = CveVentaOS
|
||||
End If
|
||||
|
||||
Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero
|
||||
|
||||
Dim ObjOrdenServicio As New ClsOS(TransacSQL)
|
||||
If ObjOrdenServicio.AddOrdenesServicios(CveClienteOS, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.Nombre, TxtFechaOS.Text.Replace(",", "").ToDateTime, $"Venta: {LblSerie.Text}-{TxtFolio.Text}", UsuarioActual.CveUsuario, EstatusOrdenServicio,
|
||||
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVentaOS, CveVentaAdicional, -1, CveOSTipo, CveClienteSucursal:=CveClienteSucursalOS,
|
||||
Direccion:="", Telefono:="", CveModeloAuto:=-1, Año:="", CveMedico:=DdlMedico.SelectedValue.ToEntero,
|
||||
|
||||
Reference in New Issue
Block a user