This commit is contained in:
HECTOR RODRIGUEZ
2021-06-08 14:14:59 -07:00
13 changed files with 5772 additions and 5560 deletions

View File

@@ -293,19 +293,28 @@ Public Class ClsPaginas
Application("Directorio") = value Application("Directorio") = value
End Set End Set
End Property End Property
Property GlobalDTPSATPS() As DataTable Public Shared ReadOnly Property GlobalDTPSATPS(SATClaveProductoServicio As String) As DataTable
Get Get
If Application("GlobalDTPSATPS") Is Nothing Then 'If Application("GlobalDTPSATPS") Is Nothing Then
Dim ObjGrales As New ClsGenerales ' Dim ObjGrales As New ClsGenerales
If ObjGrales.GetSATProductosServicios Then Application("GlobalDTPSATPS") = ObjGrales.DtResultados.AsEnumerable() Else Application("GlobalDTPSATPS") = Nothing ' If ObjGrales.GetSATProductosServicios Then Application("GlobalDTPSATPS") = ObjGrales.DtResultados.AsEnumerable() Else Application("GlobalDTPSATPS") = Nothing
ObjGrales.Dispose() ' ObjGrales.Dispose()
'End If
'GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
Dim ObjGrales As New ClsGenerales
If ObjGrales.GetSATProductosServicios(SATClaveProductoServicio) Then
GlobalDTPSATPS = ObjGrales.DtResultados
Else
GlobalDTPSATPS = Nothing
End If End If
ObjGrales.Dispose()
GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
End Get End Get
Set(value As DataTable) 'Set(value As DataTable)
Application("GlobalDTPSATPS") = value ' Application("GlobalDTPSATPS") = value
End Set 'End Set
End Property End Property
#Region "GLOBALES DE SAT COMERCIO EXTERIOR" #Region "GLOBALES DE SAT COMERCIO EXTERIOR"

View File

@@ -701,7 +701,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
'verifica existencias 'verifica existencias
If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163) Then If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163) Then
UsaGlobal = False UsaGlobal = False
Dim objInv As New ClsInventarios Dim objInv As New ClsInventarios
If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca) Then If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca) Then
@@ -933,20 +933,25 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Private Function GETPSSAT(ByVal context As HttpContext) As String Private Function GETPSSAT(ByVal context As HttpContext) As String
Dim retorno As String = "" Dim retorno As String = ""
Dim DTPS = DirectCast(context.Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)) 'Dim DTPS = DirectCast(context.Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow))
Dim DtPSRetorno As DataTable Dim DtPSRetorno As DataTable
Dim Name = IfNull(context.Request("Name"), "-1").ToString Dim Name = IfNull(context.Request("Name"), "-1").ToString
If Name <> "-1" Then 'If Name <> "-1" Then
DTPS = DTPS.Where((Function(a) a!SATClaveProductoServicio.ToString.ToLower Like ($"*{Name.ToLower}*"))) ' DTPS = DTPS.Where((Function(a) a!SATClaveProductoServicio.ToString.ToLower Like ($"*{Name.ToLower}*")))
End If 'End If
DtPSRetorno = New DataView(DTPS.OrderBy(Function(a) a!SATClavePS).CopyToDataTable).ToTable(True, {"CveSATPS", "SATClaveProductoServicio"})
'DtPSRetorno = New DataView(DTPS.OrderBy(Function(a) a!SATClavePS).CopyToDataTable).ToTable(True, {"CveSATPS", "SATClaveProductoServicio"})
DtPSRetorno = ClsPaginas.GlobalDTPSATPS(Name.ToLower)
If DtPSRetorno IsNot Nothing AndAlso DtPSRetorno.Rows.Count > 0 Then If DtPSRetorno IsNot Nothing AndAlso DtPSRetorno.Rows.Count > 0 Then
DtPSRetorno.Columns("CveSATPS").ColumnName = "id" DtPSRetorno.Columns("CveSATPS").ColumnName = "id"
DtPSRetorno.Columns("SATClaveProductoServicio").ColumnName = "text" DtPSRetorno.Columns("SATClaveProductoServicio").ColumnName = "text"
'limpia las columnas
For Each dc As DataColumn In DtPSRetorno.Clone.Columns
If Not dc.ColumnName.Contiene("id", "text") Then DtPSRetorno.Columns.Remove(dc.ColumnName)
Next
retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString
context.Response.Write(retorno) context.Response.Write(retorno)
Else Else

View File

@@ -6011,6 +6011,16 @@ Partial Class Bancos_IE
Dim Str As New StringBuilder Dim Str As New StringBuilder
Dim Banco As New ClsBancos Dim Banco As New ClsBancos
If Banco.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, 2, UsuarioActual.CveEmpresa, -1) Then
If Not Banco.DtResultados.Rows.Count > 0 Then
Banco.Dispose()
Alert("No se generaron complementos de pago porque no hay facturas con método de pago PPD", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
Banco.IniciaTransacSQL() Banco.IniciaTransacSQL()

View File

@@ -1139,17 +1139,12 @@
<asp:UpdatePanel runat="server" ID="UpConsignaciones" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpConsignaciones" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="" id="DivConsignaciones" runat="server">
<div class="portlet solid grey-cascade portlet-filter" style="display:none" id="DivConsignaciones" runat="server">
<div class="portlet-title portlet-filterT" style=""> <div class="portlet-title portlet-filterT" style="">
<div class="titlefiltros caption "> <div class="titlefiltros caption ">
<ul class="list-inline" style="font-size: 14px;"> <ul class="list-inline" style="font-size: 14px;">
<li>Aplica consignación: <li>Aplica consignación:
<asp:CheckBox Text="" ID="ChkConsignacion" OnCheckedChanged="ChkConsignacion_CheckedChanged" AutoPostBack="true" Enabled="false" runat="server" /> <asp:CheckBox Text="" ID="ChkConsignacion" OnCheckedChanged="ChkConsignacion_CheckedChanged" AutoPostBack="true" Enabled="false" runat="server" />
</li> </li>
@@ -1160,27 +1155,16 @@
<asp:ListItem Value="2" Text="Recepción a Almacén"></asp:ListItem> <asp:ListItem Value="2" Text="Recepción a Almacén"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</li> </li>
<li runat="server" id="LiConsignacion" visible="false">Consignación: <li runat="server" id="LiConsignacion" visible="false">Consignación:
<asp:DropDownList runat="server" ID="DdlConsignacion" DataValueField="CveConsignacion" DataTextField="SerieFolioFecha" Width="180px"></asp:DropDownList> <asp:DropDownList runat="server" ID="DdlConsignacion" DataValueField="CveConsignacion" DataTextField="SerieFolioFecha" Width="180px"></asp:DropDownList>
</li> </li>
<%--<li>Folio Consignación:
<asp:TextBox ID="TxtConsignacion" Width="70px" runat="server" ValidationGroup="GrpGetConsignacion" />
<asp:RequiredFieldValidator ID="RFVConsignacion" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio Consignación''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGetConsignacion"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEConsignacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVConsignacion" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:HiddenField runat="server" ID="HdnCveConsignacion" />
</li>--%>
</ul> </ul>
</div> </div>
<div class="tools"> <div class="tools">
<asp:Button ID="BtnVinculaConsignacion" OnClick="BtnVinculaConsignacion_Click1" Visible="false" CssClass="btn btn-primary" runat="server" Text="Vincular Consignación" /> <asp:Button ID="BtnVinculaConsignacion" OnClick="BtnVinculaConsignacion_Click1" Visible="false" CssClass="btn btn-primary" runat="server" Text="Vincular Consignación" />
<%--<asp:Button ID="BtnVinculaConsignacion" runat="server" Text="Asignar" OnClick="BtnVinculaConsignacion_Click" class="btn btn-primary" ValidationGroup="GrpGetConsignacion" />--%>
</div> </div>
</div> </div>
</div> </div>
@@ -2417,12 +2401,17 @@
<ajax:CalendarExtender ID="Calendario" runat="server" TargetControlID="TxtFechaPago" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender> <ajax:CalendarExtender ID="Calendario" runat="server" TargetControlID="TxtFechaPago" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaC" runat="server" ControlToValidate="TxtFechaPago" Display="None" ErrorMessage="El campo <b>''Fecha de Pago''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVFechaC" runat="server" ControlToValidate="TxtFechaPago" Display="None" ErrorMessage="El campo <b>''Fecha de Pago''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaC" runat="server" ControlToValidate="TxtFechaPago" Display="None" ErrorMessage="El campo <b>''Fecha de Pago''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator> <asp:CompareValidator ID="CVFechaC" runat="server" ControlToValidate="TxtFechaPago" Display="None" ErrorMessage="El campo <b>''Fecha de Pago''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCERFVFC" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaC" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCERFVFC" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaC" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCECVFC" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaC" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCECVFC" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaC" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:CompareValidator ID="CVFechaPago" runat="server" ControlToCompare="TxtFecha" ControlToValidate="TxtFechaPago" Display="None" Operator="GreaterThanEqual" Type="Date" ValidationGroup="GrpGuardar" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Pago''</b>tiene que ser mayor o igual a la fecha del documento."></asp:CompareValidator> <asp:CompareValidator ID="CVFechaPago" runat="server" ControlToCompare="TxtFecha" ControlToValidate="TxtFechaPago" Display="None" Operator="GreaterThanEqual" Type="Date" ValidationGroup="GrpGuardar" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Pago''</b>tiene que ser mayor o igual a la fecha del documento."></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaPago" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaPago" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCEFechaPago" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaPago" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator runat="server" id="CBTxtFechaPago" ControlToValidate="TxtFechaPago" ClientValidationFunction="ValidaRangoDeFechas" ValidationGroup="GrpGuardar" ErrorMessage="La fecha de pago no debe de exeder de 5 años en relaciión a la fecha de la compra." Display="None" />
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender8" runat="server" HighlightCssClass="vco" TargetControlID="CBTxtFechaPago" Width="350px"></ajax:ValidatorCalloutExtender>
</div> </div>
</td> </td>
<td align="left"> <td align="left">
@@ -6660,6 +6649,28 @@
} }
function ValidaRangoDeFechas(sender, args) {
if ($("#TxtFecha").val().length == 10 && $("#TxtFechaPago").val().length == 10) {
let Finicio = parseInt($("#TxtFecha").val().substring(6,10));
let FFin = parseInt($("#TxtFechaPago").val().substring(6, 10));
if ((FFin - Finicio) > 5) {
args.IsValid = false;
} else {
args.IsValid = true;
}
} else {
args.IsValid = true;
}
}
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -3955,6 +3955,10 @@ Partial Class Compras_Compras
'End If 'End If
'------------------ INICIA VALIDACIONES ------------------ '------------------ INICIA VALIDACIONES ------------------
Dim EstatusCredito As Integer = 0 Dim EstatusCredito As Integer = 0
Dim CveSubProyecto As Integer = 0 Dim CveSubProyecto As Integer = 0
'Credito Multiple 'Credito Multiple
@@ -18674,17 +18678,15 @@ Partial Class Compras_Compras
TmpDT.Rows(HdnAliasInd.Value.ToEntero)("Obs") = TxtPSAlias.Text.Trim TmpDT.Rows(HdnAliasInd.Value.ToEntero)("Obs") = TxtPSAlias.Text.Trim
'busco si el producto está en otros renglones QUE NO LO TENGAN ASIGNADO, LO VINCULE 'busco si el producto está en otros renglones QUE NO LO TENGAN ASIGNADO, LO VINCULE
If UsuarioActual.CveEmpresa <> 141 Then For Each drt As DataRow In TmpDT.Select($"PS ='{TxtPSAlias.Text.Trim}' and ISNULL(CvePS,0) = 0")
For Each drt As DataRow In TmpDT.Select($"PS ='{TxtPSAlias.Text.Trim}' and ISNULL(CvePS,0) = 0") drt("CvePS") = CvePS
drt("CvePS") = CvePS drt("PS") = tPS
drt("PS") = tPS drt("CveUM") = DdlUnidadAlias.SelectedValue.ToEntero
drt("CveUM") = DdlUnidadAlias.SelectedValue.ToEntero drt("UM") = DdlUnidadAlias.SelectedItem.Text
drt("UM") = DdlUnidadAlias.SelectedItem.Text drt("CveClasificacion") = HdnPSAliasCveClasificacion.Value.ToEntero
drt("CveClasificacion") = HdnPSAliasCveClasificacion.Value.ToEntero drt("Clasificacion") = HdnPSAliasClasificacion.Value
drt("Clasificacion") = HdnPSAliasClasificacion.Value drt("Obs") = TxtPSAlias.Text.Trim
drt("Obs") = TxtPSAlias.Text.Trim Next
Next
End If
TmpDT.AcceptChanges() TmpDT.AcceptChanges()

View File

@@ -952,7 +952,9 @@ Partial Class ContabilidadC_RegPrePolizaS
End If End If
Else Else
Alert("No se puede contabilizar la Prepoliza debido a que una o mas cuentas son inválidas") Alert("No se puede contabilizar la Prepoliza debido a que una o mas cuentas son inválidas")
End If End If
Else
MensajeAlert.AppendFormat("<br/><br/>Folio: <b><a href = ""/Contabilidad/RegPrepolizaS.aspx?CvePrePoliza={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CvePrePoliza, ObjMov.ContaFolio)
End If End If
Else Else
@@ -1946,14 +1948,22 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim CveSubProyecto As Integer = -1 Dim CveSubProyecto As Integer = -1
Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True) Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True)
Dim CveConceptoContable As Integer = GlobalDTContaConceptosContables(-1).FiltroPrimeroValor("CveConceptoContable", String.Format("ConceptoContable ='{0}'", Row("ConceptoAdministrativo"))).ToEntero ' Row("CveConceptoContable").ToString.ToEntero Dim CveConceptoContable As Integer = GlobalDTContaConceptosContables(-1).FiltroPrimeroValor("CveConceptoContable", String.Format("ConceptoContable ='{0}'", Row("ConceptoAdministrativo"))).ToEntero ' Row("CveConceptoContable").ToString.ToEntero
Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero 'Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero
Dim CveClasificacion As Integer = -1 Dim CveClasificacion As Integer = -1
Dim CveCuenta As Integer = -1 Dim CveCuenta As Integer = -1
Dim ObjConta2 As New ClsContabilidad Dim ObjConta2 As New ClsContabilidad
If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString, 1, UsuarioActual.CveEmpresa) Then If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString.Replace("-", ""), 1, UsuarioActual.CveEmpresa) Then
CveCuenta = ObjConta2.DtResultados.FiltroPrimeroValor("CveCuenta", "").ToEntero CveCuenta = ObjConta2.DtResultados.FiltroPrimeroValor("CveCuenta", "").ToEntero
NombreCuenta = ObjConta2.DtResultados.FiltroPrimeroValor("CtaCodigo", "")
End If End If
ObjConta2.Dispose() ObjConta2.Dispose()
If CveCuenta <= 0 Then
Alert(String.Format("La cuenta <b>{0}</b> no se reconoció, favor de verificar el archivo.", Row("Cuenta").ToString))
DtMovimientos.Clear()
Exit For
End If
'sino viene el cveconcepto, busca por le nombre del concepto 'sino viene el cveconcepto, busca por le nombre del concepto
If CveConceptoContable = 0 Then If CveConceptoContable = 0 Then
Alert(String.Format("El concepto <b>{0}</b> no se reconoció, favor de verificar el archivo.", Row("ConceptoAdministrativo"))) Alert(String.Format("El concepto <b>{0}</b> no se reconoció, favor de verificar el archivo.", Row("ConceptoAdministrativo")))

View File

@@ -504,7 +504,7 @@ Partial Class Contabilidad2_CatCuentas
End If End If
If IdPadre > 0 Then If IdPadre > 0 Then
Dim idnew2 As Integer = ObjConta2.AddCuenta(TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, CuentaEfectivo, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, TxtNomIngles.Text.Trim, Afectable, IdPadre, IdAgrupador) Dim idnew2 As Integer = ObjConta2.AddCuenta(TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, CuentaEfectivo, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, TxtNomIngles.Text.Trim, 1, IdPadre, IdAgrupador)
If idnew2 > 0 Then If idnew2 > 0 Then
If Not ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then If Not ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then

File diff suppressed because it is too large Load Diff

View File

@@ -4444,6 +4444,13 @@ Partial Class Inventarios_EntradasSalidas
TrSerieEntrada.Visible = AplicaSerie TrSerieEntrada.Visible = AplicaSerie
TxtnSerie.Visible = AplicaSerie TxtnSerie.Visible = AplicaSerie
Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenInventarioFisico.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero
If UsuarioActual.CveEmpresa = 119 AndAlso Not CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then
AplicaLote = False
AplicaCaducidad = False
End If
'activa seccion 'activa seccion
ThSeccionEntrada.Visible = AplicaSeccion ThSeccionEntrada.Visible = AplicaSeccion
TrSeccionEntrada.Visible = AplicaSeccion TrSeccionEntrada.Visible = AplicaSeccion
@@ -4468,6 +4475,7 @@ Partial Class Inventarios_EntradasSalidas
If DdlPSSalida.SelectedValue.ToEntero > 0 Then If DdlPSSalida.SelectedValue.ToEntero > 0 Then
Dim drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSSalida.SelectedValue.ToEntero).FiltroPrimero("") Dim drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSSalida.SelectedValue.ToEntero).FiltroPrimero("")
If drp IsNot Nothing Then If drp IsNot Nothing Then
Dim AplicaSerie As Boolean = CBool(drp("AplicaSerie")) Dim AplicaSerie As Boolean = CBool(drp("AplicaSerie"))
Dim AplicaSeccion As Boolean = CBool(drp("AplicaSeccion")) Dim AplicaSeccion As Boolean = CBool(drp("AplicaSeccion"))
@@ -4478,6 +4486,12 @@ Partial Class Inventarios_EntradasSalidas
TrSerieSalida.Visible = AplicaSerie TrSerieSalida.Visible = AplicaSerie
TxtnSerie.Visible = AplicaSerie TxtnSerie.Visible = AplicaSerie
Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenInventarioFisico.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero
If UsuarioActual.CveEmpresa = 119 AndAlso Not CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then
AplicaLote = False
AplicaCaducidad = False
End If
'activa seccion 'activa seccion
ThSeccionSalida.Visible = AplicaSeccion ThSeccionSalida.Visible = AplicaSeccion
TrSeccionSalida.Visible = AplicaSeccion TrSeccionSalida.Visible = AplicaSeccion

View File

@@ -646,7 +646,8 @@ Partial Class Inventarios_EntregaAlmacen
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto", "").ToEntero Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto", "").ToEntero
If CveSubProyectoAlmacen = 10276 Then
If CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then
ValidaLoteCaducidad = True ValidaLoteCaducidad = True
Else Else
ValidaLoteCaducidad = False ValidaLoteCaducidad = False
@@ -974,16 +975,29 @@ Partial Class Inventarios_EntregaAlmacen
e.Row.FCLinkButton("LnkCaducidad").Visible = True e.Row.FCLinkButton("LnkCaducidad").Visible = True
e.Row.FCTextBox("TxtCaducidad").ReadOnly = True e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
' e.Row.FCTextBox("TxtCaducidad").enabled = True
'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro
If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then
e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
e.Row.FCTextBox("TxtCaducidad").Enabled = True
End If
Else Else
e.Row.FCTextBox("TxtCaducidad").Visible = False e.Row.FCTextBox("TxtCaducidad").Visible = False
e.Row.FCLinkButton("LnkCaducidad").Visible = False e.Row.FCLinkButton("LnkCaducidad").Visible = False
e.Row.FCTextBox("TxtCaducidad").Enabled = True
End If End If
If CBool(e.Row.DBCampo("AplicaLote")) Then If CBool(e.Row.DBCampo("AplicaLote")) Then
e.Row.FCTextBox("TxtLote").Visible = True e.Row.FCTextBox("TxtLote").Visible = True
e.Row.FCTextBox("TxtLote").ReadOnly = True 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro
'e.Row.FCTextBox("TxtLote").enabled = True If e.Row.FCTextBox("TxtLote").Text = "" Then
e.Row.FCTextBox("TxtLote").ReadOnly = False
e.Row.FCTextBox("TxtLote").Enabled = True
Else
e.Row.FCTextBox("TxtLote").ReadOnly = True
End If
Else Else
e.Row.FCTextBox("TxtLote").Visible = False e.Row.FCTextBox("TxtLote").Visible = False
End If End If
@@ -2573,10 +2587,10 @@ Partial Class Inventarios_EntregaAlmacen
End If End If
End If End If
'DEVOLUCION APARTADOS 'DEVOLUCION APARTADOS
If Not ErrorMovInv Then If Not ErrorMovInv Then
If TipoMovimiento = 2 Then If TipoMovimiento = 2 Then
If ObjInventario.VentasAlmacenApartadosGet(CveVentaSurtir) Then If ObjInventario.VentasAlmacenApartadosGet(CveVentaSurtir) Then
@@ -2594,107 +2608,113 @@ Partial Class Inventarios_EntregaAlmacen
For Each Dr As DataRow In DtTempApartados.Rows For Each Dr As DataRow In DtTempApartados.Rows
If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString().ToEntero() Then If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString().ToEntero() Then
CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1,
Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente,
CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9") CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9")
FolioSalida = ObjInventario.Folio FolioSalida = ObjInventario.Folio
CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero()
Dim DrMovto = DtTraspasos.NewRow
DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero()
DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero()
DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado
DrMovto("FolioSalida") = FolioSalida
DtTraspasos.Rows.Add(DrMovto)
End If
Dim DrMovto = DtTraspasos.NewRow
DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero()
DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero()
DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado
DrMovto("FolioSalida") = FolioSalida
DtTraspasos.Rows.Add(DrMovto)
End If
If Not CveMovimientoSalidaApartado > 0 Then If Not CveMovimientoSalidaApartado > 0 Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados")
Exit For Exit For
End If End If
'If CBool(Dr("AplicaSeccion")) Then
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenOrigen, Dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero()
' Dim a As String = String.Format("CveAlmacen={0}-CvePS:{1}-CveseccionAlmacen={2}", CveAlmacenOrigen, Dr("CvePS"), CveSeccionAlmacen)
'Else
' CveSeccionAlmacen = -1
'End If
CveSeccionAlmacen = -3 CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados")
Exit For
End If
Next
If Not ErrorMovInv Then
Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrePolizaTraspaso > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalidaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados")
Exit For
End If End If
Next
If Not ErrorMovInv Then For Each Dr1 As DataRow In DtTraspasos.Rows
CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero()
Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrePolizaTraspaso > 0 Then
For Each Dr1 As DataRow In DtTraspasos.Rows
CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero()
CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString().ToEntero(), 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString().ToEntero(), 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
-1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(),
CveMovimientoRelacionado:=CveMovimientoSalida, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, If Not CveMovimientoEntradaApartado > 0 Then
CveCliente:=CveCliente, Modulo:="RE/G10")
FolioEntrada = ObjInventario.Folio
If Not CveMovimientoEntradaApartado > 0 Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.") TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For Exit For
End If End If
Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado
Dr1("FolioEntrada") = FolioEntrada Dr1("FolioEntrada") = FolioEntrada
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
CveSeccionAlmacen = -3 CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For Exit For
End If End If
Next Next
End If End If
If ErrorMovInv Then Exit For If ErrorMovInv Then Exit For
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then
ErrorMovInv = True
End If
Next
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then Else
ErrorMovInv = True ErrorMovInv = True
End If
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then
ErrorMovInv = True
End If
Next
Else
ErrorMovInv = True
End If
End If End If
End If End If
End If End If
End If End If
End If
End If
End If
End If
End If End If
End If
'QUEMAR REMISIONES
If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then 'QUEMAR REMISIONES
Dim DtDevRem As New DataTable
'CARGA REMISIONES DE LA VENTA DEVUELTA
'CARGA REMISIONES DE LA VENTA DEVUELTA
If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then 'CARGA REMISIONES DE LA VENTA DEVUELTA
DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0") If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
Else DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0")
ErrorMovInv = True Else
End If ErrorMovInv = True
End If
If Not ErrorMovInv Then
If Not ErrorMovInv Then
If DtDevRem.Rows.Count > 0 Then If DtDevRem.Rows.Count > 0 Then
For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows
If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString().ToEntero(), 2) Then If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString().ToEntero(), 2) Then

View File

@@ -5304,14 +5304,38 @@ Partial Class RH_Personal
Dim Cantidad As Double = TxtCantidadResguardo.Text.ToDouble() Dim Cantidad As Double = TxtCantidadResguardo.Text.ToDouble()
Dim Serie As String = TxtLiberarSerie.Text.Trim Dim Serie As String = TxtLiberarSerie.Text.Trim
Dim MsgError As String = ""
Dim CveResultadoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenUniforme, 3, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme) Dim CveResultadoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenUniforme, 3, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme)
Dim ResultadoDetalleSalida As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoSalida, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacenUniforme, Serie:=Serie, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme) If CveResultadoSalida > 0 Then
Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacen.SelectedValue.ToEntero If CveSeccionAlmacenUniforme = 0 Then CveSeccionAlmacenUniforme = -3 'que lo tome por default
Dim CveResultadoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme) Dim ResultadoDetalleSalida As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoSalida, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacenUniforme, Serie:=Serie, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme)
Dim ResultadoDetalleEntrada As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoEntrada, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie) Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacen.SelectedValue.ToEntero
If ResultadoDetalleSalida Then
If ResultadoDetalleSalida And ResultadoDetalleEntrada Then Dim CveResultadoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme)
If CveResultadoEntrada > 0 Then
Dim ResultadoDetalleEntrada As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoEntrada, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie)
If ResultadoDetalleSalida And ResultadoDetalleEntrada Then
MsgError = ""
Else
Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError)
MsgError = "Error1"
End If
Else
MsgError = "Error1"
End If
Else
MsgError = "Error1"
End If
Else
MsgError = "Error"
End If
If MsgError = "" Then
ObjInventario.Commit() ObjInventario.Commit()
Alert("El resguardo se liberó correctamente") Alert("El resguardo se liberó correctamente")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalUniforme")) RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalUniforme"))
@@ -5320,6 +5344,7 @@ Partial Class RH_Personal
Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError) Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError)
ObjInventario.RollBack() ObjInventario.RollBack()
End If End If
ObjInventario.Dispose() ObjInventario.Dispose()
End Sub End Sub

View File

@@ -397,12 +397,12 @@ public class TareasJam : IHttpHandler
this.GuardaLog($"EjecutaThalamus: Cargando archivo excel productos a FTP. "); this.GuardaLog($"EjecutaThalamus: Cargando archivo excel productos a FTP. ");
CargaProductos = CargarArchivos(FInfoProductos, FTPServer, TFPUsr, FTPPass); CargaProductos = CargarArchivos(FInfoProductos, $"{FTPServer}/Productos", TFPUsr, FTPPass);
if (CargaProductos) if (CargaProductos)
{ {
this.GuardaLog($"EjecutaThalamus: Verificando archivo productos. "); this.GuardaLog($"EjecutaThalamus: Verificando archivo productos. ");
CargaProductos = VerificarArchivo(FInfoProductos, FInfoProductos.Length, FTPServer, TFPUsr, FTPPass); CargaProductos = VerificarArchivo(FInfoProductos, FInfoProductos.Length, $"{FTPServer}/Productos", TFPUsr, FTPPass);
} }
if (CargaProductos) if (CargaProductos)

View File

@@ -36,7 +36,7 @@ Partial Class Ventas_RepPS
'DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) 'DdlMarca.Items.Insert(0, New ListItem("Todos", "-1"))
End If End If
If UsuarioActual.TienePermisoProceso(320) Then If UsuarioActual.TienePermisoProceso(320) OrElse UsuarioActual.CveRol = 1 Then
LnkRepDiario.Visible = True LnkRepDiario.Visible = True
End If End If
@@ -242,9 +242,11 @@ Partial Class Ventas_RepPS
Dim TC As Integer = 1 Dim TC As Integer = 1
Dim TCEspecifico As Decimal = -1 Dim TCEspecifico As Decimal = -1
Dim FechaConsulta As DateTime = Now
Dim DataSet As DataSet = New DataSet Dim DataSet As DataSet = New DataSet
Dim ObjVentas As New ClsVentas() Dim ObjVentas As New ClsVentas()
If ObjVentas.GetRepPSDiario(-1, -1, Now, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=-1, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then If ObjVentas.GetRepPSDiario(-1, -1, FechaConsulta, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=-1, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then
DataSet = ObjVentas.DataSetResultados.Copy() DataSet = ObjVentas.DataSetResultados.Copy()
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
@@ -254,7 +256,7 @@ Partial Class Ventas_RepPS
Dim FileExcel As New ExcelFile() Dim FileExcel As New ExcelFile()
Dim worksheetName As String = $"{ToShortMonthName(Now).ToUpper()}{Now.Day}" Dim worksheetName As String = $"{ToShortMonthName(FechaConsulta).ToUpper()}{FechaConsulta.Day}"
Const invalidCharsRegex As String = "[/\\*'?[\]:]+" Const invalidCharsRegex As String = "[/\\*'?[\]:]+"
Const maxLength As Integer = 31 Const maxLength As Integer = 31
Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim() Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim()
@@ -269,7 +271,7 @@ Partial Class Ventas_RepPS
Dim CellRangeTitulo = worksheet.Cells.GetSubrangeAbsolute(0, 0, 0, 12) Dim CellRangeTitulo = worksheet.Cells.GetSubrangeAbsolute(0, 0, 0, 12)
CellRangeTitulo.Merged = True CellRangeTitulo.Merged = True
CellRangeTitulo.Value = $"{UsuarioActual.Empresa.Empresa}. VENTA DEL DIA {Now.Day} DE {ToMonthName(Now).ToUpper()} DEL {Now.Year}." CellRangeTitulo.Value = $"{UsuarioActual.Empresa.Empresa}. VENTA DEL DIA {FechaConsulta.Day} DE {ToMonthName(FechaConsulta).ToUpper()} DEL {FechaConsulta.Year}."
CellRangeTitulo.Style.VerticalAlignment = VerticalAlignmentStyle.Center CellRangeTitulo.Style.VerticalAlignment = VerticalAlignmentStyle.Center
CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center
@@ -552,8 +554,8 @@ Partial Class Ventas_RepPS
Dim IdxRefAnioAnteriorLlantas As Integer = IdxPorcentajes + 3 Dim IdxRefAnioAnteriorLlantas As Integer = IdxPorcentajes + 3
worksheet.Cells(IdxRefAnioAnteriorLlantas, 0).Value = "Sucursal" worksheet.Cells(IdxRefAnioAnteriorLlantas, 0).Value = "Sucursal"
worksheet.Cells(IdxRefAnioAnteriorLlantas, 1).Value = (Now.Year - 1).ToString() worksheet.Cells(IdxRefAnioAnteriorLlantas, 1).Value = (FechaConsulta.Year - 1).ToString()
worksheet.Cells(IdxRefAnioAnteriorLlantas, 2).Value = Now.Year.ToString() worksheet.Cells(IdxRefAnioAnteriorLlantas, 2).Value = FechaConsulta.Year.ToString()
worksheet.Cells(IdxRefAnioAnteriorLlantas, 3).Value = "Dif" worksheet.Cells(IdxRefAnioAnteriorLlantas, 3).Value = "Dif"
Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, 0, IdxRefAnioAnteriorLlantas, 3).Style Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, 0, IdxRefAnioAnteriorLlantas, 3).Style
@@ -614,13 +616,117 @@ Partial Class Ventas_RepPS
DtAnioAnteriorLLantas.Dispose() DtAnioAnteriorLLantas.Dispose()
#End Region #End Region
#Region "L L A N T A S M E S A Ñ O A N T E R I O R"
Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxAnioAnteriorLlantas + 3
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS"
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%"
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal"
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1))
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year))
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %"
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1))
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year))
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %"
Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style
StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight
StyleTitleTable5.Font.Name = "Calibri"
StyleTitleTable5.Font.Size = 8 * 20
StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style
StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight
StyleSubTitleTable5.Font.Name = "Calibri"
StyleSubTitleTable5.Font.Size = 8 * 20
StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4)
'INICIA DESDE LA CUARTA FILA
Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1
For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows
worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal")
worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior")
worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas")
worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})"
worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1"
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style
StyleData.Font.Weight = ExcelFont.NormalWeight
StyleData.Font.Name = "Calibri"
StyleData.Font.Size = 8 * 20
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
IdxMesAnioAnteriorLlantas += 1
Next
DtMesAnioAnteriorLLantas.Dispose()
#End Region
#Region "L L A N T A S M E S A Ñ O A N T E R I O R"
Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxMesAnioAnteriorLlantas + 2
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes"
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1))
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year))
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS"
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %"
Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style
StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight
StyleTitleTable6.Font.Name = "Calibri"
StyleTitleTable6.Font.Size = 8 * 20
StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center
StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center
Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5)
'INICIA DESDE LA CUARTA FILA
Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1
For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper()
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior")
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas")
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})"
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})"
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
StyleData.Font.Weight = ExcelFont.NormalWeight
StyleData.Font.Name = "Calibri"
StyleData.Font.Size = 8 * 20
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
IdxMesAnioAnteriorLlantasResumen += 1
Next
DtMesAnioAnteriorLLantasResumen.Dispose()
#End Region
Dim columnCount = worksheet.CalculateMaxUsedColumns() Dim columnCount = worksheet.CalculateMaxUsedColumns()
For i = 0 To columnCount For i = 0 To columnCount
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
Next Next
FileExcel.Save(Response, $"DIARIO_{Now.ToString("dd_MM_yyyy")}.xlsx", SaveOptions.XlsxDefault) FileExcel.Save(Response, $"DIARIO_{FechaConsulta.ToString("dd_MM_yyyy")}.xlsx", SaveOptions.XlsxDefault)
End If End If