This commit is contained in:
2022-09-13 04:24:43 -07:00
15 changed files with 10276 additions and 819 deletions

View File

@@ -25,5 +25,6 @@ Public Class CalendarEvent
Public Property EmpresaCRM As String Public Property EmpresaCRM As String
Public Property SubProyecto As String Public Property SubProyecto As String
Public Property CveSubProyecto As Integer Public Property CveSubProyecto As Integer
Public Property Direccion As String
End Class End Class

View File

@@ -1541,9 +1541,10 @@ Public Class ClsOIEventos
Public Function GetEventos(CveEvento As Integer, CveTipoEvento As Integer, CveAgendaTipo As Integer, Asunto As String, Descripcion As String, Prioridad As Integer, CveUsuarioDe As Integer, CveUsuarioPara As Integer, Public Function GetEventos(CveEvento As Integer, CveTipoEvento As Integer, CveAgendaTipo As Integer, Asunto As String, Descripcion As String, Prioridad As Integer, CveUsuarioDe As Integer, CveUsuarioPara As Integer,
CveEventoEstatus As Integer, CveRevision As Integer, CveEventoPadre As Integer, Acuerdos As String, CveActivoFijo As Integer, CveIE As Integer, CveProspecto As Integer, CveCliente As Integer, CveEventoEstatus As Integer, CveRevision As Integer, CveEventoPadre As Integer, Acuerdos As String, CveActivoFijo As Integer, CveIE As Integer, CveProspecto As Integer, CveCliente As Integer,
CveOS As Integer, CveOC As Integer, CvePersonal As Integer, CveProveedor As Integer, CveCompra As Integer, CveVenta As Integer, CveUsuario As Integer, CveUsuarioIng As Integer, CveUsuarioConsulta As Integer, CveEmpresa As Integer, Optional FechaInicio As Nullable(Of DateTime) = Nothing, CveOS As Integer, CveOC As Integer, CvePersonal As Integer, CveProveedor As Integer, CveCompra As Integer, CveVenta As Integer, CveUsuario As Integer, CveUsuarioIng As Integer, CveUsuarioConsulta As Integer,
Optional FechaFin As Nullable(Of DateTime) = Nothing, Optional FechaRealTermino As Nullable(Of DateTime) = Nothing, Optional CveContrato As Integer = -1, Optional CveMovimientoAlmacen As Integer = -1, CveEmpresa As Integer, Optional FechaInicio As Nullable(Of DateTime) = Nothing, Optional FechaFin As Nullable(Of DateTime) = Nothing, Optional FechaRealTermino As Nullable(Of DateTime) = Nothing,
Optional CveEmpresaCRM As Integer = -1, Optional CveContactoCRM As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional CveTipoProcesoCRM As Integer = -1, Optional CveEtapaProcesoCRM As Integer = -1) As Boolean Optional CveContrato As Integer = -1, Optional CveMovimientoAlmacen As Integer = -1, Optional CveEmpresaCRM As Integer = -1, Optional CveContactoCRM As Integer = -1, Optional CveAcercamientoCRM As Integer = -1,
Optional CveTipoProcesoCRM As Integer = -1, Optional CveEtapaProcesoCRM As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OI_EventosGet") DataAdapter("PA_OI_EventosGet")
@@ -1593,6 +1594,8 @@ Public Class ClsOIEventos
.Add("@CveTipoProcesoCRM", SqlDbType.Int).Value = CveTipoProcesoCRM .Add("@CveTipoProcesoCRM", SqlDbType.Int).Value = CveTipoProcesoCRM
.Add("@CveEtapaProcesoCRM", SqlDbType.Int).Value = CveEtapaProcesoCRM .Add("@CveEtapaProcesoCRM", SqlDbType.Int).Value = CveEtapaProcesoCRM
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
End With End With
Try Try

View File

@@ -568,7 +568,8 @@ Public Class ClsOS
Return Retorno Return Retorno
End Function End Function
Public Function AddOrdenesServicios(CveCliente As Integer, CveSubProyecto As Integer, PersonaSolicito As String, FechaRecepcion As Date, Descripcion As String, CveUsuarioRecibio As Integer, CveEstatusOrdenServicio As Integer, Public Function AddOrdenesServicios(CveCliente As Integer, CveSubProyecto As Integer, PersonaSolicito As String, FechaRecepcion As Date, Descripcion As String, CveUsuarioRecibio As Integer, CveEstatusOrdenServicio As Integer,
CveUsuario As Integer, CveEmpresa As Integer, CveCotizacion As Integer, CveVenta As Integer, CveOSPadre As Integer, CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1) As Boolean CveUsuario As Integer, CveEmpresa As Integer, CveCotizacion As Integer, CveVenta As Integer, CveOSPadre As Integer, CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1,
Optional Direccion As String = "-1") As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OS_OrdenesServiciosAdd") DataAdapter("PA_OS_OrdenesServiciosAdd")
@@ -588,6 +589,8 @@ Public Class ClsOS
.Add("@CveOSPadre", SqlDbType.Int).Value = CveOSPadre .Add("@CveOSPadre", SqlDbType.Int).Value = CveOSPadre
.Add("@CveOSTipo", SqlDbType.Int).Value = CveOSTipo .Add("@CveOSTipo", SqlDbType.Int).Value = CveOSTipo
.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal
.Add("@Direccion", SqlDbType.VarChar).Value = Direccion
.Add("@CveOS", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@CveOS", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output
End With End With
@@ -629,7 +632,8 @@ Public Class ClsOS
Return Retorno Return Retorno
End Function End Function
Public Function UpdateOrdenesServicios(PersonaSolicito As String, FechaRecepcion As String, Descripcion As String, CveUsuarioRecibio As Integer, CveEstatusOrdenServicio As Integer, CveOS As Integer, CveUsuarioModifico As Integer, CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1) As Boolean Public Function UpdateOrdenesServicios(PersonaSolicito As String, FechaRecepcion As String, Descripcion As String, CveUsuarioRecibio As Integer, CveEstatusOrdenServicio As Integer, CveOS As Integer, CveUsuarioModifico As Integer,
CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1, Optional Direccion As String = "-1") As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OS_OrdenesServiciosUpdate") DataAdapter("PA_OS_OrdenesServiciosUpdate")
@@ -644,6 +648,7 @@ Public Class ClsOS
.Add("@CveOSTipo", SqlDbType.Int).Value = CveOSTipo .Add("@CveOSTipo", SqlDbType.Int).Value = CveOSTipo
.Add("@CveOS", SqlDbType.Int).Value = CveOS .Add("@CveOS", SqlDbType.Int).Value = CveOS
.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal
.Add("@Direccion", SqlDbType.VarChar).Value = Direccion
End With End With
Try Try

View File

@@ -9256,7 +9256,7 @@ Public Class ClsPaginas
Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim Ruta As String = UsuarioActual.Empresa.Ruta
Dim PathXML As String = $"{Ruta}XML\Pag\{Serie}-{Folio}.xml" Dim PathXML As String = $"{Ruta}XML\Pag\{Serie}-{Folio}.xml"
Dim PathPDF As String = $"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf" Dim PathPDF As String = $"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf"
Dim ImagenCBB As String = $"file://{Ruta}CBB\{Serie}-{Folio}.jpg" Dim ImagenCBB As String = $"{Ruta}CBB\{Serie}-{Folio}.jpg"
If File.Exists(PathXML) Then If File.Exists(PathXML) Then
Dim XmlDoc As New System.Xml.XmlDocument Dim XmlDoc As New System.Xml.XmlDocument
@@ -9441,6 +9441,12 @@ Public Class ClsPaginas
Dim CadenaOriginal As String = $"||1.0| {FolioFiscal} | {FechaCertificacion.ToDate.ToShortDateString} T {FechaCertificacion.ToDateTime.ToShortTimeString} | {SelloCFDi} | {NoSerieCertificado} ||" Dim CadenaOriginal As String = $"||1.0| {FolioFiscal} | {FechaCertificacion.ToDate.ToShortDateString} T {FechaCertificacion.ToDateTime.ToShortTimeString} | {SelloCFDi} | {NoSerieCertificado} ||"
If Not File.Exists(ImagenCBB) AndAlso FolioFiscal <> "" Then
Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCOrdenante, 1, FolioFiscal, ImagenCBB)
End If
' PARAMETROS DEL REPORTE ' PARAMETROS DEL REPORTE
params.Add(New ReportParameter("SerieFolio", SerieFolio)) params.Add(New ReportParameter("SerieFolio", SerieFolio))
params.Add(New ReportParameter("RFCOrdenante", RFCOrdenante)) params.Add(New ReportParameter("RFCOrdenante", RFCOrdenante))
@@ -9461,7 +9467,7 @@ Public Class ClsPaginas
params.Add(New ReportParameter("SelloSAT", SelloSAT)) params.Add(New ReportParameter("SelloSAT", SelloSAT))
params.Add(New ReportParameter("CadenaOriginal", CadenaOriginal)) params.Add(New ReportParameter("CadenaOriginal", CadenaOriginal))
params.Add(New ReportParameter("CertificadoSAT", CertificadoSAT)) params.Add(New ReportParameter("CertificadoSAT", CertificadoSAT))
params.Add(New ReportParameter("QR", ImagenCBB)) params.Add(New ReportParameter("QR", $"file://{ImagenCBB}"))
Dim lrds As New List(Of ReportDataSource) Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = If(DTConceptosPago IsNot Nothing, DTConceptosPago, New DataTable)} Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = If(DTConceptosPago IsNot Nothing, DTConceptosPago, New DataTable)}

View File

@@ -31,10 +31,15 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
CveUsuario = context.Request("U").ToEntero CveUsuario = context.Request("U").ToEntero
CveEmpresa = context.Request("E").ToEntero CveEmpresa = context.Request("E").ToEntero
Dim CveSubProyecto As Integer = If(context.Request("CveSubProyecto") IsNot Nothing, context.Request("CveSubProyecto").ToEntero, -1)
Dim CveUsuarioPara As Integer = If(context.Request("CveUsuarioPara") IsNot Nothing, context.Request("CveUsuarioPara").ToEntero, -1)
FI = context.Request("start").ToDate FI = context.Request("start").ToDate
FF = context.Request("end").ToDate FF = context.Request("end").ToDate
If Not GetEventos(CveUsuario, CveEmpresa, FI, FF, CveOS:=-2) Then If Not GetEventos(CveUsuario, CveEmpresa, FI, FF, CveOS:=-2, CveUsuarioPara:=CveUsuarioPara, CveSubProyecto:=CveSubProyecto) Then
'Convierte el objeto de Eventos en JSON 'Convierte el objeto de Eventos en JSON
'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer
Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events)
@@ -85,11 +90,11 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
End Property End Property
Private Function GetEventos(CveUsuario As Integer, CveEmpresa As Integer, pFI As Date, pFF As Date, Optional CveOS As Integer = -1) As Boolean Private Function GetEventos(CveUsuario As Integer, CveEmpresa As Integer, pFI As Date, pFF As Date, Optional CveOS As Integer = -1, Optional CveUsuarioPara As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean
Dim ObjEventos As New ClsOIEventos Dim ObjEventos As New ClsOIEventos
Dim ErrorEventos = False Dim ErrorEventos = False
Dim CveEmpresaCRM As Integer = 0 Dim CveEmpresaCRM As Integer = 0
If ObjEventos.GetEventos(-1, -1, -1, "-1", "-1", -1, CveUsuario, CveUsuario, -1, -1, -1, "-1", -1, -1, -1, -1, CveOS, -1, -1, -1, -1, -1, CveUsuario, CveUsuario, CveUsuario, CveEmpresa, pFI, pFF) Then If ObjEventos.GetEventos(-1, -1, -1, "-1", "-1", -1, CveUsuario, CveUsuarioPara, -1, -1, -1, "-1", -1, -1, -1, -1, CveOS, -1, -1, -1, -1, -1, CveUsuario, CveUsuario, CveUsuario, CveEmpresa, pFI, pFF, CveSubProyecto:=CveSubProyecto) Then
If ObjEventos.DtResultados.Rows.Count > 0 Then If ObjEventos.DtResultados.Rows.Count > 0 Then
events = New List(Of CalendarEvent) events = New List(Of CalendarEvent)
@@ -119,6 +124,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
cevent.EmpresaCRM = dr("EmpresaCRM").ToString cevent.EmpresaCRM = dr("EmpresaCRM").ToString
cevent.SubProyecto = dr("SubProyecto").ToString cevent.SubProyecto = dr("SubProyecto").ToString
cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
cevent.Direccion = dr("Direccion").ToString
'11/05/2018 - Evento Gasto Recurrente '11/05/2018 - Evento Gasto Recurrente
cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero

View File

@@ -882,9 +882,6 @@
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
@@ -910,18 +907,12 @@
<HeaderTemplate>Anticipo/NC</HeaderTemplate> <HeaderTemplate>Anticipo/NC</HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Importe", "{0:N2}") %>'></asp:Literal>&nbsp; <asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Importe", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate>Mon</HeaderTemplate> <HeaderTemplate>Mon</HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlMoneda" runat="server" Text='<%# Eval("Moneda") %>'></asp:Literal>&nbsp; <asp:Literal ID="LtlMoneda" runat="server" Text='<%# Eval("Moneda") %>'></asp:Literal>&nbsp;
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField Visible="False"> <asp:TemplateField Visible="False">
@@ -2842,18 +2833,24 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-3">
<label class="col-md-6"><b>Saldo Factura: </b></label> <label class="col-md-6"><b>Saldo Factura: </b></label>
<div class="col-md-6"> <div class="col-md-6">
<asp:Label ID="LblSaldoFactura" ClientIDMode="Static" runat="server"></asp:Label> <asp:Label ID="LblSaldoFactura" ClientIDMode="Static" runat="server"></asp:Label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-3">
<label class="col-md-6"><b>Aplicado: </b></label> <label class="col-md-6"><b>Aplicado: </b></label>
<div class="col-md-6"> <div class="col-md-6">
<asp:Label ID="LblAplicadoCompraAnt" ClientIDMode="Static" Text="0.00" runat="server"></asp:Label> <asp:Label ID="LblAplicadoCompraAnt" ClientIDMode="Static" Text="0.00" runat="server"></asp:Label>
</div> </div>
</div> </div>
<div class="col-md-3" runat="server" id="DVAntComiciones" visible="false">
<label class="col-md-6"><b>Comisión: </b></label>
<div class="col-md-6">
<asp:Label ID="LblAplicadoCompraAntComision" ClientIDMode="Static" Text="0.00" runat="server"></asp:Label>
</div>
</div>
<br /> <br />
</div> </div>
<div class="row"> <div class="row">
@@ -2912,6 +2909,13 @@
<ajax:FilteredTextBoxExtender ID="SoloNumeros2" runat="server" TargetControlID="TxtAnticipo" ValidChars="." FilterType="Custom, Numbers" /> <ajax:FilteredTextBoxExtender ID="SoloNumeros2" runat="server" TargetControlID="TxtAnticipo" ValidChars="." FilterType="Custom, Numbers" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderText="Comisión" ItemStyle-HorizontalAlign="Right" Visible="false">
<ItemTemplate>
<%--<asp:Label ID="LblTotalAnticipos" runat="server" ClientIDMode="Static" Width="80px" Text="0.00" Visible="false"></asp:Label>--%>
<asp:TextBox ID="TxtComision" runat="server" MaxLength="12" Width="76px" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilTxtComision" runat="server" TargetControlID="TxtComision" ValidChars="-." FilterType="Custom, Numbers" />
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
@@ -5892,22 +5896,46 @@
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2)); $("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2));
$("#LblSaldoFactura").text(FormatoNumero(Total - FnSumaValoresAnt(), 2)); $("#LblAplicadoCompraAntComision").text(FormatoNumero(FnSumaValoresAntComisiones(), 2));
$("#LblSaldoFactura").text(FormatoNumero(TotalSaldo - FnSumaValoresAnt(), 2));
} }
function FnCambiaAnt(chk, txt, saldo, TotalSaldo, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal) { function FnCambiaAnt(chk, txt, saldo, TotalSaldo, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal, txtComision) {
var Total = ToDouble($get('TxtTotal').value); var Total = ToDouble($get('TxtTotal').value);
let txtComisionImporte = 0;
if (txtComision != null) {
if (!isNaN(txtComision.value)) {
txtComisionImporte = ToDouble(txtComision.value);
}
}
var txtvalue = ToDouble(txt.value); var txtvalue = ToDouble(txt.value);
if (CveMonedaAnticipo = 1 && CveMonedaOriginal == 2) {
if (txtComisionImporte != 0 && txtComisionImporte > txtvalue) {
if (txtComision != null) {
txtComision.value = txtvalue;
alert('La comisión no debe de exder la amortización.')
}
return;
}
if (CveMonedaAnticipo == 1 && CveMonedaOriginal == 2) {
txtvalue = ToDouble(txtvalue / TCAnticipo); txtvalue = ToDouble(txtvalue / TCAnticipo);
} else if (CveMonedaAnticipo = 2 && CveMonedaOriginal == 1) { } else if (CveMonedaAnticipo == 2 && CveMonedaOriginal == 1) {
txtvalue = ToDouble(txtvalue * TCAnticipo); txtvalue = ToDouble(txtvalue * TCAnticipo);
} }
var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + ToDouble(txtvalue)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2)); var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + ToDouble(txtvalue)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txtvalue; if (SaldoCompra < 0) txt.value = SaldoCompra - txtvalue;
//minimo entre saldocompra y el saldoanticipo //minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra; if (SaldoCompra < saldo) saldo = SaldoCompra;
@@ -5925,6 +5953,7 @@
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2)); $("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2));
$("#LblAplicadoCompraAntComision").text(FormatoNumero(FnSumaValoresAntComisiones(), 2));
$("#LblSaldoFactura").text(FormatoNumero(TotalSaldo - FnSumaValoresAnt(), 2)); $("#LblSaldoFactura").text(FormatoNumero(TotalSaldo - FnSumaValoresAnt(), 2));
} }
@@ -5941,8 +5970,21 @@
// totalPoints += ToDouble($(this).val()); // totalPoints += ToDouble($(this).val());
//}); //});
let respuesta = Math.round(totalPoints * 100) / 100;
return respuesta
}
return Math.round(totalPoints * 100) / 100; function FnSumaValoresAntComisiones() {
var totalPoints = 0;
var t = '';
$('input[name*=TxtComision]').each(function () {
totalPoints += ToDouble($(this).val());
});
let respuesta = Math.round(totalPoints * 100) / 100;
return respuesta
} }

View File

@@ -566,6 +566,7 @@ Partial Class Compras_Compras
Public Property TipoMovto As String Public Property TipoMovto As String
Public Property CveIE As Integer Public Property CveIE As Integer
Public Property Importe As Decimal Public Property Importe As Decimal
Public Property ImporteComision As Decimal
Public Property TCCompra As Decimal Public Property TCCompra As Decimal
Public Property CvePersonal As Integer Public Property CvePersonal As Integer
@@ -1580,6 +1581,13 @@ Partial Class Compras_Compras
divDevAuto.Visible = True divDevAuto.Visible = True
End If End If
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
GVAnticipos.Columns(6).Visible = True
DVAntComiciones.Visible = True
End If
End If End If
'SE OCUPAN AFUERA DEL POSTBACK ?? 'SE OCUPAN AFUERA DEL POSTBACK ??
@@ -4465,25 +4473,27 @@ Partial Class Compras_Compras
'REGISTRO LOS PRODUCTOS 'REGISTRO LOS PRODUCTOS
If Row("CvePS").ToString.ToEntero = 0 Then If Row("CvePS").ToString.ToEntero = 0 Then
tCve = PSS.AddPS(Row("CveClasificacionActualizar").ToString.ToEntero, -1, Row("CveUM").ToString.ToEntero, "", "", "", Row("PS").ToString, Row("PU").ToString.ToDouble, If(TxtIVA.Text.ToDouble > 0, -1, 0), 0, False, 0, True, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, 0) 'tCve = PSS.AddPS(Row("CveClasificacionActualizar").ToString.ToEntero, -1, Row("CveUM").ToString.ToEntero, "", "", "", Row("PS").ToString, Row("PU").ToString.ToDouble, If(TxtIVA.Text.ToDouble > 0, -1, 0), 0, False, 0, True, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, 0)
If tCve > 0 Then 'If tCve > 0 Then
RegeneraPS = True ' RegeneraPS = True
Row("CvePS") = tCve ' Row("CvePS") = tCve
Row("CveClasificacion") = Row("CveClasificacionActualizar").ToString.ToEntero ' Row("CveClasificacion") = Row("CveClasificacionActualizar").ToString.ToEntero
'Row("CveEq") = 1 ' 'Row("CveEq") = 1
TmpDT.AcceptChanges() ' TmpDT.AcceptChanges()
'busco el mismo PS dentro de la tabla por si está más de una vez y lo actualizo ' 'busco el mismo PS dentro de la tabla por si está más de una vez y lo actualizo
Dim rowsToUpdate = TmpDT.AsEnumerable().Where(Function(r) r.Field(Of String)("PS") = Row("PS").ToString AndAlso r!CvePS.ToString.ToEntero = 0) ' Dim rowsToUpdate = TmpDT.AsEnumerable().Where(Function(r) r.Field(Of String)("PS") = Row("PS").ToString AndAlso r!CvePS.ToString.ToEntero = 0)
For Each roww As DataRow In rowsToUpdate ' For Each roww As DataRow In rowsToUpdate
roww.SetField("CvePS", tCve) ' roww.SetField("CvePS", tCve)
roww.SetField("CveClasificacion", Row("CveClasificacionActualizar").ToString.ToEntero) ' roww.SetField("CveClasificacion", Row("CveClasificacionActualizar").ToString.ToEntero)
'roww.SetField("CveEq", 1) ' 'roww.SetField("CveEq", 1)
Next ' Next
TmpDT.AcceptChanges() ' TmpDT.AcceptChanges()
Else 'Else
' Correcto = False
'End If
Alert("Existen productos sin registrar/Asignar.", TipoMensaje.MsgAdvertencia)
Correcto = False Correcto = False
End If
Else Else
'UPDATE CLASIFICACION DE PRODUCTO YA REGISTRADO 'UPDATE CLASIFICACION DE PRODUCTO YA REGISTRADO
If Row("CveClasificacionActualizar").ToString.ToEntero > 0 AndAlso Row("CveClasificacion").ToString.ToEntero <= 0 Then If Row("CveClasificacionActualizar").ToString.ToEntero > 0 AndAlso Row("CveClasificacion").ToString.ToEntero <= 0 Then
@@ -7130,6 +7140,9 @@ Partial Class Compras_Compras
importeMovimiento = Ant.Importe importeMovimiento = Ant.Importe
importeMN = importeMovimiento * tipoCambioActual * Multiplicador importeMN = importeMovimiento * tipoCambioActual * Multiplicador
Dim ImporComisionAnticipo As Decimal = Ant.ImporteComision
Dim importeMNComision As Decimal = ImporComisionAnticipo * tipoCambioActual * Multiplicador
If importeMovimiento <> 0 Then If importeMovimiento <> 0 Then
'Conta ContPAQ 'Conta ContPAQ
If IdCtaContable = 0 Then If IdCtaContable = 0 Then
@@ -7242,6 +7255,7 @@ Partial Class Compras_Compras
Pago.ImportePago = importeMovimientoNC Pago.ImportePago = importeMovimientoNC
Pago.CveIE = Ant.CveIE Pago.CveIE = Ant.CveIE
Pago.CveMonedaPago = 1 Pago.CveMonedaPago = 1
Pago.OtroGastoIngreso = ImporComisionAnticipo
ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta)
@@ -7274,9 +7288,23 @@ Partial Class Compras_Compras
End If End If
'Agregamos el 21/37/60 'Agregamos el 21/37/60
'Dim ImporComisionAnticipo As Decimal = Ant.ImporteComision
'Dim importeMNComision As Decimal = ImporComisionAnticipo * tipoCambioActual * Multiplicador
If ImporComisionAnticipo = 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAnt, Referencia, ConceptoContableAnticipo, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveIE:=Ant.CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(tipoCambioActual = 1, 0, ImporteAnt), TipoCambio:=TipoCambioAnt, Contabilizable:=SeContabiliza) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAnt, Referencia, ConceptoContableAnticipo, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveIE:=Ant.CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(tipoCambioActual = 1, 0, ImporteAnt), TipoCambio:=TipoCambioAnt, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
Else
Dim ImporteAntMNComision As Decimal = (ImporteAnt + ImporComisionAnticipo) * TipoCambioAnt
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, (ImporteAnt + ImporComisionAnticipo), Referencia, ConceptoContableAnticipo, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveIE:=Ant.CveIE, ImporteMX:=ImporteAntMNComision, ImporteME:=If(tipoCambioActual = 1, 0, (ImporteAnt + ImporComisionAnticipo)), TipoCambio:=TipoCambioAnt, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
End If
If TxtTotal.Text.ToDouble > 0 AndAlso TieneAnticiposXML = False Then If TxtTotal.Text.ToDouble > 0 AndAlso TieneAnticiposXML = False Then
@@ -7285,6 +7313,7 @@ Partial Class Compras_Compras
Pago.CveIE = Ant.CveIE Pago.CveIE = Ant.CveIE
Pago.TCPago = Ant.TCCompra Pago.TCPago = Ant.TCCompra
Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1) Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1)
Pago.OtroGastoIngreso = ImporComisionAnticipo
ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta)
@@ -8364,679 +8393,7 @@ Partial Class Compras_Compras
Try Try
Dim CveIE As Integer = -1 Dim CveIE As Integer = -1
If EmpresaPrueba Then
Dim CvePlantillaPoliza = 52
Dim tipoCambio As Decimal
Dim tipoCambioNC As Decimal
Dim alertaContabilizacion As New StringBuilder
Dim idCuentaContabilizacion As Long = 1
Dim CvePrepolizaPadre As Integer = CvePrePoliza
Dim CuentasContablesInvalidas As New StringBuilder
Dim CuentasContablesInvalidasSIG As New StringBuilder
If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then
tipoCambio = GlobalTipoCambio(Fecha).ToString.ToDecimal
Else
tipoCambio = 1
End If
'[IPP] PARCHE PARA AMORTIZACIÓN NC
Dim TipoCambioCompra = Me.TipoCambio
Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
CveCompraNC = gvr.DataKey("CveCompra").ToEntero
tipoCambioNC = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, gvr.DataKey("TCCompra").ToDecimal)
sumaAmortizacion = 0
If CvePrePolizaNueva > 0 Then
If ObjConta.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
For Each Row As DataRow In ObjConta.DtResultados.Rows
Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False)
ImporteMovimiento = 0
IdCtaContable = 0
Dim Concepto As String = String.Format("{0} F:{1}-{2}", HplProveedor.Text, TxtSerie.Text, TxtFolio.Text)
Dim importeMN As Decimal = 0
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, 1, -1)
Dim PorcentajeImpuesto As Decimal = 0
Dim ConceptoPartida As String = String.Format("{0} F:{1}-{2}", HplProveedor.Text, TxtSerie.Text, TxtFolio.Text)
Select Case ConceptoContable
Case 265 'Amortización Anticipos Compras
If gvr.DataKey("TipoDocto").Contiene("Ant") Then
CveIE = -1
ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
importeMN = ImporteMovimiento * tipoCambioNC
sumaAmortizacion += ImporteMovimiento
sumaAmortizacionCompleto += ImporteMovimiento
If ChkPagarConPesos.Checked Then
ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal
ElseIf ChkPagarConDolares.Checked Then
ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal
End If
If DdlMoneda.SelectedValue.ToEntero <> 1 Then
IdCtaContable = CtaProveedorAnticiposExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, ConceptoPartida, ConceptoContable, "", Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioNC, CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
IdCtaContable = CtaProveedorAnticiposComplementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeMN - ImporteMovimiento, ConceptoPartida, 266, "", Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN - ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioNC, CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
Exit Select
End If
Else
ErrorMovtosCxP = 1
Exit Select
End If
Else
IdCtaContable = CtaProveedorAnticipos
If ImporteMovimiento <> 0 Then
PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, ConceptoPartida, ConceptoContable, "", Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
End If
End If
End If
ImporteMovimiento = 0
Case 60 'Nota de Credito
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
CveIE = -1
ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
importeMN = ImporteMovimiento * tipoCambioNC
sumaAmortizacion += ImporteMovimiento
sumaAmortizacionCompleto += ImporteMovimiento
If ChkPagarConPesos.Checked Then
ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal
ElseIf ChkPagarConDolares.Checked Then
ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal
End If
If DdlMoneda.SelectedValue.ToEntero <> 1 Then
IdCtaContable = CtaProveedorExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, ConceptoPartida, ConceptoContable, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioNC, CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
IdCtaContable = CtaProveedorComplementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeMN - ImporteMovimiento, ConceptoPartida, 235, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN - ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioNC, CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
Exit Select
End If
Else
ErrorMovtosCxP = 1
Exit Select
End If
Else
IdCtaContable = CtaProveedor
If ImporteMovimiento <> 0 Then
PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, ConceptoPartida, ConceptoContable, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), CveCompraAmortizacion:=CveCompra, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
End If
End If
End If
ImporteMovimiento = 0
Case 21 'Anticipo
If gvr.DataKey("TipoDocto") = "Egsc" Then
CveCompraNC = -1
CveIE = gvr.DataKey("CveIE").ToEntero
ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
sumaAmortizacion += ImporteMovimiento
sumaAmortizacionCompleto += ImporteMovimiento
IdCtaContable = CtaProveedorAnticipos
PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal
If ChkPagarConPesos.Checked Then
ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal
ElseIf ChkPagarConDolares.Checked Then
ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal
End If
If ImporteMovimiento <> 0 Then
Dim TipoCambioAnt = gvr.DataKey("TCCompra").ToDecimal
Dim usacomplementariaAnticipo As Boolean = False
usacomplementariaAnticipo = If(TipoCambioAnt > 1, True, False)
Dim ImporteAnt As Decimal = ImporteMovimiento
Dim ImporteAntMN As Decimal = ImporteAnt * TipoCambioAnt
If usacomplementariaAnticipo Then
IdCtaContable = CtaProveedorAnticiposComplementaria
ImporteAntMN = TipoCambioAnt * ImporteAnt - ImporteAnt
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteAnt, ConceptoPartida, 266, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, ImporteMX:=ImporteAntMN, ImporteME:=ImporteAnt, TipoCambio:=TipoCambioAnt, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
ImporteAntMN = ImporteAnt
End If
If TipoCambioAnt > 1 Then
IdCtaContable = CtaProveedorAnticiposExtranjera
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteAnt, ConceptoPartida, ConceptoContable, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMN, CvePrePolizaOriginal:=CvePrePolizaNueva, ImporteME:=If(tipoCambio = 1, 0, ImporteAnt), CveCompraAmortizacion:=CveCompraNC, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
If ChkPagarConPesos.Checked Or ChkPagarConDolares.Checked Then
ImporteAnt = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
TipoCambioAnt = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, gvr.DataKey("TCCompra").ToDecimal)
End If
Dim TipoCambioDiferencia = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal
If TipoCambioDiferencia <> TipoCambioAnt Then
Dim importeFluctuacion = (ImporteAnt * TipoCambioDiferencia) - (ImporteAnt * TipoCambioAnt)
If importeFluctuacion > 0 Then
ConceptoContable = 64
TipoMovimiento = True
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
ElseIf importeFluctuacion < 0 Then
ConceptoContable = 65
TipoMovimiento = False
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
End If
importeFluctuacion = importeFluctuacion.Abs.RoundSQL()
If importeFluctuacion <> 0 Then
Dim CveSubProyecto6465 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeFluctuacion, "", ConceptoContable, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveSubProyecto:=CveSubProyecto6465, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeFluctuacion, CvePrePolizaOriginal:=CvePrePolizaNueva, ImporteME:=0) Then
ErrorMovtosCxP = 1
End If
End If
End If
End If
End If
ImporteMovimiento = 0
Case 37 'Deudores Diversos
If gvr.DataKey("TipoDocto") = "DD" Then
CveCompraNC = -1
CveIE = gvr.DataKey("CveIE").ToEntero
ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
sumaAmortizacion += ImporteMovimiento
sumaAmortizacionCompleto += ImporteMovimiento
IdCtaContable = CtaProveedorDeudores
If ImporteMovimiento <> 0 Then
PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, "", ConceptoContable, "", Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento * tipoCambio, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), CveCompraAmortizacion:=CveCompraNC, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
End If
End If
ImporteMovimiento = 0
Case 17 'Pago Proveedores
If CveTipoConcepto = 2 Then ConceptoContable = 308 'cuando es acreedor
If CveMoneda > 1 Then
Select Case ConceptoContable
Case 17
ConceptoContable = 312
Case 308
ConceptoContable = 309
Case Else
End Select
End If
Dim TipoCambio17 = tipoCambio
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant", "Egsc") Then
TipoCambio17 = TipoCambioCompra
End If
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
ConceptoContable = 272
End If
ImporteMovimiento = sumaAmortizacion
importeMN = ImporteMovimiento * TipoCambio17
If DdlMoneda.SelectedValue.ToEntero <> 1 Then
IdCtaContable = CtaProveedorExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=TipoCambio17, CveSubProyecto:=CveSubProyectoAnticipo) Then
Dim CveConceptoContableComplementaria As Integer = 206
If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
IdCtaContable = CtaProveedorComplementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeMN - ImporteMovimiento, Concepto, CveConceptoContableComplementaria, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN - ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=TipoCambio17, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
Exit Select
End If
Else
ErrorMovtosCxP = 1
Exit Select
End If
Else
IdCtaContable = CtaProveedor
If ImporteMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(TipoCambio17 = 1, 0, ImporteMovimiento), CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
Exit For
End If
End If
End If
ImporteMovimiento = 0
Case 14 'Iva X Acreditar
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If sumaAmortizacion = CompraSaldo Then
ImporteMovimiento = TxtIVA.Text.ToDecimal
If ImporteMovimiento > 0 Then
IVACompleto = True
End If
Else
ImporteMovimiento = 0
End If
Else
ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2)
End If
importeMN = ImporteMovimiento * tipoCambioNC
PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
If chkImportacion.Checked Then
ConceptoContable = 287
End If
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
End If
End If
End If
Case 19 'Iva Acreditado
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If sumaAmortizacion = CompraSaldo Then
ImporteMovimiento = TxtIVA.Text.ToDecimal
IVACompleto = True
Else
ImporteMovimiento = 0
End If
Else
ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2)
End If
importeMN = ImporteMovimiento * tipoCambioNC
PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal
IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
If chkImportacion.Checked Then
ConceptoContable = 288
End If
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
End If
End If
End If
Case 15 'RetIVA x Acreditar Honorarios/Serv. Prof.
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
'If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
If DdlRetIVAConcepto.Items.Count > 0 Then
TipoMovimiento = If(TipoMovimiento, False, True)
Dim Funcionalidad As Integer = 0
If CveRetIVAConceptoOriginal = 1 Then
Funcionalidad = 307
ConceptoContable = 15
ElseIf CveRetIVAConceptoOriginal = 2 Then
Funcionalidad = 309
ConceptoContable = 183
ElseIf CveRetIVAConceptoOriginal = 3 Then
Funcionalidad = 311
ConceptoContable = 185
ElseIf CveRetIVAConceptoOriginal = 4 Then
Funcionalidad = 313
ConceptoContable = 248
ElseIf CveRetIVAConceptoOriginal = 5 Then
Funcionalidad = 578
ConceptoContable = 285
ElseIf CveRetIVAConceptoOriginal = 6 Then
ConceptoContable = 333
End If
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetIVA.Text.ToDecimal, 2)
importeMN = ImporteMovimiento * tipoCambio
If tipoCambio > 1 Then Concepto += $" TC{tipoCambio} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
End If
End If
Case 22 'RetIVA Acreditable Honorarios/Serv. Prof.
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
'If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
If DdlRetIVAConcepto.Items.Count > 0 AndAlso DdlRetIVAConcepto.SelectedValue.ToEntero > 0 Then
TipoMovimiento = If(TipoMovimiento, False, True)
Dim Funcionalidad As Integer = 0
Dim ConceptoContableContra As Integer = 0
If CveRetIVAConceptoOriginal = 1 Then
Funcionalidad = 308
ConceptoContable = 22
ConceptoContableContra = 15
ElseIf CveRetIVAConceptoOriginal = 2 Then
Funcionalidad = 310
ConceptoContable = 184
ConceptoContableContra = 183
ElseIf CveRetIVAConceptoOriginal = 3 Then
Funcionalidad = 312
ConceptoContable = 186
ConceptoContableContra = 185
ElseIf CveRetIVAConceptoOriginal = 4 Then
Funcionalidad = 314
ConceptoContable = 249
ConceptoContableContra = 248
ElseIf CveRetIVAConceptoOriginal = 5 Then
Funcionalidad = 578
ConceptoContable = 286
ConceptoContableContra = 285
ElseIf CveRetIVAConceptoOriginal = 6 Then
ConceptoContable = 334
ConceptoContableContra = 333
End If
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetIVA.Text.ToDecimal, 2)
importeMN = ImporteMovimiento * tipoCambioNC
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
'If tipoCambio > 1 Then Concepto += $" TC{tipoCambio} ${ImporteMovimiento.FormatoNumero(2)}"
''Agregamos el Opuesto del 22 -> 15
'If ImporteMovimiento <> 0 Then
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContableContra, Concepto + If(tipoCambio > 1, $" TC {tipoCambio} ${ImporteMovimiento.FormatoNumero(2)}", ""), Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=-1, CveCreditoDetalle:=-1, ImporteMX:=ImporteMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), Contabilizable:=True, TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoAnticipo) Then
' ErrorMovtosCxP = 1
' Exit For
' End If
'End If
End If
End If
Case 16 'RetISR x Acreditar
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
'If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero > 0 Then
TipoMovimiento = If(TipoMovimiento, False, True)
Dim funcionalidad As Integer = 0
If DdlRetISRConcepto.SelectedValue.ToEntero = 1 Then
funcionalidad = 315
ConceptoContable = 16
ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 2 Then
funcionalidad = 317
ConceptoContable = 243
ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then
funcionalidad = 348
ConceptoContable = 327
End If
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetISR.Text.ToDecimal, 2)
importeMN = ImporteMovimiento * tipoCambio
If tipoCambio > 1 Then Concepto += $" TC{tipoCambio} ${ImporteMovimiento.FormatoNumero(2)}"
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If CtaProveedorRetISR > 0 Then
IdCtaContable = CtaProveedorRetISR
ElseIf UsuarioActual.Empresa.Funcionalidad(funcionalidad).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(funcionalidad).ToEntero
Else
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
End If
End If
End If
Case 23 'RetISR Acreditable
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
'If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero > 0 Then
TipoMovimiento = If(TipoMovimiento, False, True)
Dim funcionalidad As Integer = 0
Dim ConceptoContableContra As Integer = 0
If CveRetISRConceptoOriginal = 1 Then
funcionalidad = 316
ConceptoContable = 23
ConceptoContableContra = 16
ElseIf CveRetISRConceptoOriginal = 2 Then
funcionalidad = 318
ConceptoContable = 244
ConceptoContableContra = 243
ElseIf CveRetISRConceptoOriginal = 3 Then
funcionalidad = 348
ConceptoContable = 328
ConceptoContableContra = 327
End If
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetISR.Text.ToDecimal, 2)
importeMN = Math.Round(ImporteMovimiento, 2) * tipoCambio * Multiplicador
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If CtaProveedorRetISR > 0 Then
IdCtaContable = CtaProveedorRetISR
ElseIf UsuarioActual.Empresa.Funcionalidad(funcionalidad).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(funcionalidad).ToEntero
Else
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
End If
End If
End If
Case 64 'GANANCIA
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then 'SOLO SE IMPLEMENTÓ PARA NC
If DdlMoneda.SelectedValue.ToEntero <> 1 Or gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
Dim TipoCambioDiferenciaCambiaria = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, tipoCambioNC)
Dim TipoCambioDiferenciaCompra = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal
If TipoCambioDiferenciaCompra > TipoCambioDiferenciaCambiaria Then
ImporteMovimiento = (sumaAmortizacion * TipoCambioDiferenciaCompra) - (sumaAmortizacion * TipoCambioDiferenciaCambiaria)
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMN = ImporteMovimiento
End If
If ImporteMovimiento <> 0 Then
Dim CveSubProyecto64 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveSubProyecto:=CveSubProyecto64, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=0) Then
ErrorMovtosCxP = 1
Exit For
End If
End If
End If
End If
ImporteMovimiento = 0
Case 65 'PERDIDA
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then 'SOLO SE IMPLEMENTÓ PARA NC
If DdlMoneda.SelectedValue.ToEntero <> 1 Or gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
Dim TipoCambioDiferenciaCambiaria = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, tipoCambioNC)
Dim TipoCambioDiferenciaCompra = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal
If TipoCambioDiferenciaCambiaria > TipoCambioDiferenciaCompra Then
ImporteMovimiento = (sumaAmortizacion * TipoCambioDiferenciaCambiaria) - (sumaAmortizacion * TipoCambioDiferenciaCompra)
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMN = ImporteMovimiento
End If
If ImporteMovimiento <> 0 Then
Dim CveSubProyecto65 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveSubProyecto:=CveSubProyecto65, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=0) Then
ErrorMovtosCxP = 1
Exit For
End If
End If
End If
End If
ImporteMovimiento = 0
End Select
If ImporteMovimiento <> 0 Then
'Conta ContPAQ
If IdCtaContable = 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=tipoCambioNC, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
Exit For
End If
End If
Next
End If
End If
End If
Next
'Si el importe total de la amortizacion es igual al saldo de la compra se registra IVA
If IVACompleto = False AndAlso UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If sumaAmortizacionCompleto = CompraSaldo Then
Dim PorcentajeImpuesto As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
If TxtIVA.Text.ToDecimal > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, True, TxtIVA.Text.ToDecimal, "", 14, "", Fecha, IdCtaIVAXAcreditar, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=TxtIVA.Text.ToDecimal * tipoCambio, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, TxtIVA.Text.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, False, TxtIVA.Text.ToDecimal, "", 19, "", Fecha, IdCtaIVAAcreditable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=TxtIVA.Text.ToDecimal * tipoCambio, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, TxtIVA.Text.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
End If
End If
End If
'Unificacion de PrePolizas
If UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
If Not ObjConta.PrePolizaUnificacion(CvePrepolizaPadre, CvePrePolizaNueva) Then
ErrorMovtosCxP = 1
Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError)
End If
If ObjConta.SeUnifico Then
CvePrePolizaNueva = CvePrepolizaPadre 'para que se unifique siempre la prepolizanueva
End If
End If
'Simplificacion de PrePolizas
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
If Not ObjConta.PrePolizaSimplificacion(CvePrePolizaNueva, UsuarioActual.CveEmpresa) Then
ErrorMovtosCxP = 1
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
End If
End If
'Validacion de prepolizas
If ObjConta.ValidacionPrePolizaCuadre(CvePrePolizaNueva, 4) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Compras/Compras-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
'ErrorMovtosCxP = 1
End If
End If
'Conta ContPAQ
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ErrorMovtosCxP = 0 Then
If idCuentaContabilizacion > 0 Then
If ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
alertaContabilizacion.AppendFormat("<a class='Texto' href = '/Contabilidad/RegPoliza.aspx?IdPoliza={0}'>{1}<\a><br>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
Else
ErrorMovtosCxP = 1
End If
If ErrorMovtosCxP = 0 Then
Alert("Se enviaron correctamente las siguientes pólizas:<br><br>" & alertaContabilizacion.ToString, ModExtensiones.TipoMensaje.MsgInformacion)
Else
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
End If
Else
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son inválidas: <br>{0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia)
End If
End If
Else 'Empresa Prueba
For Each gvr As GridViewRow In GVAnticipos.Rows For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
@@ -9078,59 +8435,70 @@ Partial Class Compras_Compras
PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal
'Se agrega la nota de credito
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoCompra, gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, " ", CveConceptoCompra, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, CveCompraAmortizacion:=CveCompraNC, ImporteMX:=gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, CveSubProyecto:=CveSubProyectoAnticipo) Then Dim ImporteAnt As Decimal = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
Dim ImporComisionAnticipo As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal
Dim CvemonedaAnticipo As Integer = gvr.DataKey("CveMoneda").ToEntero
Dim TipoCambioAnt As Decimal = gvr.DataKey("TCCompra").ToDecimal
If ImporComisionAnticipo = 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, ImporteAnt, " ", CveConceptoCompra, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, CveCompraAmortizacion:=CveCompraNC, ImporteMX:=ImporteAnt, ImporteME:=If(TipoCambioAnt = 1, 0, ImporteAnt), CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1 ErrorMovtosCxP = 1
Exit For Exit For
End If End If
Else
'movimiento de pago proveedor Dim ImporteAntMNComision As Decimal = (ImporteAnt + ImporComisionAnticipo) * TipoCambioAnt
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, " ", CveConceptoPago, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, CveCompraAmortizacion:=CveCompraNC, ImporteMX:=gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, CveSubProyecto:=CveSubProyectoAnticipo) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, (ImporteAnt + ImporComisionAnticipo), "", CveConceptoCompra, "", TxtFechaPago.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMNComision, ImporteME:=If(TipoCambioAnt = 1, 0, (ImporteAnt + ImporComisionAnticipo)), CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
ErrorMovtosCxP = 1 ErrorMovtosCxP = 1
Exit For
End If End If
'si tiene iva y su proporcion
ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2)
If ImporteMovimiento > 0 Then
Dim PorcentajeImpuesto As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, " ", 14, " ", TxtFechaPago.Text.ToDate, IdCtaIVAXAcreditar, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, " ", 19, " ", TxtFechaPago.Text.ToDate, IdCtaIVAAcreditable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
End If
'si tiene Ret iva y su proporcion
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetIVA.Text.ToDecimal, 2)
If ImporteMovimiento > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, " ", 15, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, " ", 22, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
End If
'si tiene Ret ISR y su proporcion
ImporteMovimiento = Math.Round(PorcentajePago * TxtRetISR.Text.ToDecimal, 2)
If ImporteMovimiento > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, " ", 16, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, " ", 23, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CveSubProyecto:=CveSubProyectoAnticipo) Then ErrorMovtosCxP = 1 : Exit For
End If End If
'actualizo una tabla de vinculaciones Dim Pago As New CompraPago
Pago.ImportePago = ImporteAnt
Pago.CveIE = CveIE
Pago.CveMonedaPago = CvemonedaAnticipo
Pago.CveCompraAmortizacion = CveCompraNC
Pago.CveCreditoDetalle = -1
Pago.OtroGastoIngreso = ImporComisionAnticipo
'actualizo la cantidad en amortizaciones Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
Dim CompraActual As New Compra
CompraActual.CveCompra = CveCompra
CompraActual.CveTipoConceptoProveedor = CveTipoConcepto
CompraActual.CveProveedor = CveProveedor
CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero
CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim
CompraActual.ProveedorNombre = HplProveedor.Text
CompraActual.TC = TipoCambio
CompraActual.Total = TxtTotal.Text.ToDecimal
CompraActual.IVA = TxtIVA.Text.ToDecimal
CompraActual.IEPS = TxtIEPS.Text.ToDecimal
CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal
CompraActual.RetISR = TxtRetISR.Text.ToDecimal
CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero
CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
CompraActual.PorcentajeIVA = PorcentajeIVA
CompraActual.UsuarioActual = UsuarioActual
CompraActual.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
CompraActual.IdCtaContableProv = CtaProveedor
CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria
CompraActual.EsImportacion = chkImportacion.Checked
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
If Not ObjCompra.AmortizarCompra(CveCompra, CveCompraNC, gvr.FCTextBox("TxtAnticipo").Text.ToDouble, UsuarioActual.CveUsuario) Then
ErrorMovtosCxP = 2
Exit For
End If AplicaPrePolizaPagoCompra(CompraActual, pago, CvePrePoliza, ObjConta)
End If
'If gvr.DataKey("TipoDocto").Contiene("NC", "DEV") Then
' If Not ObjCompra.AmortizarCompra(CveCompra, CveCompraNC, gvr.FCTextBox("TxtAnticipo").Text.ToDouble, UsuarioActual.CveUsuario) Then
' ErrorMovtosCxP = 2
' Exit For
' End If
'End If
End If End If
@@ -9139,7 +8507,7 @@ Partial Class Compras_Compras
Next Next
End If 'Empresa Prueba
@@ -9184,7 +8552,7 @@ Partial Class Compras_Compras
For Each gvr As GridViewRow In GVAnticipos.Rows For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")}) ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")})
End If End If
Next Next
@@ -10431,10 +9799,12 @@ Partial Class Compras_Compras
#Region "GV'S" #Region "GV'S"
Protected Sub GVAnticipos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVAnticipos.RowDataBound Protected Sub GVAnticipos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVAnticipos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("SerieFolio") = "" Then If e.Row.DBCampo("SerieFolio") = "" Then
e.Row.Cells(0).Text = "" e.Row.Cells(0).Text = ""
e.Row.Cells(5).Text = "" e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(0).Width = Unit.Pixel(150) e.Row.Cells(0).Width = Unit.Pixel(150)
e.Row.CssClass = "Totales TextCenter" e.Row.CssClass = "Totales TextCenter"
Select Case e.Row.DBCampo("TipoDocto") Select Case e.Row.DBCampo("TipoDocto")
@@ -10451,6 +9821,7 @@ Partial Class Compras_Compras
ElseIf e.Row.DBCampo("CveProveedor") = "" Then ElseIf e.Row.DBCampo("CveProveedor") = "" Then
e.Row.Cells(0).Text = "" e.Row.Cells(0).Text = ""
e.Row.Cells(5).Text = "" e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.BackColor = Drawing.Color.LightGray e.Row.BackColor = Drawing.Color.LightGray
Else Else
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(3).ForeColor = Drawing.Color.Red If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(3).ForeColor = Drawing.Color.Red
@@ -10458,7 +9829,44 @@ Partial Class Compras_Compras
Dim ImporteAmortizacion As Decimal = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDecimal) Dim ImporteAmortizacion As Decimal = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDecimal)
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
If UsuarioActual.Empresa.CveEmpresa.Contiene(13, 83) Then
e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2},{3},{4},{5},{6});",
e.Row.FCCheckBox("Chk").ClientID,
e.Row.DBCampo("Saldo"),
If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero,
If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble),
DdlMoneda.SelectedValue.ToEntero,
e.Row.FCTextBox("TxtComision").ClientID)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
e.Row.FCTextBox("TxtComision").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},{6},{1},{2},{3},{4},{5},this);",
e.Row.FCCheckBox("Chk").ClientID,
e.Row.DBCampo("Saldo"),
If(CveCompra > 0, Saldo, ImporteAmortizacion),
e.Row.DBCampo("CveMoneda").ToEntero,
If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble),
DdlMoneda.SelectedValue.ToEntero,
e.Row.FCTextBox("TxtAnticipo").ClientID))
Else
e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2},{3},{4},{5});",
e.Row.FCCheckBox("Chk").ClientID,
e.Row.DBCampo("Saldo"),
If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero,
If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble),
DdlMoneda.SelectedValue.ToEntero,
e.Row.FCTextBox("TxtComision").ClientID)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
e.Row.FCTextBox("TxtComision").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},{6},{1},{2},{3},{4},{5},this);",
e.Row.FCCheckBox("Chk").ClientID,
e.Row.DBCampo("Saldo"),
If(CveCompra > 0, Saldo, ImporteAmortizacion),
e.Row.DBCampo("CveMoneda").ToEntero,
If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble),
DdlMoneda.SelectedValue.ToEntero,
e.Row.FCTextBox("TxtAnticipo").ClientID))
End If
If ChkNCInv.Checked Then If ChkNCInv.Checked Then
e.Row.FCCheckBox("Chk").CssClass = "ChkAntNC" e.Row.FCCheckBox("Chk").CssClass = "ChkAntNC"

View File

@@ -5668,7 +5668,8 @@ Partial Class PopUpVerFactura
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
Dim CveFolio = "" Dim CveFolio = ""
CreaDT() CreaDT()
Dim ReporteEmpresa As New System.IO.FileInfo(String.Format("{0}Formatos/OrdenServicio.rdlc", UsuarioActual.Empresa.Ruta))
Dim RutaReporte As New System.IO.FileInfo(String.Format("{0}Formatos/OrdenServicio.rdlc", UsuarioActual.Empresa.Ruta))
If ObjOS.GetOrdenesServicios(CveOS, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then If ObjOS.GetOrdenesServicios(CveOS, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
If ObjOS.DtResultados.Rows.Count > 0 Then If ObjOS.DtResultados.Rows.Count > 0 Then
@@ -5688,7 +5689,7 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("ClienteEstado", dr("Estado").ToString)) params.Add(New ReportParameter("ClienteEstado", dr("Estado").ToString))
CveFolio = dr("Folio").ToString CveFolio = dr("Folio").ToString
If ReporteEmpresa.Exists Then If RutaReporte.Exists Then
params.Add(New ReportParameter("NoDeCliente", dr("CveCliente").ToString)) params.Add(New ReportParameter("NoDeCliente", dr("CveCliente").ToString))
params.Add(New ReportParameter("RFC", dr("RFC").ToString)) params.Add(New ReportParameter("RFC", dr("RFC").ToString))
params.Add(New ReportParameter("Vendedor", " ")) params.Add(New ReportParameter("Vendedor", " "))
@@ -5706,7 +5707,10 @@ Partial Class PopUpVerFactura
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
If Not ReporteEmpresa.Exists Then If Not RutaReporte.Exists Then
RutaReporte = New System.IO.FileInfo(String.Format("{0}Empresas\Grales\Formatos\OrdenServicio.rdlc", ModExtensiones.DirectorioBaseEmpresas))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
@@ -5734,7 +5738,7 @@ Partial Class PopUpVerFactura
lrds.Add(rds2) lrds.Add(rds2)
ObjOS.Dispose() ObjOS.Dispose()
ImprimirPDF(String.Format("Empresas/{0}/Formatos/OrdenServicio.rdlc", UsuarioActual.CveEmpresa), lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) ImprimirPDF(RutaReporte.FullName, lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio))
End Sub End Sub
Private Sub CreaDT() Private Sub CreaDT()
TmpDTOS = New DataTable TmpDTOS = New DataTable

File diff suppressed because it is too large Load Diff

View File

@@ -416,6 +416,7 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -1515,9 +1516,9 @@
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName> <rd:DefaultName>Textbox1</rd:DefaultName>
<Top>0.22833cm</Top> <Top>0.22833cm</Top>
<Left>2.8349cm</Left> <Left>4.1049cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>8.44903cm</Width> <Width>10.98903cm</Width>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@@ -1565,9 +1566,9 @@
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName> <rd:DefaultName>Textbox2</rd:DefaultName>
<Top>0.86361cm</Top> <Top>0.86361cm</Top>
<Left>2.8349cm</Left> <Left>5.85115cm</Left>
<Height>0.52945cm</Height> <Height>0.52945cm</Height>
<Width>8.44903cm</Width> <Width>7.58473cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@@ -1620,15 +1621,6 @@
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
</TextRun> </TextRun>
<TextRun>
<Value>No.</Value>
<Style>
<FontFamily>Myriad Pro</FontFamily>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>#a90909</Color>
</Style>
</TextRun>
<TextRun> <TextRun>
<Value>=Parameters!FolioOS.Value</Value> <Value>=Parameters!FolioOS.Value</Value>
<Style> <Style>
@@ -1646,9 +1638,9 @@
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox4</rd:DefaultName> <rd:DefaultName>Textbox4</rd:DefaultName>
<Top>0.08989in</Top> <Top>0.08989in</Top>
<Left>4.51194in</Left> <Left>5.98416in</Left>
<Height>0.29178in</Height> <Height>0.29178in</Height>
<Width>3.45661in</Width> <Width>1.98439in</Width>
<ZIndex>4</ZIndex> <ZIndex>4</ZIndex>
<Style> <Style>
<Border> <Border>
@@ -1775,7 +1767,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox18</rd:DefaultName> <rd:DefaultName>Textbox18</rd:DefaultName>
<Top>1.14584cm</Top> <Top>1.36809cm</Top>
<Left>11.46032cm</Left> <Left>11.46032cm</Left>
<Height>1.98807cm</Height> <Height>1.98807cm</Height>
<Width>8.7798cm</Width> <Width>8.7798cm</Width>

View File

@@ -66,6 +66,10 @@ Partial Class OS_Asignaciones
End If End If
End If End If
ObjEstatusPermisos.Dispose() ObjEstatusPermisos.Dispose()
End If End If
End Sub End Sub
@@ -241,12 +245,20 @@ Partial Class OS_Asignaciones
End If End If
Dim CorreoAsignado As String = GlobalDTUsuarios(DdlTecnico.SelectedValue.ToEntero).Rows(0)("Correo").ToString
If Not TieneError Then
MandaCorreOS(row.DataKey("CveOS").ToEntero, CorreoAsignado)
End If
End If End If
End If End If
End If End If
Next Next
If contadorOrdenesAsignadas > 0 Then If contadorOrdenesAsignadas > 0 Then
If Not TieneError Then If Not TieneError Then
@@ -265,6 +277,171 @@ Partial Class OS_Asignaciones
UpAsignacionPersona.Update() UpAsignacionPersona.Update()
UpOS.Update() UpOS.Update()
End Sub End Sub
Private Sub MandaCorreOS(CveOS As Integer, CorreoUsuarioAsignado As String)
Dim ObjOS As New ClsOS()
Dim params As New List(Of ReportParameter)
Dim CveFolio = ""
Dim TmpDTOS = New DataTable
TmpDTOS.Columns.Add("CveOSDetalle", GetType(Integer))
TmpDTOS.Columns.Add("CveClasificacion", GetType(Integer))
TmpDTOS.Columns.Add("Clasificacion", GetType(String))
TmpDTOS.Columns.Add("CvePS", GetType(Integer))
TmpDTOS.Columns.Add("CveUM", GetType(Integer))
TmpDTOS.Columns.Add("UM", GetType(String))
TmpDTOS.Columns.Add("Cantidad", GetType(Integer))
TmpDTOS.Columns.Add("PS", GetType(String))
TmpDTOS.Columns.Add("Especificaciones", GetType(String))
TmpDTOS.Columns.Add("Materiales", GetType(String))
TmpDTOS.Columns.Add("CveCuentaEquipo", GetType(Integer))
TmpDTOS.Columns.Add("Observaciones", GetType(String))
TmpDTOS.Columns.Add("FechaAtencion", GetType(String))
TmpDTOS.Columns.Add("CveUsuarioAtendio", GetType(Integer))
TmpDTOS.Columns.Add("UsuarioAtendio", GetType(String))
TmpDTOS.Columns.Add("FechaTermino", GetType(String))
TmpDTOS.Columns.Add("FechaEntrega", GetType(String))
TmpDTOS.Columns.Add("CveUsuarioEntrego", GetType(Integer))
TmpDTOS.Columns.Add("UsuarioEntrego", GetType(String))
TmpDTOS.Columns.Add("SeFacturara", GetType(String))
TmpDTOS.Columns.Add("SeSuperviso", GetType(String))
TmpDTOS.Columns.Add("Estatus", GetType(String))
TmpDTOS.Columns.Add("Archivo", GetType(String))
TmpDTOS.Columns.Add("ComentarioTecnico", GetType(String))
Dim TmpDTMaterialesOS = New DataTable
TmpDTMaterialesOS.Columns.Add("CveOSDetalle", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("CveConsecutivo", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("CveConsecutivoDetalle", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("CveMaterial", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("Cantidad", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("CveClasificacion", GetType(Integer))
TmpDTMaterialesOS.Columns.Add("CvePS", GetType(String))
TmpDTMaterialesOS.Columns.Add("CveUM", GetType(String))
TmpDTMaterialesOS.Columns.Add("Clasificacion", GetType(String))
TmpDTMaterialesOS.Columns.Add("PS", GetType(String))
TmpDTMaterialesOS.Columns.Add("UM", GetType(String))
Dim FolioOS As String = ""
Dim RutaReporte As New System.IO.FileInfo(String.Format("{0}Formatos/OrdenServicio.rdlc", UsuarioActual.Empresa.Ruta))
If ObjOS.GetOrdenesServicios(CveOS, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
If ObjOS.DtResultados.Rows.Count > 0 Then
Dim dtOS As DataTable = ObjOS.DtResultados
Dim dr As DataRow = dtOS.Rows(0)
params.Add(New ReportParameter("Cliente", dr("Cliente").ToString))
params.Add(New ReportParameter("Solicito", dr("PersonaSolicito").ToString))
params.Add(New ReportParameter("Descripcion", dr("Descripcion").ToString))
params.Add(New ReportParameter("Recibio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaRecibido", dr("FechaRecepcion").ToString))
params.Add(New ReportParameter("FolioOS", dr("Folio").ToString))
FolioOS = dr("Folio").ToString
params.Add(New ReportParameter("ClienteTelefono", dr("Telefono").ToString))
params.Add(New ReportParameter("ClienteCalle", dr("Direccion").ToString))
params.Add(New ReportParameter("ClienteColonia", dr("Colonia").ToString))
params.Add(New ReportParameter("ClienteCiudad", dr("Ciudad").ToString))
params.Add(New ReportParameter("ClienteEstado", dr("Estado").ToString))
CveFolio = dr("Folio").ToString
If RutaReporte.Exists Then
params.Add(New ReportParameter("NoDeCliente", dr("CveCliente").ToString))
params.Add(New ReportParameter("RFC", dr("RFC").ToString))
params.Add(New ReportParameter("Vendedor", " "))
params.Add(New ReportParameter("Correo", dr("Correo").ToString))
params.Add(New ReportParameter("CodigoDeServicio", dr("CveOS").ToString))
params.Add(New ReportParameter("Sucursal", dr("SubProyecto").ToString))
params.Add(New ReportParameter("TipoServicio", dr("TipoServicio").ToString))
params.Add(New ReportParameter("TipoEquipo", dr("TipoEquipo").ToString))
params.Add(New ReportParameter("Descripcion", dr("Descripcion").ToString))
params.Add(New ReportParameter("Copia", "Copia: Original"))
params.Add(New ReportParameter("Equipo", dr("Equipo").ToString))
End If
End If
End If
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
If Not RutaReporte.Exists Then
RutaReporte = New System.IO.FileInfo(String.Format("{0}Empresas\Grales\Formatos\OrdenServicio.rdlc", ModExtensiones.DirectorioBaseEmpresas))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
End If
If ObjOS.GetOrdenesServiciosDetalle(CveOS) Then
TmpDTOS = ObjOS.DtResultados
End If
If ObjOS.GetDetalleMateriales(-1, CveOS) Then
TmpDTMaterialesOS = ObjOS.DtResultados
End If
Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource With {.Name = "DataSet2", .Value = TmpDTMaterialesOS}
Dim rds2 As New ReportDataSource With {.Name = "DataSet1", .Value = TmpDTOS}
lrds.Add(rds)
lrds.Add(rds2)
ObjOS.Dispose()
Dim ReporteByte As Byte() = StreamPDF(RutaReporte.FullName, lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio))
If ReporteByte IsNot Nothing Then
Try
ViewState("Para") = CorreoUsuarioAsignado
ViewState("ArrayCC") = ""
ViewState("Asunto") = "Asinación Orden de Servicio"
ViewState("FolioOSMail") = FolioOS
ViewState("Body") = "Asinación Orden de Servicio"
ViewState("bytesOS") = ReporteByte
Dim Hilo As New Threading.Thread(AddressOf SendmailOS)
Hilo.Start()
Catch ex As Exception
GuardaLogAD($"Error al enviar correo de OS {ex.StackTrace}")
End Try
End If
End Sub
Private Sub SendmailOS()
Dim Asunto, Para, ArrayCC, Body As String
Asunto = If(IsNothing(ViewState("Asunto")), "", ViewState("Asunto").ToString)
Para = If(IsNothing(ViewState("Para")), "", ViewState("Para").ToString)
ArrayCC = If(IsNothing(ViewState("ArrayCC")), "", ViewState("ArrayCC").ToString)
Body = If(IsNothing(ViewState("Body")), "", ViewState("Body").ToString)
Dim Mail As New ClsSisMail()
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.NombreArchivo = $"OS_{ViewState("FolioOSMail") }.pdf", .ArchivoBinario = DirectCast(ViewState("bytesOS"), Byte())})
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, ArrayCC, LSRutasMail)
End Sub
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
Dim TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", DdlEstatusOS.SelectedValue)) Dim TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", DdlEstatusOS.SelectedValue))

View File

@@ -156,6 +156,17 @@
<ajax:ValidatorCalloutExtender ID="VCETipoOS" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoOS" Width="100px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCETipoOS" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoOS" Width="100px"></ajax:ValidatorCalloutExtender>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-2">
<b>Drección:</b>
</div>
<div class="col-md-4">
<asp:TextBox ID="TxtDireccion" runat="server" MaxLength="300" CssClass="form-control" />
</div>
</div>
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>

View File

@@ -487,6 +487,8 @@ Partial Class OS_OrdenesServicios
DdlTipoOrdenOS.SelectedValueExist(ObjOS.CveOSTipo) DdlTipoOrdenOS.SelectedValueExist(ObjOS.CveOSTipo)
DdlSucursalCliente.SelectedValueExist(ObjOS.CveClienteSucursal) DdlSucursalCliente.SelectedValueExist(ObjOS.CveClienteSucursal)
TxtDireccion.Text = ObjOS.DtResultados.Rows(0)("DireccionOS").ToString
TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", ObjOS.CveEstatusOrdenServicio), "CveEstatusOrdenServicio ASC").ToEntero TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", ObjOS.CveEstatusOrdenServicio), "CveEstatusOrdenServicio ASC").ToEntero
SeFacturara = GlobalDTTipoOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SeFacturara", String.Format("CveOrdenServicioTipo = {0}", ObjOS.CveOSTipo)) SeFacturara = GlobalDTTipoOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SeFacturara", String.Format("CveOrdenServicioTipo = {0}", ObjOS.CveOSTipo))
CveTecnico = ObjOS.CveUsuarioAtendio CveTecnico = ObjOS.CveUsuarioAtendio
@@ -1030,7 +1032,7 @@ Partial Class OS_OrdenesServicios
If Not CveOS > 0 Then If Not CveOS > 0 Then
Dim bandera As Integer = DdlEstatusOS.SelectedValue.ToEntero Dim bandera As Integer = DdlEstatusOS.SelectedValue.ToEntero
If Not ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyecto.SelectedValue.ToEntero, TxtSolicito.Text, TxtFechaRecibido.Text.ToDateTime, TxtDescripcion.Text, UsuarioActual.CveUsuario, EstatusOrdenServicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then If Not ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyecto.SelectedValue.ToEntero, TxtSolicito.Text, TxtFechaRecibido.Text.ToDateTime, TxtDescripcion.Text, UsuarioActual.CveUsuario, EstatusOrdenServicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, Direccion:=TxtDireccion.Text) Then
Errores = True Errores = True
End If End If
CargaCliente(CveCliente) CargaCliente(CveCliente)
@@ -1067,6 +1069,7 @@ Partial Class OS_OrdenesServicios
If Not ObjGenerales.AddUpdateCaracteristicasValores(CveCaracteristica, CveOpcion, Valor, UsuarioActual.CveUsuario, CveOSDetalle:=CveOsDetalle, CvePs:=CvePS) Then If Not ObjGenerales.AddUpdateCaracteristicasValores(CveCaracteristica, CveOpcion, Valor, UsuarioActual.CveUsuario, CveOSDetalle:=CveOsDetalle, CvePs:=CvePS) Then
Errores = True Errores = True
End If End If
Next Next
For Each RowM As DataRow In TmpDTMaterialesDetalle.FiltraParametros(String.Format("CveConsecutivoDetalle = {0}", Consecutivo)).Rows For Each RowM As DataRow In TmpDTMaterialesDetalle.FiltraParametros(String.Format("CveConsecutivoDetalle = {0}", Consecutivo)).Rows
@@ -1126,7 +1129,7 @@ Partial Class OS_OrdenesServicios
Else Else
If CveTecnico = UsuarioActual.CveUsuario Then If CveTecnico = UsuarioActual.CveUsuario Then
If ObjOrdenServicio.UpdateOrdenesServicios(TxtSolicito.Text, TxtFechaRecibido.Text, TxtDescripcion.Text, UsuarioActual.CveUsuario, DdlEstatusOS.SelectedValue.ToEntero, CveOS, UsuarioActual.CveUsuario, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then If ObjOrdenServicio.UpdateOrdenesServicios(TxtSolicito.Text, TxtFechaRecibido.Text, TxtDescripcion.Text, UsuarioActual.CveUsuario, DdlEstatusOS.SelectedValue.ToEntero, CveOS, UsuarioActual.CveUsuario, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, Direccion:=TxtDireccion.Text) Then
For Each Row As DataRow In TmpDT.Rows For Each Row As DataRow In TmpDT.Rows
If Not Errores Then If Not Errores Then
Dim CvePS As Integer = Row("CvePS").ToString.ToEntero Dim CvePS As Integer = Row("CvePS").ToString.ToEntero

View File

@@ -138,6 +138,45 @@
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="BtnConsultar_Click" CssClass="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row">
<label class="col-md-1 ">Técnico:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlTecnico" ClientIDMode="Static" CssClass="form-control input-sm select2me" runat="server" DataTextField="Nombre" Visible="true" DataValueField="CveUsuario"></asp:DropDownList>
</div>
<label class="col-md-1 "><asp:Label runat="server" ID="LblSubProyectoFiltro"></asp:Label>:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlSubProyecto" ClientIDMode="Static" DataValueField="CveSubProyecto" DataTextField="SubProyecto" runat="server" CssClass="form-control select2me" Width="150px" AppendDataBoundItems="true"></asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="portlet-body">
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row"> <div class="row">
<div class="col-md-12 col-sm-12"> <div class="col-md-12 col-sm-12">
@@ -207,6 +246,11 @@
<label for="<%= TxtDescripcionAgenda.ClientID.ToString()%>" style="height: 60px;">Descripción:</label> <label for="<%= TxtDescripcionAgenda.ClientID.ToString()%>" style="height: 60px;">Descripción:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" ClientIDMode="Static" ID="LblDireccion" CssClass="form-control"></asp:Label>
<label for="<%= LblDireccion.ClientID.ToString()%>" style="height: 60px;">Dirección:</label>
</div>
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" ClientIDMode="Static" ID="LblSubProyecto" CssClass="form-control"></asp:Label> <asp:Label runat="server" ClientIDMode="Static" ID="LblSubProyecto" CssClass="form-control"></asp:Label>
<label for="<%= LblSubProyecto.ClientID.ToString()%>" style="height: 60px;"><asp:Label runat="server" ID="LblSubProyectoEtiqueta"></asp:Label>:</label> <label for="<%= LblSubProyecto.ClientID.ToString()%>" style="height: 60px;"><asp:Label runat="server" ID="LblSubProyectoEtiqueta"></asp:Label>:</label>
@@ -467,6 +511,7 @@
$("#DdlAgedaTipo").val(event.cveagendatipo); $("#DdlAgedaTipo").val(event.cveagendatipo);
$("#DdlPrioridad").val(event.prioridad); $("#DdlPrioridad").val(event.prioridad);
$('#LblSubProyecto').text(event.SubProyecto); $('#LblSubProyecto').text(event.SubProyecto);
$('#LblDireccion').text(event.Direccion);
@@ -681,6 +726,8 @@
//$get('DivActualizarEvento').style.display = 'none'; //$get('DivActualizarEvento').style.display = 'none';
//$get('DivAgregarEvento').style.display = 'none'; //$get('DivAgregarEvento').style.display = 'none';
var date = new Date(); var date = new Date();
var d = date.getDate(); var d = date.getDate();
var m = date.getMonth(); var m = date.getMonth();
@@ -729,7 +776,9 @@
data: { data: {
U: ' <%= UsuarioActual.CveUsuario %>', U: ' <%= UsuarioActual.CveUsuario %>',
E: '<%= UsuarioActual.CveEmpresa %>', E: '<%= UsuarioActual.CveEmpresa %>',
METODO:'servicio_domicilio' METODO: 'servicio_domicilio',
CveUsuarioPara: $('#DdlTecnico').val(),
CveSubProyecto: $('#DdlSubProyecto').val()
} }
}, },
eventDrop: eventDropped, eventDrop: eventDropped,

View File

@@ -63,7 +63,14 @@ Partial Class OS_RepServicioDomicilio
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoEtiqueta)
CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyectoEtiqueta)
LblSubProyectoFiltro.Text = LblSubProyectoEtiqueta.Text
DdlTecnico.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
DdlTecnico.DataBind()
DdlTecnico.Items.Insert(0, New ListItem("Todos", "-1"))
InicializaCalendar() InicializaCalendar()
End If End If
End Sub End Sub
@@ -270,4 +277,8 @@ Partial Class OS_RepServicioDomicilio
#End Region #End Region
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
RegistraScript("Calendario();")
End Sub
End Class End Class