VyA RepContratoCalendario, rdlc rep anomalias, Compras gv Inv requerir lote y fecha de caducidad

This commit is contained in:
rakcsle
2024-11-19 15:46:09 -07:00
parent 556a479822
commit c800ccc7af
6 changed files with 4029 additions and 3730 deletions

View File

@@ -1305,9 +1305,11 @@
<asp:UpdatePanel ID="UpInv" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento,UUIDRow" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall mysmallbtn" Visible="false">
<Columns>
<%--0--%>
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
Aplica<br />
@@ -1318,6 +1320,7 @@
<asp:CheckBox ID="cbInv" runat="server" Checked="false" Enabled="false" AutoPostBack="true" OnCheckedChanged="CambiaTotalDevengar" />
</ItemTemplate>
</asp:TemplateField>
<%--1--%>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox ID="TbCantidad" runat="server" Width="50px" Mask="999,999.99" Text='<%# Eval("CantidadF", "{0:N2}")%>'></asp:TextBox>
@@ -1329,7 +1332,7 @@
</ItemTemplate>
<HeaderStyle CssClass="Titulos" />
</asp:TemplateField>
<%--2--%>
<asp:TemplateField>
<HeaderTemplate>
Unidad
@@ -1338,9 +1341,11 @@
<asp:Label ID="LtlUnidadMedida" runat="server" Text='<%# Eval("UM") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="5%" />--%>
<%--3--%>
<asp:BoundField ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left" HeaderText=" Servicio" DataField="PS" />
<%--4--%>
<asp:BoundField ItemStyle-Width="7.5%" HeaderText="P.U." DataField="PU" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" />
<%--5--%>
<asp:TemplateField ItemStyle-Width="10%">
<ItemTemplate>
<asp:DropDownList ID="ddlEAlmacen" Enabled="false" runat="server" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="CambiaTotalDevengar"></asp:DropDownList>
@@ -1350,6 +1355,7 @@
<asp:DropDownList ID="ddlAlmacen" Enabled="True" runat="server" DataTextField="Almacen" OnSelectedIndexChanged="ddlAlmacen_SelectedIndexChanged" AppendDataBoundItems="true" AutoPostBack="true" CssClass="form-control input-sm select2me" DataValueField="CveAlmacen" Width="100%"></asp:DropDownList>
</HeaderTemplate>
</asp:TemplateField>
<%--6--%>
<asp:TemplateField ItemStyle-Width="10%" HeaderText="Recibir" Visible="false">
<ItemTemplate>
<asp:DropDownList ID="DdlRecibirInv" Enabled="false" runat="server" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="CambiaTotalDevengar" CssClass="form-control input-sm select2me">
@@ -1358,11 +1364,31 @@
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="10%">
<%--7--%>
<asp:TemplateField HeaderText="Lote" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" Visible="false">
<ItemTemplate>
<asp:ImageButton ID="btnImgDestino" runat="server" AlternateText="+" />
<asp:TextBox ID="TxtLote" CssClass="form-control input-sm" onblur="clickBtnInvActualizaLoteCaducidad();" runat="server" Visible="false" Text='<%# Eval("Lote") %>' Width="100px" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>--%>
</asp:TemplateField>
<%--8--%>
<asp:TemplateField HeaderText="Fecha Caducidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" Visible="false">
<ItemTemplate>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;" runat="server" visible="false" id="DvFechaCaducidad" >
<asp:TextBox ID="TxtCaducidad" Text='<%# Eval("FechaCaducidad") %>' CssClass="form-control input-sm ADSMaskDate" onblur="clickBtnInvActualizaLoteCaducidad();" Style="width: 87px" runat="server" ></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="LnkCaducidad" class="btn default" Visible="false" > <i class="fa fa-calendar"></i> </asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEECaducidad" runat="server" TargetControlID="TxtCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CECaducidad" TargetControlID="TxtCaducidad" PopupButtonID="LnkCaducidad" PopupPosition="TopLeft" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVCaducidad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Caducidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCECaducidad" runat="server" HighlightCssClass="vco" TargetControlID="RFVCaducidad"></ajax:ValidatorCalloutExtender>
</div>
</ItemTemplate>
</asp:TemplateField>
<%--9--%>
<asp:TemplateField ItemStyle-Width="10%" Visible="false">
<HeaderTemplate>
Almacén Consignación<br />
@@ -1372,6 +1398,7 @@
<asp:DropDownList ID="ddlAlmacenConsignacion" Enabled="False" runat="server" Width="100px" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="ddlAlmacenConsignacion_SelectedIndexChanged"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<%--10--%>
<asp:TemplateField ItemStyle-Width="15%" HeaderText="Consignación" Visible="false">
<ItemTemplate>
<asp:DropDownList runat="server" ID="DdlVinculaConsignacion" Enabled="false" OnSelectedIndexChanged="DdlVinculaConsignacion_SelectedIndexChanged" CssClass="form-control input-sm select2me" AutoPostBack="true" DataTextField="Detalle" DataValueField="No" Width="280px"></asp:DropDownList>
@@ -1384,11 +1411,7 @@
<asp:HiddenField runat="server" ID="HdnCveAlmacen" Value="-1" />
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Nuevo Producto o servicio" Visible="false">
<ItemTemplate>
<asp:DropDownList runat="server" ID="Ddlnewps" DataTextField="PSCodigo" DataValueField="CvePS" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
@@ -5639,7 +5662,6 @@
<div id="DVModalConfirmaVinculacionProntoPago" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
@@ -5676,7 +5698,13 @@
<div style="display:none">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnInvActualizaLoteCaducidad" runat="server" OnClick="BtnInvActualizaLoteCaducidad_Click" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
@@ -5739,9 +5767,37 @@
$('#BtnCargarGVAF').click();
});
//$(".monitorLote").on("input", function () {
// var currentValue = $(this).val();
// console.log("Texto cambiado: " + currentValue);
// $("#BtnInvActualizaLoteCaducidad").click();
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
// // Esto requiere un ScriptManager en tu página
// //__doPostBack('txtExample', currentValue);
//});
//$(".monitorCaducidad").on("input", function () {
// var currentValue = $(this).val();
// console.log("Texto cambiado: " + currentValue);
// $("#BtnInvActualizaLoteCaducidad").click();
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
// // Esto requiere un ScriptManager en tu página
// //__doPostBack('txtExample', currentValue);
//});
});
}
function clickBtnInvActualizaLoteCaducidad() {
$("#BtnInvActualizaLoteCaducidad").click();
}
function ClickDeudorChk(Chk, Obj, total, saldo,txtOtrIngEgs) {
debugger;
total = parseFloat(parseFloat(total).toFixed(2));

View File

@@ -1906,6 +1906,21 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
AddPS2(False)
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
@@ -2939,13 +2954,9 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveContrato", GetType(Integer))
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
If Not TmpDT.Columns.Contains("CveContratoDetalle") Then
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
End If
If Not TmpDT.Columns.Contains("CveCultivoCuadroDetalle") Then
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
End If
@@ -2957,7 +2968,19 @@ Partial Class Compras_Compras
If Not TmpDT.Columns.Contains("ImporteSinImpuestos") Then
TmpDT.Columns.Add("ImporteSinImpuestos", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
@@ -4288,6 +4311,12 @@ Partial Class Compras_Compras
Exit Sub
End If
If Not validaFechaNumeroReembolso() Then
Exit Sub
End If
Dim TotalRealDevolucion As Decimal = 0
Dim EstatusCredito As Integer = 0
@@ -5588,8 +5617,10 @@ Partial Class Compras_Compras
For Each dr As DataRow In DtInv.Rows
If dr("cvealmacen").ToString.ToEntero = tcvealmacen Then
'hay que restarle descuento
Dim Lote As String = dr("Lote").ToString
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
importeconcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, dr("pu").ToString.ToDecimal, dr("pu").ToString.ToDecimal * TipoCambioGuardar) - (If(DdlMoneda.SelectedValue.ToEntero = 1, dr("descuento").ToString.ToDecimal, dr("descuento").ToString.ToDecimal * TipoCambioGuardar) / dr("cantidad").ToString.ToDecimal)
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
@@ -5606,7 +5637,9 @@ Partial Class Compras_Compras
Else
If ObjInventario.GetMovimientosDetalle(cvemovimientoentrada, UsuarioActual.CveEmpresa) Then
For Each dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
Dim Lote As String = dr("Lote").ToString
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
@@ -5699,12 +5732,22 @@ Partial Class Compras_Compras
tDescuento = Dr("Descuento").ToString.ToDecimal / CantidadInv
CostoIndirecto = Dr("CostoIndirectoAlmacen").ToString.ToDecimal
Dim Lote As String = Dr("Lote").ToString
Dim FechaCaducidad As Date = If(Dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, Dr("FechaCaducidad").ToString.ToDate)
Dim AplicaLote As Boolean = Boolean.Parse(Dr("AplicaLote").ToString)
Dim AplicaCaducidad As Boolean = Boolean.Parse(Dr("AplicaCaducidad").ToString)
Dim CodigoPS As String = Dr("CodigoPS").ToString
If Dr("CveMetodoInventario").ToString.ToEntero = 5 Then
'SI FUE POR SERIE LOTE
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("CvePS = {0}", Dr("CvePS")))
If DtDetalle.Rows.Count > 0 Then
For Each drr As DataRow In DtDetalle.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=drr("Serie").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CostoIndirecto:=Dr("CostoIndirectoAlmacen").ToString.ToDecimal, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
Dim fechaDetalle As Date = drr("FechaCaducidad").ToString.ToDate
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=drr("Serie").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CostoIndirecto:=Dr("CostoIndirectoAlmacen").ToString.ToDecimal, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, Lote:=Lote) Then
ErrorMovInv = True
Exit For
End If
@@ -5731,11 +5774,27 @@ Partial Class Compras_Compras
'si no es por serie lote
ImporteConcepto = If(UsuarioActual.Empresa.UsaAC, ImporteConcepto * IVA, ImporteConcepto)
If Dr("CveAlmacen").ToString.ToEntero = tCveAlmacen Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
If AplicaLote And Lote.Trim = "" Then
ErrorMovInv = True
Alert($"Porducto {CodigoPS} requiere Lote.")
Exit For
End If
If AplicaCaducidad And FechaCaducidad = MinFecha And Lote.Trim = "" Then
ErrorMovInv = True
Alert($"Porducto {CodigoPS} requiere fecha de caducidad.")
Exit For
End If
If Not ErrorMovInv Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
End If
End If
End If
i = i + 1
contadorAlamcen = contadorAlamcen + 1
@@ -9377,21 +9436,74 @@ Partial Class Compras_Compras
End Sub
Private Function validaFechaNumeroReembolso() As Boolean
Private Function validaNumeroReembolso(transaccionSql As SqlTransaction) As Boolean
Dim respuesta As Boolean = True
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
Dim FechaCompra As Date = TxtFecha.Text.ToDate
If RblRembolso.SelectedValue.ToEntero = 1 Then
'IMPORATNTE DdlPersonalReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoPersonal
CvePersonalVal = DdlPersonalReembolso.SelectedValue.ToEntero
Dim objCompras As New ClsCompras(transaccionSql)
Dim objConta As New ClsContabilidad(transaccionSql)
Else
'IMPORATNTE DdlCuentaCajaChicaReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoCajaChica
CveCajaChicaVal = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
End If
Dim tienePagoContabilizado As Boolean = False
Dim ErrorProceso As Boolean = False
Dim CvePrePolizaReembolsoActual As Integer = CvePrePoliza
Dim CvePrePolizaReembolsoNuevo As Integer = -1
Dim objCompras As New ClsCompras()
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
Dim FechaReembolso As Date = objCompras.DtResultados.Rows(0)("Fecha").ToString.ToDate
Dim MesReembolsoInt As Integer = FechaReembolso.Month
Dim AnioReembolsoInt As Integer = FechaReembolso.Year
Dim mesAnterior As Integer
Dim AnioValidoInt As Integer
If MesReembolsoInt = 1 Then
mesAnterior = 12
AnioValidoInt = AnioReembolsoInt - 1
Else
mesAnterior = MesReembolsoInt - 1
AnioValidoInt = AnioReembolsoInt
End If
If MesReembolsoInt = FechaCompra.Month Or (FechaCompra.Month = mesAnterior AndAlso FechaCompra.Year = AnioValidoInt) Then
respuesta = True 'Correcto Fecha de compra dentro del mes del reembolso o mes anterior
Else
respuesta = False 'La fecha de la compra esta por fuera de lo permitido mes actual o mes anterior
If FechaCompra.Month > MesReembolsoInt Then
Alert($"La fecha de la compra que se quiere registrar esta adelantada al mes de la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
Else
Alert($"La fecha de la compra que se quiere registrar es anterior al mes permitido por la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
End If
End If
Else
respuesta = True ' No existe numero reembolso por lo que se considera Verdadero
End If
Else
respuesta = False ' al no poder consultar no se puede validar la fecha por lo que por default se considera como fecha no valida para el reembolso
End If
End If
objCompras.Dispose()
Return respuesta
End Function
Private Function validaNumeroReembolso(ByRef transaccionSql As SqlTransaction) As Boolean
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
@@ -9402,6 +9514,17 @@ Partial Class Compras_Compras
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
End If
Dim objCompras As New ClsCompras(transaccionSql)
Dim objConta As New ClsContabilidad(transaccionSql)
Dim tienePagoContabilizado As Boolean = False
Dim ErrorProceso As Boolean = False
Dim CvePrePolizaReembolsoActual As Integer = CvePrePoliza
Dim CvePrePolizaReembolsoNuevo As Integer = -1
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados.Rows.Count > 0 Then
@@ -9422,10 +9545,8 @@ Partial Class Compras_Compras
End If
End If
If NumeroReembolsoOriginal = "" And TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacionPagosContabilizados(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
@@ -10671,6 +10792,11 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
TmpDT.Columns.Add("TemporadaCuadro", GetType(String))
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDT.Columns.Add("Lote", GetType(String))
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
TmpDTOriginal = New DataTable
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
@@ -10781,7 +10907,10 @@ Partial Class Compras_Compras
TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double))
TmpDTOriginal.Columns.Add("TemporadaCuadro", GetType(String))
TmpDTOriginal.Columns.Add("AplicaLote", GetType(Boolean))
TmpDTOriginal.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDTOriginal.Columns.Add("Lote", GetType(String))
TmpDTOriginal.Columns.Add("FechaCaducidad", GetType(Date))
End Sub
@@ -10955,6 +11084,18 @@ Partial Class Compras_Compras
#Region " ALMACEN "
Private Sub CargaGvInv()
If Not TmpDT.Columns.Contains("UUIDRow") Then
TmpDT.Columns.Add("UUIDRow", GetType(String))
End If
For Each dRow As DataRow In TmpDT.Rows
If dRow("UUIDRow").ToString.Trim = "" Then
dRow("UUIDRow") = Guid.NewGuid().ToString()
End If
Next
TmpDT.AcceptChanges()
'SI ES CONSIGNACION NO LIMITA POR TIPO PS - PARA GLUYAS
If ChkConsignacion.Checked Then
DtInv = TmpDT.Copy
@@ -10962,6 +11103,18 @@ Partial Class Compras_Compras
DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy
End If
For Each dRow As DataRow In DtInv.Rows
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
Dim AplicaLote As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
Dim AplicaCaducidad As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
GvInv.Columns(7).Visible = AplicaLote
GvInv.Columns(8).Visible = AplicaCaducidad
Next
GvInv.DataSource = DtInv
GvInv.DataBind()
@@ -10975,6 +11128,35 @@ Partial Class Compras_Compras
End Sub
Protected Sub BtnInvActualizaLoteCaducidad_Click(sender As Object, e As EventArgs)
For Each gvRow As GridViewRow In GvInv.Rows
Dim TxtLote As TextBox = gvRow.FCTextBox("TxtLote")
Dim TxtFechaCaducidad As TextBox = gvRow.FCTextBox("TxtCaducidad")
Dim UUIDRow As String = gvRow.DataKey("UUIDRow")
Dim FechaCaducidad As Date = If(TxtFechaCaducidad.Text.ToDate <= MinFecha, MinFecha, TxtFechaCaducidad.Text.ToDate)
For Each dRow As DataRow In TmpDT.Rows
If dRow("UUIDRow").ToString = UUIDRow Then
dRow("Lote") = TxtLote.Text
dRow("FechaCaducidad") = FechaCaducidad
End If
Next
For Each dRow As DataRow In DtInv.Rows
If dRow("UUIDRow").ToString = UUIDRow Then
dRow("Lote") = TxtLote.Text
dRow("FechaCaducidad") = FechaCaducidad
End If
Next
Next
End Sub
Private Sub CargaFletesAgregados()
CreaDTServicios()
BtnFiltrar_Click(Nothing, Nothing)
@@ -11001,6 +11183,20 @@ Partial Class Compras_Compras
If e.Row.RowType = DataControlRowType.DataRow Then
Dim CvePS As Integer = e.Row.DataKey("CvePS").ToEntero
Dim AplicaLote As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
Dim AplicaCaducidad As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
If AplicaLote Then
e.Row.FCTextBox("TxtLote").Visible = True
End If
If AplicaCaducidad Then
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
DvFechaCaducidad.Visible = True
End If
If UsuarioActual.Empresa.UsaAC Then e.Row.FCCheckBox("cbInv").Enabled = False
Dim StrTipo As String = "CveTipoAlmacen IN (1,2,7,14,19)"
@@ -13245,8 +13441,8 @@ Partial Class Compras_Compras
If ChkConsignacion.Checked Then
'LiConsignacion.Visible = True
GvInv.Columns(7).Visible = True
GvInv.Columns(8).Visible = True
GvInv.Columns(9).Visible = True
GvInv.Columns(10).Visible = True
CargaConsignaciones2()
CargaGvInv()
@@ -13259,8 +13455,8 @@ Partial Class Compras_Compras
BtnGuardar.Enabled = False
UpFacturar.Update()
Else
GvInv.Columns(7).Visible = False
GvInv.Columns(8).Visible = False
GvInv.Columns(9).Visible = False
GvInv.Columns(10).Visible = False
'LiConsignacion.Visible = False
CveConsignacion = -1
@@ -14164,6 +14360,20 @@ Partial Class Compras_Compras
End If
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
If ObjInventario.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
tbmovs = ObjInventario.DtResultados
@@ -21641,6 +21851,8 @@ Partial Class Compras_Compras
End Class
@@ -22165,6 +22377,21 @@ Public Class ClsCompraManagerCompras
If Not TmpDT.Columns.Contains("Amortizacion") Then
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows
@@ -22411,6 +22638,13 @@ Public Class ClsCompraManagerCompras
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDT.Columns.Add("Lote", GetType(String))
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
TmpDT.AcceptChanges()

View File

@@ -1707,7 +1707,12 @@ Partial Class Compras_eFacturas
If File.Exists(PDfDestino) Then
File.Delete(PDfDestino)
End If
Try
File.Move(RutaPDF, PDfDestino)
Catch ex As Exception
End Try
End If
End If

View File

@@ -1,5 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSet3">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>74f8a171-24f1-4404-809e-ec2e098f1907</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSet3</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Codigo">
<DataField>Codigo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PS">
<DataField>PS</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SerieLote">
<DataField>SerieLote</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Serie">
<DataField>Serie</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="CantidadAlmacen">
<DataField>CantidadAlmacen</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CantidadInventarioFisico">
<DataField>CantidadInventarioFisico</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Diferencia">
<DataField>Diferencia</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CodigoBarras">
<DataField>CodigoBarras</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Costo">
<DataField>Costo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet3</rd:DataSetName>
<rd:SchemaPath>C:\Users\jesus\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DataSet3.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
<DataSet Name="DataSet2">
<Query>
<DataSourceName>DataSet3</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Codigo">
<DataField>Codigo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PS">
<DataField>PS</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SerieLote">
<DataField>SerieLote</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Serie">
<DataField>Serie</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="CantidadAlmacen">
<DataField>CantidadAlmacen</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CantidadInventarioFisico">
<DataField>CantidadInventarioFisico</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Diferencia">
<DataField>Diferencia</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CodigoBarras">
<DataField>CodigoBarras</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Costo">
<DataField>Costo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet3</rd:DataSetName>
<rd:SchemaPath>C:\Users\jesus\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DataSet3.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body>
<ReportItems>
<Tablix Name="Tablix1">
@@ -2032,7 +2150,6 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
@@ -2601,7 +2718,7 @@
<PageBreak>
<BreakLocation>Start</BreakLocation>
</PageBreak>
<Top>8.22822cm</Top>
<Top>6.69364cm</Top>
<Left>0.127cm</Left>
<Height>2.03228cm</Height>
<Width>20.719cm</Width>
@@ -3138,8 +3255,176 @@
</Border>
</Style>
</Line>
<Line Name="Line4">
<Top>9.83932cm</Top>
<Left>3.1825cm</Left>
<Height>0cm</Height>
<Width>6.45808cm</Width>
<ZIndex>8</ZIndex>
<Style>
<Border>
<Style>Solid</Style>
</Border>
</Style>
</Line>
<Line Name="Line5">
<Top>9.83932cm</Top>
<Left>12.32283cm</Left>
<Height>0cm</Height>
<Width>6.37656cm</Width>
<ZIndex>9</ZIndex>
<Style>
<Border>
<Style>Solid</Style>
</Border>
</Style>
</Line>
<Textbox Name="Firma1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!Firma1.Value</Value>
<Style>
<FontSize>9pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Firma1</rd:DefaultName>
<Top>9.8746cm</Top>
<Left>3.1825cm</Left>
<Height>0.5cm</Height>
<Width>6.45808cm</Width>
<ZIndex>10</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Firma2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!Firma2.Value</Value>
<Style>
<FontSize>9pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Firma2</rd:DefaultName>
<Top>9.90988cm</Top>
<Left>12.32283cm</Left>
<Height>0.5cm</Height>
<Width>6.45808cm</Width>
<ZIndex>11</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Textbox71">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Encargado de almacén</Value>
<Style>
<FontStyle>Normal</FontStyle>
<FontSize>9pt</FontSize>
<FontWeight>Normal</FontWeight>
<TextDecoration>None</TextDecoration>
<Color>#000000</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox71</rd:DefaultName>
<Top>10.44257cm</Top>
<Left>3.1825cm</Left>
<Height>0.5cm</Height>
<Width>6.45808cm</Width>
<ZIndex>12</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Textbox72">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Almacén Administrativo</Value>
<Style>
<FontStyle>Normal</FontStyle>
<FontSize>9pt</FontSize>
<FontWeight>Normal</FontWeight>
<TextDecoration>None</TextDecoration>
<Color>#000000</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox71</rd:DefaultName>
<Top>10.44257cm</Top>
<Left>12.32283cm</Left>
<Height>0.5cm</Height>
<Width>6.45808cm</Width>
<ZIndex>13</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Height>4.03957in</Height>
<Height>4.33124in</Height>
<Style>
<Border>
<Style>None</Style>
@@ -3360,122 +3645,8 @@
<ColumnSpacing>0.13cm</ColumnSpacing>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSet3">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>74f8a171-24f1-4404-809e-ec2e098f1907</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSet3</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Codigo">
<DataField>Codigo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PS">
<DataField>PS</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SerieLote">
<DataField>SerieLote</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Serie">
<DataField>Serie</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="CantidadAlmacen">
<DataField>CantidadAlmacen</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CantidadInventarioFisico">
<DataField>CantidadInventarioFisico</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Diferencia">
<DataField>Diferencia</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CodigoBarras">
<DataField>CodigoBarras</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Costo">
<DataField>Costo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet3</rd:DataSetName>
<rd:SchemaPath>C:\Users\jesus\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DataSet3.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
<DataSet Name="DataSet2">
<Query>
<DataSourceName>DataSet3</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Codigo">
<DataField>Codigo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PS">
<DataField>PS</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SerieLote">
<DataField>SerieLote</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Serie">
<DataField>Serie</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="CantidadAlmacen">
<DataField>CantidadAlmacen</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CantidadInventarioFisico">
<DataField>CantidadInventarioFisico</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Diferencia">
<DataField>Diferencia</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="CodigoBarras">
<DataField>CodigoBarras</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Costo">
<DataField>Costo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet3</rd:DataSetName>
<rd:SchemaPath>C:\Users\jesus\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DataSet3.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
</DataSets>
</ReportSection>
</ReportSections>
<ReportParameters>
<ReportParameter Name="LogoPath">
<DataType>String</DataType>
@@ -3561,6 +3732,18 @@
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
<ReportParameter Name="Firma1">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
<ReportParameter Name="Firma2">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>2ec96151-d7c1-4609-bfdd-795b02d33b5a</rd:ReportID>

View File

@@ -749,23 +749,17 @@
<asp:HiddenField runat="server" ID="HidRemisionSaldo" Value="-1" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidCveAF" Value="-1" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidCveAFDes" Value="-1" ClientIDMode="Static" />
<div style="display:none!important">
<asp:UpdatePanel runat="server" ID="UPCargaCalendario">
<ContentTemplate>
<asp:Button runat="server" ID="BtnCargaContratoCalendario" OnClick="BtnCargaContratoCalendario_Click" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<%--<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>--%>
<%--<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>--%>
<%--<script src="/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js"></script>--%>
<%--<script src="/Transportes/Gant/dhtmlxgantt.js"></script>--%>
<!-- Essential JS 2 all material theme -->
<%--<link href="Gant/material.css" rel="stylesheet" type="text/css"/>
<!-- Essential JS 2 all script -->
<script src="Gant/ej2.min.js" type="text/javascript"></script>--%>
<!-- Librería principal de amCharts 4 -->
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
@@ -780,39 +774,7 @@
<script src="https://cdn.amcharts.com/lib/4/lang/es_ES.js"></script>
<script>
// Create root element
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
//var root = am5.Root.new("chartdiv");
var am5locales_es_ES = {
"Jan": "Enero",
"Feb": "Febrero",
"Mar": "Marzo",
"Apr": "Abril",
"May": "Mayo",
"Jun": "Junio",
"Jul": "Julio",
"Aug": "Agosto",
"Sep": "Septiembre",
"Oct": "Octubre",
"Nov": "Noviembre",
"Dec": "Diciembre",
"January": "Enero",
"February": "Febrero",
"March": "Marzo",
"April": "Abril",
"June": "Junio",
"July": "Julio",
"August": "Agosto",
"September": "Septiembre",
"October": "Octubre",
"November": "Noviembre",
"December": "Diciembre",
};
let dateAxis;
let yAxis;
var chartHeader;
var chartBody;
@@ -834,6 +796,7 @@
// Convertir valores a objetos Date
let minDate = new Date(fechaI.split("/").reverse().join("-"));
let maxDate = new Date(fechaF.split("/").reverse().join("-"));
maxDate.setDate(maxDate.getDate() + 1);
maxDate.setHours(23, 59, 59, 999);
// Crear instancia del gráfico del encabezado
@@ -856,11 +819,11 @@
// Crear eje X (DateAxis) para el encabezado
var xAxisHeader = chartHeader.xAxes.push(new am4charts.DateAxis());
//xAxisHeader.baseInterval = { timeUnit: "hour", count: 1 };
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 }; // Cambiado a "day"
xAxisHeader.minPeriod = "day"; // Añadido
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 };
xAxisHeader.minPeriod = "day";
xAxisHeader.min = minDate.getTime();
xAxisHeader.max = maxDate.getTime();
xAxisHeader.renderer.opposite = false; // Cambiado a false
xAxisHeader.renderer.opposite = false;
xAxisHeader.renderer.minGridDistance = 1; // Ajusta según sea necesario para evitar superposición
xAxisHeader.renderer.minorGridEnabled = false;
xAxisHeader.markUnitChange = false;
@@ -880,11 +843,26 @@
xAxisHeader.renderer.labels.template.fontWeight = "bold";
// Formatear las etiquetas de fecha
xAxisHeader.dateFormatter.dateFormat = "dd/MM";
//xAxisHeader.dateFormats.setKey("day", "dd/MM"); // Añadido
xAxisHeader.periodChangeDateFormats.setKey("day", "dd/MM"); // Asegurado
xAxisHeader.periodChangeDateFormats.setKey("month", "MMMM"); // Opcional, si deseas mostrar meses
xAxisHeader.dateFormatter.dateFormat = "dd";
xAxisHeader.markUnitChange = false;
xAxisHeader.periodChangeDateFormats.setKey("day", "dd");
xAxisHeader.periodChangeDateFormats.setKey("month", "dd");
xAxisHeader.periodChangeDateFormats.setKey("year", "dd");
// Personalizar las etiquetas del eje X
xAxisHeader.renderer.labels.template.adapter.add("text", function (text, target) {
if (target.dataItem && target.dataItem.date) {
var date = target.dataItem.date;
var numberFormatter = new am4core.NumberFormatter();
return numberFormatter.format(date.getDate(), "00");
} else {
return text;
}
});
// Desactivar marcas y rellenos de cambio de periodo
xAxisHeader.renderer.ticks.template.disabled = true;
xAxisHeader.renderer.axisFills.template.disabled = true;
// Crear eje Y (ValueAxis) para el encabezado (dummy)
@@ -893,18 +871,18 @@
yAxisHeader.renderer.grid.template.disabled = true;
// Asignar datos al gráfico del encabezado
// Creamos datos dummy con fechas mínimas y máximas
// Creamos datos con fechas mínimas y máximas
chartHeader.data = [
{ date: minDate, value: 0 },
{ date: maxDate, value: 0 }
];
// Añadir una serie dummy para que el eje X se renderice correctamente
// Añadir una serie para que el eje X se renderice correctamente
var seriesHeader = chartHeader.series.push(new am4charts.LineSeries());
seriesHeader.dataFields.dateX = "date";
seriesHeader.dataFields.valueY = "value";
seriesHeader.strokeOpacity = 0; // Hacemos la línea invisible
seriesHeader.fillOpacity = 0;
seriesHeader.strokeOpacity = 1; // Hacemos la línea invisible
seriesHeader.fillOpacity = 1;
// Crear instancia del gráfico principal (cuerpo)
chartBody = am4core.create("chart-body", am4charts.XYChart);
@@ -959,8 +937,9 @@
// Deshabilitar las etiquetas y grids del eje X en el gráfico principal
xAxisBody.renderer.labels.template.disabled = true;
xAxisBody.renderer.grid.template.disabled = true;
// visibilzar grid
xAxisBody.renderer.grid.template.disabled = false;
xAxisBody.renderer.labels.template.forceShow = true;
// Añadir la serie al gráfico principal
@@ -969,13 +948,14 @@
seriesBody.dataFields.dateX = "toDate";
seriesBody.dataFields.categoryY = "category";
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nDURACIÓN: {fromDate} - {toDate}";
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nCLIENTE: {cliente}\nDURACIÓN: {fromDate} - {toDate}";
seriesBody.columns.template.strokeOpacity = 0;
// Asignar colores a las columnas basado en el campo 'color' de los datos
seriesBody.columns.template.propertyFields.fill = "color";
seriesBody.columns.template.propertyFields.stroke = "color";
var labelBullet = seriesBody.bullets.push(new am4charts.LabelBullet());
labelBullet.label.text = "{contrato}";
labelBullet.locationX = 0.5;
@@ -1015,10 +995,23 @@
yAxisBody.zoom({ start: 0, end: 1 });
});
// Animaciones al cargar
seriesBody.appear();
chartBody.appear(1000, 100);
chartBody.events.on("datavalidated", function () {
//chartHeader.paddingLeft = yAxisBody.renderer.pixelWidth;
chartHeader.paddingLeft = 50;
//alert(chartBody.yAxes.getIndex(0).renderer.pixelWidth);
chartHeader.validateLayout();
});
}
function cargaDiagramaGrant(data, categorias, TipoVista) {
@@ -1245,195 +1238,6 @@
<%--function cargaDiagramaGrant(data, categorias, TipoVista) {
am5.ready(function () {
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
root.container.children.clear();
root.dateFormatter.setAll({
dateFormat: "dd/MM/yyyy HH:mm",
dateFields: ["valueX", "openValueX"]
});
root.locale = am5locales_es_ES;
// Set themes
// https://www.amcharts.com/docs/v5/concepts/themes/
root.setThemes([
am5themes_Animated.new(root)
]);
// Create chart
// https://www.amcharts.com/docs/v5/charts/xy-chart/
var chart = root.container.children.push(am5xy.XYChart.new(root, {
panX: false,
panY: false,
wheelX: "none",
wheelY: "none",
layout: root.verticalLayout,
paddingLeft: 0
}));
// Add legend
// https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/
var legend = chart.children.push(am5.Legend.new(root, {
centerX: am5.p50,
x: am5.p50
}))
var colors = chart.get("colors");
// Create axes
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
var yAxis = chart.yAxes.push(
am5xy.CategoryAxis.new(root, {
categoryField: "category",
renderer: am5xy.AxisRendererY.new(root, {
inversed: true,
minorGridEnabled: true
}),
tooltip: am5.Tooltip.new(root, {
themeTags: ["axis"],
animationDuration: 200
})
})
);
yAxis.data.setAll(categorias);
// Obtener valores de las cajas de texto
var fechaI = document.getElementById('<%= txtFechaI.ClientID %>').value;
var fechaF = document.getElementById('<%= txtFechaF.ClientID %>').value;
// Convertir valores a objetos Date
var minDate = new Date(fechaI.split("/").reverse().join("-"));
var maxDate = new Date(fechaF.split("/").reverse().join("-"));
var xAxis = chart.xAxes.push(
am5xy.DateAxis.new(root, {
baseInterval: { timeUnit: "day", count: 1 },
renderer: am5xy.AxisRendererX.new(root, {
opposite: true,
minorGridEnabled: true,
minGridDistance: 30 // Ajusta según sea necesario
}),
min: minDate.getTime(),
max: maxDate.getTime(),
groupData: false,
markUnitChange: false
})
);
// Asegurar que todas las etiquetas se muestren
xAxis.get("renderer").labels.template.setAll({
forceHidden: false,
minPosition: 0.001,
maxPosition: 0.999,
location: 0.5 // Centra las etiquetas
});
// Formatear las etiquetas de fecha
xAxis.get("renderer").labels.template.adapters.add("text", function (text, target) {
var dataItem = target.dataItem;
if (dataItem) {
var value = dataItem.get('value');
var date = new Date(value);
var day = date.getDate().toString().padStart(2, '0');
var month = (date.getMonth() + 1).toString().padStart(2, '0');
return day + '/' + month;
} else {
return text; // O puedes devolver una cadena vacía: return '';
}
});
//chart.topAxesContainer.children.push(dateAxis);
// Add series
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
var series = chart.series.push(am5xy.ColumnSeries.new(root, {
xAxis: xAxis,
yAxis: yAxis,
openValueXField: "fromDate",
valueXField: "toDate",
categoryYField: "category",
sequencedInterpolation: true
}));
series.columns.template.setAll({
templateField: "columnSettings",
strokeOpacity: 0,
tooltipText: "UNIDAD: {category}-{unidad} \nCONTRATO: {contrato} \nDURACIÓN: {openValueX} - {valueX}"
});
series.data.processor = am5.DataProcessor.new(root, {
dateFields: ["fromDate", "toDate"],
dateFormat: "yyyy-MM-dd HH:mm"
});
series.data.setAll(data);
// Scrollbar X
var scrollbarX = am5.Scrollbar.new(root, {
orientation: "horizontal"
});
var scrollbarY = am5.Scrollbar.new(root, {
orientation: "vertical"
});
chart.set("scrollbarX", scrollbarX);
chart.bottomAxesContainer.children.push(scrollbarX);
chart.set("scrollbarY", scrollbarY);
//MOSTRAR MODAL DE CONTRATO AL HACER CLICK
series.columns.template.events.on("click", e => {
let cveContrato = e.target.dataItem.dataContext.cveContrato;
$('#<%=HdnCveContrato.ClientID%>').val(cveContrato);
let url = '/Ashx/CargaEventos.ashx?METODO=contrato_transportes';
let parametros = '&cveContrato=' + cveContrato + '&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E=' + '<%= UsuarioActual.CveEmpresa %>' + '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val(); + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
fetch(url + parametros).then(response => response.json()).then(json => {
updateEvent(json[0], null, false);
}).catch(err => console.log('Solicitud fallida', err));
});
series.events.on("datavalidated", function (ev) {
let cellSize = 45;
if (TipoVista == 1) {
cellSize = 60;
}
//let series = ev.target;
//let chart = series.chart;
let xAxis = chart.xAxes.getIndex(0);
// Calculate how we need to adjust chart height
let chartHeight = categorias.length * cellSize + xAxis.height() + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0);
// Set it on chart's container
chart.root.dom.style.height = chartHeight + "px";
// ev.target.get("xAxis").zoomToValues(new Date(2024,6,15).getTime(), new Date(2024,6,20).getTime());
});
// Make stuff animate on load
// https://www.amcharts.com/docs/v5/concepts/animations/
series.appear();
chart.appear(1000, 100);
}); // end am5.ready()
}--%>
var PrimeraCargaCalendario = true;
var currentUpdateEvent;
@@ -1459,73 +1263,10 @@
function updateEvent(event, element, esCalendario = true) {
$('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros);
$('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato);
$('#<%=TxtObservaciones.ClientID%>').val(event.Observaciones);
$('#<%=TxtDescripcion.ClientID%>').val(event.description);
$('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento);
if (esCalendario) {
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i));
} else {
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start));
}
$('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal));
$('#<%=DdlClientes.ClientID%>').val(event.CveCliente);
$('#<%=DdlChofer.ClientID%>').val(event.CvePersonal);
if (event.CvePersonal2 > 0) {
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', true);
setTimeout(function () { $('#<%=DdlChofer2.ClientID%>').val(event.CvePersonal2).change(); }, 500);;
;
} else {
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', false);
$('#<%=DdlChofer2.ClientID%>').val(-1);
}
$('#<%=DdlEstatusContrato.ClientID%>').val(event.CveEventoEstatus);
$('#<%=TxtDolares.ClientID%>').val(event.Dolares);
$('#<%=TxtPesos.ClientID%>').val(event.Pesos);
$('#<%=TxtMoneda.ClientID%>').val(event.Moneda);
$('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo);
$('#<%=HdnCveContrato.ClientID%>').val(event.id);
$('#<%=DdlTipoAF.ClientID%>').val(event.CveTipoAF);
$('#<%=DdlSubProyectoModal.ClientID%>').val(event.CveSubProyecto);
$('#BtnCargaContratoCalendario').click();
$('#<%= HidCveTipoAF.ClientID%>').val($('#<%=TxtAnticipo.ClientID%>').val());
<%--$('#<%=BtnDdlTipoAF.ClientID%>').click();--%>
<%--$('#<%=DdlAF.ClientID%>').val(event.CveActivoFijo);--%>
$('#HidNumChoferes').val(event.NumChoferes);
$('#HidRemisionSerieFolio').val(event.RemisionSerieFolio);
$('#HidCveVentaRemision').val(event.CveVentaRemision);
$('#HidRemisionSaldo').val(event.RemisionSaldo);
$('#HdnNumContrato').val(event.NumeroContrato);
if (event.CveActivoFijo > 0) {
$('#HidCveAF').val(event.CveActivoFijo);
} else {
$('#HidCveAF').val('-1');
}
if (event.NombreComercial !== null) {
$('#HidModClienteNombre').val('');
} else {
$('#HidModClienteNombre').val(event.NombreComercial);
}
$('#HidModCveCliente').val(event.CveCliente);
$('#<%=HdnCveContrato.ClientID%>').click();
$('#<%=BtnModal.ClientID%>').click();
}

View File

@@ -245,7 +245,8 @@ Partial Class RepContratosCalendario
strData.AppendLine($"color: am4core.color('" & String.Format("#{0:X6}", random.Next(16777216)) & "'),")
strData.AppendLine($"cveContrato: {Row("CveContrato").ToString.ToEntero},")
strData.AppendLine($"contrato: '{Row("NumeroContrato").ToString}',")
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}'")
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}',")
strData.AppendLine($"cliente: '{Row("NombreComercial").ToString.Replace("'", "")}'")
strData.AppendLine("},")
@@ -564,6 +565,82 @@ Partial Class RepContratosCalendario
End If
End Sub
Protected Sub BtnCargaContratoCalendario_Click(sender As Object, e As EventArgs)
Dim CveContratoConsulta As Integer = HdnCveContrato.Value.ToEntero
If CveContratoConsulta > 0 Then
Dim Objcontrato As New ClsContratos
If Objcontrato.GetContratos(CveContratoConsulta, UsuarioActual.CveEmpresa) AndAlso Objcontrato.DtResultados.Rows.Count > 0 Then
Dim DRow As DataRow
DRow = Objcontrato.DtResultados.Rows(0)
'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim NumChoferes As Integer = DRow("NumChoferes").ToString.ToEntero
TxtFolio.Text = DRow("NumeroContrato").ToString
TxtCantidadPasajeros.Text = DRow("CantidadPasajeros").ToString
DdlClientes.SelectedValue = DRow("CveCliente").ToString
DdlClientes.SelectedText = DRow("NombreComercial").ToString
TxtDescripcion.Text = DRow("DescripcionContrato").ToString
TxtObservaciones.Text = DRow("Observaciones").ToString
TxtUbicacion.Text = DRow("Ubicacion").ToString
TxtFechaSalida.Text = Convert.ToDateTime(DRow("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss")
TxtFechaRegreso.Text = Convert.ToDateTime(DRow("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ")
TxtMoneda.Text = DRow("Moneda").ToString
'Requeridos
DdlChofer.SelectedValueExist(DRow("CveChofer").ToString)
DdlChofer2.SelectedValueExist(DRow("CveChofer2").ToString)
chkSegundoChofer.Checked = If(NumChoferes = 2, True, False)
DdlEstatusContrato.SelectedValueExist(DRow("CveContratosEstatus").ToString)
DdlSubProyectoModal.SelectedValueExist(DRow("CveSubProyecto").ToString)
DdlTipoAF.SelectedValueExist(DRow("CveTipoAF").ToString)
DdlTipoAF_SelectedIndexChanged(Nothing, Nothing)
DdlAF.SelectedValueExist(DRow("CveAF").ToString)
HidCveAF.Value = "-1"
HidCveAFDes.Value = ""
If DRow("CveAF").ToString.ToEntero > 0 Then
HidCveAF.Value = DRow("CveAF").ToString.ToString
HidCveAFDes.Value = DdlAF.SelectedItem.Text
End If
TxtMotivoCambioUnidad.Text = ""
DVMotivoCambioAF.Visible = False
HypRemision.Text = DRow("RemisionSerieFolio").ToString
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={DRow("CveVentaRemision").ToString}"
If DRow("RemisionSaldo").ToString.ToDecimal > 0 Then
LblSaldo.Text = $"Saldo {DRow("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
Else
LblSaldo.Text = ""
End If
CveContrato = CveContratoConsulta
OcultarMostrarSegundoChofer()
UpCommando.Update()
UpModal.Update()
RegistraScript("$('#ModalActualizar').modal('show');")
End If
Objcontrato.Dispose()
Else
Alert("Contrato no especificado", TipoMensaje.MsgAdvertencia)
End If
End Sub
@@ -597,11 +674,11 @@ Partial Class RepContratosCalendario
End If
End If
If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
TieneError = True
End If
End If
'If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
' If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
' TieneError = True
' End If
'End If
If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero,
-1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34,
@@ -718,6 +795,7 @@ Partial Class RepContratosCalendario
UpModal.Update()
myModalLabel.InnerText = "Contrato: " & HdnNumContrato.Value
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub chkSegundoChofer_CheckedChanged(sender As Object, e As EventArgs)
@@ -857,4 +935,6 @@ Partial Class RepContratosCalendario
CargaCronograma(DdlTipoVistaCalendario.SelectedValue.ToEntero)
End Sub
End Class