diff --git a/Acumuladores/CatFoliosGarantia.aspx b/Acumuladores/CatFoliosGarantia.aspx index 59790d940..a6b8a70b9 100644 --- a/Acumuladores/CatFoliosGarantia.aspx +++ b/Acumuladores/CatFoliosGarantia.aspx @@ -82,7 +82,7 @@ + + + +   + + @@ -195,7 +201,18 @@ + +
+ +
+ + + + + +
+
  diff --git a/Acumuladores/CatFoliosGarantia.aspx.vb b/Acumuladores/CatFoliosGarantia.aspx.vb index a22e0cabb..ef5209ca0 100644 --- a/Acumuladores/CatFoliosGarantia.aspx.vb +++ b/Acumuladores/CatFoliosGarantia.aspx.vb @@ -37,6 +37,7 @@ Partial Class Acumuladores_CatFoliosGarantia Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then + CargaSubProyectos() CargadatosGvFolioGarantia() End If @@ -45,6 +46,12 @@ Partial Class Acumuladores_CatFoliosGarantia #Region "Folios Garantía" + Private Sub CargaSubProyectos() + DdlSubProyectos.Items.Clear() + DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectos.DataBind() + DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub Private Sub CargadatosGvFolioGarantia() @@ -88,6 +95,7 @@ Partial Class Acumuladores_CatFoliosGarantia TxtFolioGarantia.Text = "" ChkEstatus.Checked = True + DdlSubProyectos.SelectedValueExist("-1") Actualizar = False UpGral.Update() @@ -108,7 +116,7 @@ Partial Class Acumuladores_CatFoliosGarantia If Not Actualizar Then - If ObjAcum.FoliosGarantiaAdd(TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If ObjAcum.FoliosGarantiaAdd(TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero) Then TxtFolioGarantia.Text = "" ChkEstatus.Checked = True @@ -127,7 +135,7 @@ Partial Class Acumuladores_CatFoliosGarantia Alert("Ocurrió un error al guardar el Folio de Garantía", TipoMensaje.MsgError) End If Else - If ObjAcum.FoliosGarantiaUpdate(CveFolioGarantia, TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario) Then + If ObjAcum.FoliosGarantiaUpdate(CveFolioGarantia, TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, DdlSubProyectos.SelectedValue.ToEntero) Then TxtFolioGarantia.Text = "" ChkEstatus.Checked = True @@ -195,10 +203,11 @@ Partial Class Acumuladores_CatFoliosGarantia 'TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00") 'TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00") - 'DdlPS.Items.Clear() - 'DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - 'DdlPS.DataBind() - 'DdlPS.SelectedValueExist(GvRow.DataKey("CvePSCargo").ToEntero) + DdlSubProyectos.Items.Clear() + DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectos.DataBind() + DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectos.SelectedValueExist(GvRow.DataKey("CveSubProyecto").ToEntero) BtnAgregarFolioGarantiaModal.Text = "Actualizar" diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 1d8d3ddcc..3762fb841 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -480,7 +480,7 @@ Public Class ClsAcumuladores Return Retorno End Function - Public Function FoliosGarantiaAdd(FolioGarantia As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Public Function FoliosGarantiaAdd(FolioGarantia As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -492,6 +492,7 @@ Public Class ClsAcumuladores .Add("@Estatus", SqlDbType.Bit).Value = Estatus .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With @@ -507,7 +508,7 @@ Public Class ClsAcumuladores Return Retorno End Function - Public Function FoliosGarantiaUpdate(CveFolioGarantia As Integer, FolioGarantia As String, Estatus As Integer, CveUsuario As Integer) As Boolean + Public Function FoliosGarantiaUpdate(CveFolioGarantia As Integer, FolioGarantia As String, Estatus As Integer, CveUsuario As Integer, CveSubProyecto As Integer) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -519,6 +520,7 @@ Public Class ClsAcumuladores .Add("@FolioGarantia", SqlDbType.VarChar).Value = FolioGarantia .Add("@Estatus", SqlDbType.Bit).Value = Estatus .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With diff --git a/Ashx/SIGPolizaVirtual.ashx b/Ashx/SIGPolizaVirtual.ashx index e7f2621e1..6ba9db938 100644 --- a/Ashx/SIGPolizaVirtual.ashx +++ b/Ashx/SIGPolizaVirtual.ashx @@ -1,5 +1,6 @@ <%@ WebHandler Language="VB" Class="SIGPolizaVirtual" %> +Imports Fluent Imports System Imports System.Web Imports System.Net.Http @@ -9,61 +10,187 @@ Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Imports Extensiones Imports System.IO +Imports System.Runtime.CompilerServices Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState Protected ReadOnly Property User As String = "cslth.2809@jcilink.com" Protected ReadOnly Property Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076" +#Region "U S U A R I O - T O K E N" + + Private Function ValidaUsuarioSistema(CveEmpresa As Integer, Optional CveUsuario As Integer = 100) As Usuario + + Dim UsuarioToken As Usuario = Nothing + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetUsuarios(CveUsuario) Then + If ObjUsuarios.DtResultados.Rows.Count > 0 Then + Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() + Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() + UsuarioToken = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa) + UsuarioToken.CveEmpresa = CveEmpresa + CreaObjetoEmpresa(UsuarioToken) + End If + End If + ObjUsuarios.Dispose() + Return UsuarioToken + End Function + Private Sub CreaObjetoEmpresa(ByRef UsuarioToken As Usuario) + + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(UsuarioToken.CveEmpresa, "-1", "-1", "-1", "-1") Then + If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioToken.CveEmpresa) Then + Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados + + Dim EmpresasFuncionalidades As New HybridDictionary + For Each Row As Data.DataRow In dttmp.Rows + EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString) + Next + ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades) + End If + + UsuarioToken.Empresa = ObjEmpresa.Empresa + End If + ObjEmpresa.Dispose() + End Sub +#End Region + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest context.Response.ContentType = "application/json" - EnviarPolizaVentaWS(context) - EnviarPolizaVentaLTHWSD(context) - EnviarPolizaIndicadores(context) + Dim usuario = ValidaUsuarioSistema(140, 100) + Dim ObjFactura As New Modelos.Factura(usuario, 898028, 140) + + GeneraPolizaVentaWS(context, ObjFactura) + 'GeneraPolizaVentaLTHWSD(context) + 'GeneraIndicadores(context) End Sub + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property - Private Sub EnviarPolizaVentaLTHWSD(ByVal context As HttpContext) + Protected Sub GeneraPolizaVentaWS(ByVal context As HttpContext, ObjFactura As Modelos.Factura) + Dim obj As New MPolizaVentaWS + 'DATOS DEL CLIENTE + obj.customer_name = ObjFactura.Cliente.Nombre + obj.customer_last_name1 = "" + obj.customer_last_name2 = "" + obj.customer_birthday = Nothing + obj.customer_phone = ObjFactura.Cliente.Telefono + obj.customer_email = ObjFactura.Cliente.Mail + obj.customer_gender = "03" 'OTRO GENERO + obj.customer_advertising = False + obj.customer_car_brand = "00" + obj.customer_car_model = "00" + obj.customer_car_year = ObjFactura.Fecha.Year + + 'DATOS DE VENTA + obj.sale_date = Now + obj.sale_paidby = "01" + obj.sale_type = "01" 'PISO + obj.sale_type_service = "01" 'PARTICULAR + obj.sale_total = ObjFactura.Total + obj.sale_discount = ObjFactura.SubTotal + obj.sale_id = GuidGenerator.GenerateTimeBasedGuid().ToString() + + 'Dim PS = ObjFactura.DtDetalle.Rows(0) + 'DATOS DEL PRODUCTO + obj.product_code = "174925" + obj.product_unique_code = "65047187" + obj.product_sale_type = "02" 'AJUSTE + + 'DATOS DE USADO + obj.used_product = True + obj.used_brand = "01" + obj.used_bci = "25" + obj.used_month = 1 + obj.used_year = 2015 + obj.used_sale_date = ObjFactura.Fecha + + EnviarPolizaVentaWS(context, obj) + End Sub + + Protected Sub GeneraPolizaVentaLTHWSD(ByVal context As HttpContext, ObjFactura As Modelos.Factura) + Dim obj As New MPolizaVentaLTHWSD + 'DATOS DEL CLIENTE + obj.customer_name = "JOSE ENRIQUE" + obj.customer_last_name1 = "VIZCARA" + obj.customer_last_name2 = "RENDON" + obj.customer_birthday = Now + obj.customer_phone = "8186545256" + obj.customer_email = "mail@mail.com" + obj.customer_gender = "02" + obj.customer_advertising = False + obj.customer_car_brand = "02" + obj.customer_car_model = "741" + obj.customer_car_year = 2015 + + 'DATOS DE VENTA + obj.sale_date = Now + obj.sale_paidby = "01" + obj.sale_type = "01" + obj.sale_type_service = "01" + obj.sale_discount = 0 + obj.sale_id = GuidGenerator.GenerateTimeBasedGuid().ToString() + + 'DATOS DEL PRODUCTO + obj.product_code = "174925" + obj.product_unique_code = "65047187" + obj.product_sale_type = "01" + + 'DATOS DE USADO + obj.used_product = True + obj.used_brand = "01" + obj.used_bci = "25" + obj.used_month = 1 + obj.used_year = 2015 + obj.used_sale_date = Now + + EnviarPolizaVentaLTHWSD(context, obj) + End Sub + Protected Sub GeneraIndicadores(ByVal context As HttpContext) + Dim obj As New MIndicador(True) + EnviarPolizaIndicadores(context, obj) + End Sub + + Protected Sub EnviarPolizaVentaLTHWSD(ByVal context As HttpContext, obj As MPolizaVentaLTHWSD) Dim Retorno As String = "[]" Try Using wc As New HttpClient() Dim Url = New Uri("http://polizavirtual.com.mx/lthwsd/api/Venta") - Dim Parametros = New List(Of KeyValuePair(Of String, String)) Parametros.Add(New KeyValuePair(Of String, String)("User", User)) Parametros.Add(New KeyValuePair(Of String, String)("password", Password)) - Parametros.Add(New KeyValuePair(Of String, String)("customer_name", "JOSE ENRIQUE VIZCARA RENDON")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name1", "Prueba")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name2", "Prueba")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_birthday", "1900-01-01 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_phone", "5417543010")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_email", "elunap@gmail.com")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_gender", "02")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_advertising", "False")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_date", "2018-07-24 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_paidby", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_type", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_type_service", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("product_code", "174200")) - Parametros.Add(New KeyValuePair(Of String, String)("product_unique_code", "65047187")) - Parametros.Add(New KeyValuePair(Of String, String)("product_sale_type", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("used_product", "True")) - Parametros.Add(New KeyValuePair(Of String, String)("used_brand", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("used_bci", "25")) - Parametros.Add(New KeyValuePair(Of String, String)("used_month", "1")) - Parametros.Add(New KeyValuePair(Of String, String)("used_year", "2015")) - Parametros.Add(New KeyValuePair(Of String, String)("used_sale_date", "2018-07-24 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_brand", "36")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_model", "741")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_year", "2015")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_discount", "0")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_id", "32860")) + Parametros.Add(New KeyValuePair(Of String, String)("customer_name", obj.customer_name)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name1", obj.customer_last_name1)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name2", obj.customer_last_name1)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_birthday", obj.customer_birthday.ToString("yyyy-MM-dd HH:mm:ss"))) + Parametros.Add(New KeyValuePair(Of String, String)("customer_phone", obj.customer_phone)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_email", obj.customer_email)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_gender", obj.customer_gender)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_advertising", obj.customer_advertising.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_date", obj.sale_date.ToString("yyyy-MM-dd HH:mm:ss"))) + Parametros.Add(New KeyValuePair(Of String, String)("sale_paidby", obj.sale_paidby)) + Parametros.Add(New KeyValuePair(Of String, String)("sale_type", obj.sale_type)) + Parametros.Add(New KeyValuePair(Of String, String)("sale_type_service", obj.sale_type_service)) + Parametros.Add(New KeyValuePair(Of String, String)("product_code", obj.product_code)) + Parametros.Add(New KeyValuePair(Of String, String)("product_unique_code", obj.product_unique_code)) + Parametros.Add(New KeyValuePair(Of String, String)("product_sale_type", obj.product_sale_type)) + Parametros.Add(New KeyValuePair(Of String, String)("used_product", obj.used_product.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_brand", obj.used_brand)) + Parametros.Add(New KeyValuePair(Of String, String)("used_bci", obj.used_bci)) + Parametros.Add(New KeyValuePair(Of String, String)("used_month", obj.used_month.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_year", obj.used_year.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_sale_date", obj.used_sale_date.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_brand", obj.customer_car_brand.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_model", obj.customer_car_model.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_year", obj.customer_car_year.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_discount", obj.sale_discount.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_id", obj.sale_id.ToString())) Dim content As New FormUrlEncodedContent(Parametros) Dim response = wc.PostAsync(Url, content).Result @@ -78,7 +205,7 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState context.Response.Write(Retorno) End Sub - Private Sub EnviarPolizaVentaWS(ByVal context As HttpContext) + Protected Sub EnviarPolizaVentaWS(ByVal context As HttpContext, obj As MPolizaVentaWS) Dim Retorno As String = "[]" Try Using wc As New HttpClient() @@ -88,33 +215,33 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState Parametros.Add(New KeyValuePair(Of String, String)("User", User)) Parametros.Add(New KeyValuePair(Of String, String)("password", Password)) - Parametros.Add(New KeyValuePair(Of String, String)("customer_name", "JOSE ENRIQUE ")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name1", "VIZCARA")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name2", "RENDON")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_birthday", "1900-01-01 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_phone", "8186545256")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_email", "mail@mail.com")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_gender", "02")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_advertising", "False")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_date", "2018-07-24 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_paidby", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_type", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_type_service", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("product_code", "174925")) - Parametros.Add(New KeyValuePair(Of String, String)("product_unique_code", "65047187")) - Parametros.Add(New KeyValuePair(Of String, String)("product_sale_type", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_total", "0")) - Parametros.Add(New KeyValuePair(Of String, String)("used_product", "True")) - Parametros.Add(New KeyValuePair(Of String, String)("used_brand", "01")) - Parametros.Add(New KeyValuePair(Of String, String)("used_bci", "25")) - Parametros.Add(New KeyValuePair(Of String, String)("used_month", "1")) - Parametros.Add(New KeyValuePair(Of String, String)("used_year", "2015")) - Parametros.Add(New KeyValuePair(Of String, String)("used_sale_date", "2018-07-24 00:00:00")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_brand", "36")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_model", "741")) - Parametros.Add(New KeyValuePair(Of String, String)("customer_car_year", "2015")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_discount", "0")) - Parametros.Add(New KeyValuePair(Of String, String)("sale_id", "32860")) + Parametros.Add(New KeyValuePair(Of String, String)("customer_name", obj.customer_name)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name1", obj.customer_last_name1)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_last_name2", obj.customer_last_name1)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_birthday", obj.customer_birthday.ToString("yyyy-MM-dd HH:mm:ss"))) + Parametros.Add(New KeyValuePair(Of String, String)("customer_phone", obj.customer_phone)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_email", obj.customer_email)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_gender", obj.customer_gender)) + Parametros.Add(New KeyValuePair(Of String, String)("customer_advertising", obj.customer_advertising.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_date", obj.sale_date.ToString("yyyy-MM-dd HH:mm:ss"))) + Parametros.Add(New KeyValuePair(Of String, String)("sale_paidby", obj.sale_paidby)) + Parametros.Add(New KeyValuePair(Of String, String)("sale_type", obj.sale_type)) + Parametros.Add(New KeyValuePair(Of String, String)("sale_type_service", obj.sale_type_service)) + Parametros.Add(New KeyValuePair(Of String, String)("product_code", obj.product_code)) + Parametros.Add(New KeyValuePair(Of String, String)("product_unique_code", obj.product_unique_code)) + Parametros.Add(New KeyValuePair(Of String, String)("product_sale_type", obj.product_sale_type)) + Parametros.Add(New KeyValuePair(Of String, String)("sale_total", obj.sale_total.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_product", obj.used_product.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_brand", obj.used_brand)) + Parametros.Add(New KeyValuePair(Of String, String)("used_bci", obj.used_bci)) + Parametros.Add(New KeyValuePair(Of String, String)("used_month", obj.used_month.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_year", obj.used_year.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("used_sale_date", obj.used_sale_date.ToString("yyyy-MM-dd HH:mm:ss"))) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_brand", obj.customer_car_brand.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_model", obj.customer_car_model.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("customer_car_year", obj.customer_car_year.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_discount", obj.sale_discount.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("sale_id", obj.sale_id.ToString())) Dim content As New FormUrlEncodedContent(Parametros) Dim response = wc.PostAsync(Url, content).Result @@ -129,7 +256,7 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState context.Response.Write(Retorno) End Sub - Private Sub EnviarPolizaIndicadores(ByVal context As HttpContext) + Protected Sub EnviarPolizaIndicadores(ByVal context As HttpContext, obj As MIndicador) Dim Retorno As String = "[]" Try Using wc As New HttpClient() @@ -139,47 +266,47 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState Parametros.Add(New KeyValuePair(Of String, String)("User", User)) Parametros.Add(New KeyValuePair(Of String, String)("password", Password)) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_optima", "1")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_fullpower", "2")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_hitec", "3")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_agm", "4")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_suv", "5")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_taxi", "6")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_america", "7")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_lth", "8")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_cronos", "9")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_diener", "10")) - Parametros.Add(New KeyValuePair(Of String, String)("v_b_heavyduty", "11")) - Parametros.Add(New KeyValuePair(Of String, String)("v_m_lth", "12")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_filtros", "13")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_lub1", "14")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_lubgalon", "15")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_lub5", "16")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_aa", "17")) - Parametros.Add(New KeyValuePair(Of String, String)("v_o_aaa", "18")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_optima", "19")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_fullpower", "20")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_hitec", "21")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_agm", "22")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_suv", "23")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_taxi", "24")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_america", "25")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_lth", "26")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_cronos", "27")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_diener", "28")) - Parametros.Add(New KeyValuePair(Of String, String)("g_b_heavyduty", "29")) - Parametros.Add(New KeyValuePair(Of String, String)("g_m_lth", "30")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_optima", "31")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_fullpower", "32")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_hitec", "33")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_agm", "34")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_suv", "35")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_taxi", "36")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_america", "37")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_lth", "38")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_cronos", "39")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_diener", "40")) - Parametros.Add(New KeyValuePair(Of String, String)("a_b_heavyduty", "41")) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_optima", obj.v_b_optima.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_fullpower", obj.v_b_fullpower.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_hitec", obj.v_b_hitec.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_agm", obj.v_b_agm.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_suv", obj.v_b_suv.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_taxi", obj.v_b_taxi.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_america", obj.v_b_america.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_lth", obj.v_b_lth.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_cronos", obj.v_b_cronos.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_diener", obj.v_b_diener.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_b_heavyduty", obj.v_b_heavyduty.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_m_lth", obj.v_m_lth.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_filtros", obj.v_o_filtros.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_lub1", obj.v_o_lub1.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_lubgalon", obj.v_o_lubgalon.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_lub5", obj.v_o_lub5.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_aa", obj.v_o_aa.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("v_o_aaa", obj.v_o_aaa.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_optima", obj.g_b_optima.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_fullpower", obj.g_b_fullpower.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_hitec", obj.g_b_hitec.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_agm", obj.g_b_agm.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_suv", obj.g_b_suv.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_taxi", obj.g_b_taxi.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_america", obj.g_b_america.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_lth", obj.g_b_lth.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_cronos", obj.g_b_cronos.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_diener", obj.g_b_diener.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_b_heavyduty", obj.g_b_heavyduty.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("g_m_lth", obj.g_m_lth.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_optima", obj.a_b_optima.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_fullpower", obj.a_b_fullpower.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_hitec", obj.a_b_hitec.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_agm", obj.a_b_agm.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_suv", obj.a_b_suv.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_taxi", obj.a_b_taxi.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_america", obj.a_b_america.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_lth", obj.a_b_lth.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_cronos", obj.a_b_cronos.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_diener", obj.a_b_diener.ToString())) + Parametros.Add(New KeyValuePair(Of String, String)("a_b_heavyduty", obj.a_b_heavyduty.ToString())) Dim content As New FormUrlEncodedContent(Parametros) Dim response = wc.PostAsync(Url, content).Result @@ -194,4 +321,217 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState context.Response.Write(Retorno) End Sub -End Class \ No newline at end of file +End Class + +Public Class MPolizaVentaLTHWSD + Public Property customer_name As String + Public Property customer_last_name1 As String + Public Property customer_last_name2 As String + Public Property customer_birthday As DateTime + Public Property customer_phone As String + Public Property customer_email As String + Public Property customer_gender As String + Public Property customer_advertising As Boolean + Public Property sale_date As DateTime + Public Property sale_paidby As String + Public Property sale_type As String + Public Property sale_type_service As String + Public Property product_code As String + Public Property product_unique_code As String + Public Property product_sale_type As String + Public Property used_product As Boolean + Public Property used_brand As String + Public Property used_bci As String + Public Property used_month As Integer + Public Property used_year As Integer + Public Property used_sale_date As DateTime + Public Property customer_car_brand As String + Public Property customer_car_model As String + Public Property customer_car_year As Integer + Public Property sale_discount As Decimal + Public Property sale_id As String +End Class + +Public Class MPolizaVentaWS + Public Property customer_name As String + Public Property customer_last_name1 As String + Public Property customer_last_name2 As String + Public Property customer_birthday As DateTime + Public Property customer_phone As String + Public Property customer_email As String + Public Property customer_gender As String + Public Property customer_advertising As Boolean + Public Property sale_date As DateTime + Public Property sale_paidby As String + Public Property sale_type As String + Public Property sale_type_service As String + Public Property sale_total As Decimal + Public Property product_code As String + Public Property product_unique_code As String + Public Property product_sale_type As String + Public Property used_product As Boolean + Public Property used_brand As String + Public Property used_bci As String + Public Property used_month As Integer + Public Property used_year As Integer + Public Property used_sale_date As DateTime + Public Property customer_car_brand As String + Public Property customer_car_model As String + Public Property customer_car_year As Integer + Public Property sale_discount As Decimal + Public Property sale_id As String +End Class + +Public Class MIndicador + + Sub New(Optional UsaValoresPrueba As Boolean = False) + If UsaValoresPrueba Then + Dim Index As Integer = 0 + For Each p As Reflection.PropertyInfo In Me.GetType().GetProperties() + Index = Index + 1 + p.SetValue(Me, Convert.ChangeType(Index, p.PropertyType), Nothing) + Next + End If + End Sub + + Public Property v_b_optima As Integer + Public Property v_b_fullpower As Integer + Public Property v_b_hitec As Integer + Public Property v_b_agm As Integer + Public Property v_b_suv As Integer + Public Property v_b_taxi As Integer + Public Property v_b_america As Integer + Public Property v_b_lth As Integer + Public Property v_b_cronos As Integer + Public Property v_b_diener As Integer + Public Property v_b_heavyduty As Integer + Public Property v_m_lth As Integer + Public Property v_o_filtros As Integer + Public Property v_o_lub1 As Integer + Public Property v_o_lubgalon As Integer + Public Property v_o_lub5 As Integer + Public Property v_o_aa As Integer + Public Property v_o_aaa As Integer + Public Property g_b_optima As Integer + Public Property g_b_fullpower As Integer + Public Property g_b_hitec As Integer + Public Property g_b_agm As Integer + Public Property g_b_suv As Integer + Public Property g_b_taxi As Integer + Public Property g_b_america As Integer + Public Property g_b_lth As Integer + Public Property g_b_cronos As Integer + Public Property g_b_diener As Integer + Public Property g_b_heavyduty As Integer + Public Property g_m_lth As Integer + Public Property a_b_optima As Integer + Public Property a_b_fullpower As Integer + Public Property a_b_hitec As Integer + Public Property a_b_agm As Integer + Public Property a_b_suv As Integer + Public Property a_b_taxi As Integer + Public Property a_b_america As Integer + Public Property a_b_lth As Integer + Public Property a_b_cronos As Integer + Public Property a_b_diener As Integer + Public Property a_b_heavyduty As Integer +End Class + + + +Namespace Fluent + Public Enum GuidVersion + TimeBased = &H1 + Reserved = &H2 + NameBased = &H3 + Random = &H4 + End Enum + + Partial Public Module GuidGenerator + Public Const ByteArraySize = 16 + Public Const VariantByte = 8 + Public Const VariantByteMask = &H3F + Public Const VariantByteShift = &H80 + Public Const VersionByte = 7 + Public Const VersionByteMask = &HF + Public Const VersionByteShift = 4 + Private Const TimestampByte As Byte = 0 + Private Const GuidClockSequenceByte As Byte = 8 + Private Const NodeByte As Byte = 10 + Private ReadOnly GregorianCalendarStart As DateTimeOffset = New DateTimeOffset(1582, 10, 15, 0, 0, 0, TimeSpan.Zero) + Public Property DefaultClockSequence As Byte() + Public Property DefaultNode As Byte() + + Sub New() + DefaultClockSequence = New Byte(1) {} + DefaultNode = New Byte(5) {} + Dim random = New Random + random.NextBytes(DefaultClockSequence) + random.NextBytes(DefaultNode) + End Sub + + + Function GetVersion(ByVal guid As Guid) As GuidVersion + Dim bytes = guid.ToByteArray + Return ((bytes(VersionByte) And &HFF) >> VersionByteShift) + End Function + + Function GetDateTimeOffset(ByVal guid As Guid) As DateTimeOffset + Dim bytes As Byte() = guid.ToByteArray + bytes(VersionByte) = bytes(VersionByte) And CByte(VersionByteMask) + bytes(VersionByte) = bytes(VersionByte) Or (CByte(GuidVersion.TimeBased) >> VersionByteShift) + Dim timestampBytes = New Byte(7) {} + Array.Copy(bytes, TimestampByte, timestampBytes, 0, 8) + Dim timestamp As Long = BitConverter.ToInt64(timestampBytes, 0) + Dim ticks As Long = timestamp + GregorianCalendarStart.Ticks + + Return New DateTimeOffset(ticks, TimeSpan.Zero) + End Function + + Function GetDateTime(ByVal guid As Guid) As Date + Return GetDateTimeOffset(guid).DateTime + End Function + + Function GetLocalDateTime(ByVal guid As Guid) As Date + Return GetDateTimeOffset(guid).LocalDateTime + End Function + + Function GetUtcDateTime(ByVal guid As Guid) As Date + Return GetDateTimeOffset(guid).UtcDateTime + End Function + + Function GenerateTimeBasedGuid() As Guid + Return GenerateTimeBasedGuid(DateTimeOffset.UtcNow, DefaultClockSequence, DefaultNode) + End Function + + Function GenerateTimeBasedGuid(ByVal dateTime As Date) As Guid + Return GenerateTimeBasedGuid(dateTime, DefaultClockSequence, DefaultNode) + End Function + + Function GenerateTimeBasedGuid(ByVal dateTime As DateTimeOffset) As Guid + Return GenerateTimeBasedGuid(dateTime, DefaultClockSequence, DefaultNode) + End Function + + Function GenerateTimeBasedGuid(ByVal dateTime As Date, ByVal clockSequence As Byte(), ByVal node As Byte()) As Guid + Return GenerateTimeBasedGuid(New DateTimeOffset(dateTime), clockSequence, node) + End Function + + Function GenerateTimeBasedGuid(ByVal dateTime As DateTimeOffset, ByVal clockSequence As Byte(), ByVal node As Byte()) As Guid + If clockSequence Is Nothing Then Throw New ArgumentNullException("clockSequence") + If node Is Nothing Then Throw New ArgumentNullException("node") + If clockSequence.Length <> 2 Then Throw New ArgumentOutOfRangeException("clockSequence", "The clockSequence must be 2 bytes.") + If node.Length <> 6 Then Throw New ArgumentOutOfRangeException("node", "The node must be 6 bytes.") + Dim ticks = (dateTime - GregorianCalendarStart).Ticks + Dim guid = New Byte(15) {} + Dim timestamp = BitConverter.GetBytes(ticks) + Array.Copy(node, 0, guid, NodeByte, Math.Min(6, node.Length)) + Array.Copy(clockSequence, 0, guid, GuidClockSequenceByte, Math.Min(2, clockSequence.Length)) + Array.Copy(timestamp, 0, guid, TimestampByte, Math.Min(8, timestamp.Length)) + guid(VariantByte) = guid(VariantByte) And CByte(VariantByteMask) + guid(VariantByte) = guid(VariantByte) Or CByte(VariantByteShift) + guid(VersionByte) = guid(VersionByte) And CByte(VersionByteMask) + guid(VersionByte) = guid(VersionByte) Or (CByte(GuidVersion.TimeBased) << VersionByteShift) + Return New Guid(guid) + End Function + End Module +End Namespace diff --git a/Bancos/PagoDeudor.aspx b/Bancos/PagoDeudor.aspx index b85dc3acc..1e15b6086 100644 --- a/Bancos/PagoDeudor.aspx +++ b/Bancos/PagoDeudor.aspx @@ -374,7 +374,7 @@
- + diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index 661fd2abd..e837bbdfa 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -445,7 +445,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas } bool AutoConta = UsuarioActual.Empresa.Funcionalidad(200).Equals("1"); - if (UsuarioActual.CveEmpresa == 119) AutoConta = false; + // if (UsuarioActual.CveEmpresa == 119) AutoConta = false; if (AutoConta && MsgError.Equals("")) { @@ -708,6 +708,14 @@ public partial class Bancos_PagoDeudor : ClsPaginas { if (gvr.FCCheckBox("Chk").Checked) { + + Decimal TCDoc = gvr.DataKey("TipoCambio").ToDecimal(); // tipo de cambio de IE + if (gvr.DataKey("FechaDocumento").ToDate() < TxtFechaDocumento.Text.ToDate().FirstDayOfMonth()) + { + // si la fecha del documento a pagar es menor al primer dia del mes del pago, toma el TC del mes anterior + TCDoc = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate().AddMonths(-1).LastDayOfMonth()).ToDecimal(); + } + Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal(); ImporteMN = Importe; ImporteComplementaria = 0; @@ -722,11 +730,11 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (UsaComplementaria) { ImporteMN = Importe; - ImporteComplementaria = Importe * gvr.DataKey("TipoCambio").ToDecimal() - Importe; + ImporteComplementaria = Importe * TCDoc - Importe; } else { - ImporteMN = Importe * gvr.DataKey("TipoCambio").ToDecimal(); + ImporteMN = Importe * TCDoc; ImporteComplementaria = 0; } } @@ -740,11 +748,11 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (UsaComplementaria) { ImporteMN = Importe; - ImporteComplementaria = Importe * gvr.DataKey("TipoCambio").ToDecimal() - Importe; + ImporteComplementaria = Importe * TCDoc - Importe; } else { - ImporteMN = Importe * gvr.DataKey("TipoCambio").ToDecimal(); + ImporteMN = Importe * TCDoc; ImporteComplementaria = 0; } } @@ -755,32 +763,32 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (tCveMoneda != 1) { - if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePago, Conc, DateTime.Now, IDCtaContableDeudor, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: gvr.DataKey("TipoCambio").ToDecimal(), TipoCambioPago: TC,CveSubProyecto:DdlSubProyectoPago.SelectedValue.ToEntero())) + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePago, Conc, DateTime.Now, IDCtaContableDeudor, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TCDoc, TipoCambioPago: TC,CveSubProyecto:DdlSubProyectoPago.SelectedValue.ToEntero())) { MsgError = "No se pudo insertar concepto de pago deudor"; break; } if (UsaComplementaria) { - if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePagoComplementaria, Conc, DateTime.Now, IDCtaContableDeudorComplementaria, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: gvr.DataKey("TipoCambio").ToDecimal(), TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePagoComplementaria, Conc, DateTime.Now, IDCtaContableDeudorComplementaria, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: TCDoc, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) { MsgError = "No se pudo insertar concepto de deudor complementaria"; } } - if (TC != gvr.DataKey("TipoCambio").ToDecimal()) + if (TC != TCDoc) { int CveConceptoDiferenciaCambiaria = 0; bool TipoMovto = false; int IdCtaContableDiferenciaCambiaria = 0; - if (TC gvr.DataKey("TipoCambio").ToDecimal()) + else if (TC > TCDoc) { CveConceptoDiferenciaCambiaria = 64; IdCtaContableDiferenciaCambiaria = UsuarioActual.Empresa.IdCuentaGananciaCambiaria; diff --git a/Bancos/PolizaCheque.aspx.vb b/Bancos/PolizaCheque.aspx.vb index e58e68f16..a1c46d03d 100644 --- a/Bancos/PolizaCheque.aspx.vb +++ b/Bancos/PolizaCheque.aspx.vb @@ -900,14 +900,14 @@ Partial Class Bancos_PolizaCheque Importe = Importe * TC End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Referencia, gvr.DataKey("CveConcepto").ToEntero, TxtObservaciones.Text, Now, gvr.DataKey("IDCuenta").ToEntero, -1, CveIE, CveProveedor:=CveProveedor, CveSubProyecto:=If(UsuarioActual.CveEmpresa = 119, gvr.FCDropDownList("DdlSubProyecto").ToEntero, gvr.DataKey("CveSubProyecto").ToEntero), CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, ImporteMX:=Importe, CveCuenta:=If(UsuarioActual.Empresa.UsaContabilidad AndAlso UsuarioActual.Empresa.UsaContabilidadSIG, ObtenerCuentaDobleConta(gvr.DataKey("IDCuenta").ToEntero, UsuarioActual.CveEmpresa), -1), TipoCambio:=TC) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Referencia, gvr.DataKey("CveConcepto").ToEntero, TxtObservaciones.Text, Now, gvr.DataKey("IDCuenta").ToEntero, -1, CveIE, CveProveedor:=CveProveedor, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, ImporteMX:=Importe, CveCuenta:=If(UsuarioActual.Empresa.UsaContabilidad AndAlso UsuarioActual.Empresa.UsaContabilidadSIG, ObtenerCuentaDobleConta(gvr.DataKey("IDCuenta").ToEntero, UsuarioActual.CveEmpresa), -1), TipoCambio:=TC) Then MsgError = "no se pudo insertar el detalle de la póliza2" End If If gvr.DataKey("CveConcepto").ToEntero = 30 Then If CveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then 'Agregamos complementaria - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, 0, gvr.FCTextBox("TxtConcepto").Text, 204, TxtObservaciones.Text, Now, dr("IDCtaContableComplementaria").ToString.ToEntero, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, CveSubProyecto:=If(UsuarioActual.CveEmpresa = 119, gvr.FCDropDownList("DdlSubProyecto").ToEntero, gvr.DataKey("CveSubProyecto").ToEntero), CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, ImporteMX:=Importe * TC - Importe, ImporteME:=Importe, TipoCambio:=TC) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, 0, gvr.FCTextBox("TxtConcepto").Text, 204, TxtObservaciones.Text, Now, dr("IDCtaContableComplementaria").ToString.ToEntero, -1, CveIE:=CveIE, CveProveedor:=CveProveedor, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, ImporteMX:=Importe * TC - Importe, ImporteME:=Importe, TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If End If diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 29c9eeb36..23de03c5a 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -367,7 +367,7 @@ - + Factura diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 6f7796a67..9ee86c31d 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -1811,7 +1811,7 @@ Partial Class Bancos_ProveedoresAbonar End If End If - If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then + If MsgError <> "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjMov.ValorPolizaDescuadre > 0 Then MsgError = ObjMov.MensajePolizaDescuadre + " " + ObjMov.ValorDiferencia GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") diff --git a/Bancos/RepEgresosSinComprobante.aspx b/Bancos/RepEgresosSinComprobante.aspx index 3b425d2d0..957f1555a 100644 --- a/Bancos/RepEgresosSinComprobante.aspx +++ b/Bancos/RepEgresosSinComprobante.aspx @@ -16,7 +16,13 @@ Otros Egresos
  • - Saldar + Viaticos-Personal +
  • +
  • + Saldar Proveedores +
  • +
  • + Saldar FyE
  • @@ -153,7 +159,7 @@ - + @@ -212,8 +218,14 @@ - + + + + + + diff --git a/Bancos/RepEgresosSinComprobante.aspx.vb b/Bancos/RepEgresosSinComprobante.aspx.vb index e68307aa3..33322b9bd 100644 --- a/Bancos/RepEgresosSinComprobante.aspx.vb +++ b/Bancos/RepEgresosSinComprobante.aspx.vb @@ -180,53 +180,88 @@ Partial Class Bancos_RepEgresosSinComprobante gr.FCCheckBox("Chk").Visible = True LnkSaldar.Visible = True LnkHabilitarSaldar.Visible = False - 'portletBody.Attributes.Remove("style") - 'portletBody.Attributes.Add("style", "display: block;") - - 'HExtensorFiltro.Attributes.Remove("class") - 'HExtensorFiltro.Attributes.Add("class", "collapse") - - 'UPFiltros.Update() UPDatos.Update() End If Next + End Sub + Private Sub LnkHabilitarSaldoFyE_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldarFyE.Click + For Each gr As GridViewRow In GvPersonal.Rows + If gr.DataKey("CvePersonal") <> "" Then + gr.FCCheckBox("Chk").Visible = True + LnkSaldarFyE.Visible = True + LnkHabilitarSaldarFyE.Visible = False + upDatosPersonal.Update() + End If + Next End Sub Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() + Dim ObjProveedor As New ClsCompProveedores(ObjConta.IniciaTransacSQL()) + Dim CvePrePoliza As Integer = 0 Dim MsgError As String = "" + Try + For Each gr As GridViewRow In GvESC.Rows + If gr.FCCheckBox("Chk").Checked Then + Dim CveCuenta As Integer = 0 + Dim IdCtaContable As Integer = 0 + Dim CveConceptoContable As Integer + + Select Case gr.DataKey("CveConceptoContable").ToEntero + Case 10 + CveConceptoContable = 21 + Case 28 + CveConceptoContable = 29 + Case 37 + CveConceptoContable = 43 + Case 42 + CveConceptoContable = 41 + Case 43 + CveConceptoContable = 37 + End Select + + If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, gr.DataKey("CveProveedor").ToEntero, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + If ObjProveedor.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjProveedor.IdCtaContProveedores + End If + End If + + If ObjConta.GetCuentaDobleConta(IdCtaContable, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuenta = ObjConta.DtResultados.Rows(0)("CveCuenta").ToString.ToEntero + End If + End If + + CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepEgresosSinComprobante", 6, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, + "Saldo de ExC por Sistema", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, gr.DataKey("Saldo").ToDecimal, "", CveConceptoContable, "Saldo de ExC por Sistema", Now, -1, -1, + gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, + ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then + MsgError = "Ocurrio un error al saldar el movimiento" + Exit For + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, gr.DataKey("Saldo").ToDecimal, "", 78, "Saldo de ExC por Sistema", Now, -1, -1, gr.DataKey("CveIE").ToEntero, + ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then + MsgError = "Ocurrio un error al saldar el movimiento" + Exit For + End If + + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Alert("Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + End If + End If + + End If + Next + Catch ex As Exception + MsgError = "Ocurrió un error al generar la prepoliza" + OnError(MsgError, ex) + End Try - For Each gr As GridViewRow In GvESC.Rows - If gr.FCCheckBox("Chk").Checked Then - Dim CveCuenta As Integer = 0 - Dim CveConceptoContable As Integer - - Select Case gr.DataKey("CveConceptoContable").ToEntero - Case 10 - CveConceptoContable = 21 - Case 28 - CveConceptoContable = 29 - Case 37 - CveConceptoContable = 43 - Case 42 - CveConceptoContable = 41 - Case 43 - CveConceptoContable = 37 - End Select - - CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepEgresosSinComprobante", 6, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldo de ExC por Sistema", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, gr.DataKey("Saldo").ToDecimal, "", CveConceptoContable, "Saldo de ExC por Sistema", Now, -1, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then - MsgError = "Ocurrio un error al saldar el movimiento" - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, gr.DataKey("Saldo").ToDecimal, "", 78, "Saldo de ExC por Sistema", Now, -1, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=-1) Then - MsgError = "Ocurrio un error al saldar el movimiento" - End If - End If - Next If MsgError = "" Then ObjConta.Commit() @@ -239,11 +274,96 @@ Partial Class Bancos_RepEgresosSinComprobante LnkSaldar.Visible = False LnkHabilitarSaldar.Visible = True + ObjConta.Dispose() - End Sub + ObjProveedor.Dispose() + End Sub + Protected Sub LnkSaldarFyE_Click(sender As Object, e As EventArgs) + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim CvePrePoliza As Integer = 0 + Dim MsgError As String = "" + + Try + For Each gr As GridViewRow In GvPersonal.Rows + If gr.FCCheckBox("Chk").Checked Then + Dim CveCuenta As Integer = 0 + Dim IdCtaContPersonal As Integer = 0 + Dim CveConceptoContable As Integer + + Select Case gr.DataKey("CveConceptoContable").ToEntero + Case 10 + CveConceptoContable = 21 + Case 28 + CveConceptoContable = 29 + Case 37 + CveConceptoContable = 43 + Case 42 + CveConceptoContable = 41 + Case 43 + CveConceptoContable = 37 + End Select + + If ObjConta.GetRetCuenta(CveConceptoContable, gr.DataKey("CvePersonal").ToEntero) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + IdCtaContPersonal = ObjConta.DtResultados.Rows(0)("IdCtaContPersonal").ToString.ToEntero + End If + End If + + If ObjConta.GetCuentaDobleConta(IdCtaContPersonal, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuenta = ObjConta.DtResultados.Rows(0)("CveCuenta").ToString.ToEntero + End If + End If + + CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepEgresosSinComprobante", 6, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, + "Saldo de ExC por Sistema", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, gr.DataKey("Saldo").ToDecimal, "", CveConceptoContable, "Saldo de ExC por Sistema", Now, -1, -1, + gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, + ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then + MsgError = "Ocurrio un error al saldar el movimiento" + Exit For + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, gr.DataKey("Saldo").ToDecimal, "", 78, "Saldo de ExC por Sistema", Now, -1, -1, gr.DataKey("CveIE").ToEntero, + ImporteMX:=gr.DataKey("Saldo").ToDecimal, CveCuenta:=CveCuenta) Then + MsgError = "Ocurrio un error al saldar el movimiento" + Exit For + End If + + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Alert("Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + End If + End If + + End If + Next + Catch ex As Exception + MsgError = "Ocurrió un error al generar la prepoliza" + OnError(MsgError, ex) + End Try + + + If MsgError = "" Then + ObjConta.Commit() + CargaDatos() + Alert("Los movimientos se saldaron correctamente.") + Else + ObjConta.RollBack() + Alert(MsgError, TipoMensaje.MsgError) + End If + + LnkSaldarFyE.Visible = False + LnkHabilitarSaldarFyE.Visible = True + ObjConta.Dispose() + End Sub + + #Region "IMPRESIONES" - + Private Sub ImprimirReportePdf(Archivo As String, DtDatos As DataTable, Optional Formato As String = "PDF") If DtDatos.Rows.Count > 0 Then Dim StrFiltro As New StringBuilder diff --git a/Bin/APP_Code_CSharp.dll b/Bin/APP_Code_CSharp.dll index 7e7523cc5..becf87606 100644 Binary files a/Bin/APP_Code_CSharp.dll and b/Bin/APP_Code_CSharp.dll differ diff --git a/Bin/APP_Code_CSharp.pdb b/Bin/APP_Code_CSharp.pdb index 9f610333e..e08316fcb 100644 Binary files a/Bin/APP_Code_CSharp.pdb and b/Bin/APP_Code_CSharp.pdb differ diff --git a/Bin/ClbNegBICFDv3_2.dll b/Bin/ClbNegBICFDv3_2.dll index 8ccf14b8c..fb9e13010 100644 Binary files a/Bin/ClbNegBICFDv3_2.dll and b/Bin/ClbNegBICFDv3_2.dll differ diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index a3b6472f7..5f537d57a 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -301,7 +301,7 @@ No Recibidas - @@ -338,7 +338,7 @@ - + @@ -380,6 +380,12 @@ + + + + + + diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 683c2a728..ef2355aba 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -1017,7 +1017,7 @@ Partial Class Compras_eFacturas e.Row.FCLinkButton("LnkAgregarPagoP").Visible = True End If Else - e.Row.FCLiteral("LtlXML").Text = "N/D" + e.Row.FCLiteral("LtlXML").Text = "N/D" ' String.Format("{0}{1}\{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("XML")) ' If e.Row.DBCampo("TipoComprobante") = "P" Then e.Row.FCLinkButton("LnkAgregarPagoP").Visible = False End If @@ -1026,7 +1026,7 @@ Partial Class Compras_eFacturas If File.Exists(String.Format("{0}{1}/{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("PDF"))) Then e.Row.FCLiteral("LtlPDF").Text = String.Format("Ver", HttpUtility.UrlEncode(e.Row.DBCampo("RFCDe")), HttpUtility.UrlEncode(e.Row.DBCampo("PDF"))) Else - e.Row.FCLiteral("LtlPDF").Text = "N/D" + e.Row.FCLiteral("LtlPDF").Text = "N/D" ' String.Format("{0}{1}/{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("PDF")) End If If e.Row.DBCampo("FueValidado").Contiene("1", "2", "3") Then @@ -3142,4 +3142,134 @@ Partial Class Compras_eFacturas Response.End() End If End Sub + Protected Sub LnkRegenerarPdfnew_Click(sender As Object, e As EventArgs) + Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim objxml As XmlSatCFDI = XmlSatCFDI.readXML(String.Format("{0}{1}\{2}", Destino, gvrow.DataKey("RFCDe"), gvrow.DataKey("XML"))) + If Not IsNothing(objxml) Then + Dim rutaReporte As String = String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "\Empresas\Grales\Formatos\CFDIV3.rdlc") + If Not IsNothing(objxml.complemento.Pagos) Then + rutaReporte = String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "\Empresas\Grales\Formatos\CFDIV3Pago.rdlc") + End If + Dim NombreArchivo As String = String.Format("{0}{1}\{2}", Destino, gvrow.DataKey("RFCDe"), gvrow.DataKey("PDF")) + + + Dim QR As ClbNegBICFDv3_2.ClsNegCBBGenerar = New ClbNegBICFDv3_2.ClsNegCBBGenerar() + Dim cQr As Byte() = QR.GenerarCBBBytes(objxml.emisor.Rfc, objxml.receptor.Rfc, If(IsNothing(objxml.complemento.Pagos), objxml.comprobante.Total, objxml.complemento.Pagos.Monto), objxml.complemento.UUID) + Dim parametros As List(Of ReportParameter) = New List(Of ReportParameter)() + parametros.Add(New ReportParameter("comprobante_Certificado", objxml.comprobante.Certificado)) + parametros.Add(New ReportParameter("comprobante_CondicionesDePago", objxml.comprobante.CondicionesDePago)) + parametros.Add(New ReportParameter("comprobante_Confirmacion", objxml.comprobante.Confirmacion)) + parametros.Add(New ReportParameter("comprobante_Fecha", objxml.comprobante.Fecha)) + parametros.Add(New ReportParameter("comprobante_Serie", objxml.comprobante.Serie)) + parametros.Add(New ReportParameter("comprobante_Folio", objxml.comprobante.Folio)) + parametros.Add(New ReportParameter("comprobante_Descuento", objxml.comprobante.Descuento.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_SubTotal", objxml.comprobante.SubTotal.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_Total", objxml.comprobante.Total.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_Version", objxml.comprobante.Version)) + parametros.Add(New ReportParameter("comprobante_TipoDeComprobante", objxml.comprobante.TipoDeComprobanteTexto)) + parametros.Add(New ReportParameter("comprobante_FormaPago", objxml.comprobante.FormaPagoTexto)) + parametros.Add(New ReportParameter("comprobante_LugarExpedicion", objxml.comprobante.LugarExpedicion)) + parametros.Add(New ReportParameter("comprobante_NoCertificado", objxml.comprobante.NoCertificado)) + parametros.Add(New ReportParameter("comprobante_Sello", objxml.comprobante.Sello)) + parametros.Add(New ReportParameter("comprobante_Moneda", objxml.comprobante.Moneda)) + parametros.Add(New ReportParameter("comprobante_TipoCambio", objxml.comprobante.TipoCambio.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_MetodoPago", objxml.comprobante.MetodoPagoTexto)) + parametros.Add(New ReportParameter("emisor_Rfc", objxml.emisor.Rfc)) + parametros.Add(New ReportParameter("emisor_Nombre", objxml.emisor.Nombre)) + parametros.Add(New ReportParameter("emisor_RegimenFiscal", objxml.emisor.RegimenFiscalTexto)) + parametros.Add(New ReportParameter("receptor_Rfc", objxml.receptor.Rfc)) + parametros.Add(New ReportParameter("receptor_Nombre", objxml.receptor.Nombre)) + parametros.Add(New ReportParameter("receptor_NumRegIdTrib", objxml.receptor.NumRegIdTrib)) + parametros.Add(New ReportParameter("receptor_ResidenciaFiscal", objxml.receptor.ResidenciaFiscal)) + parametros.Add(New ReportParameter("receptor_UsoCFDI", objxml.receptor.UsoCFDITexto)) + parametros.Add(New ReportParameter("complemento_FechaTimbrado", objxml.complemento.FechaTimbrado)) + parametros.Add(New ReportParameter("complemento_NoCertificadoSAT", objxml.complemento.NoCertificadoSAT)) + parametros.Add(New ReportParameter("complemento_RfcProvCertif", objxml.complemento.RfcProvCertif)) + parametros.Add(New ReportParameter("complemento_SelloCFD", objxml.complemento.SelloCFD)) + parametros.Add(New ReportParameter("complemento_SelloSAT", objxml.complemento.SelloSAT)) + parametros.Add(New ReportParameter("complemento_UUID", objxml.complemento.UUID)) + parametros.Add(New ReportParameter("complemento_CadenaOriginal", objxml.complemento.CadenaOriginal)) + If Not IsNothing(objxml.complemento.Pagos) Then + parametros.Add(New ReportParameter("CPFechaPago", objxml.complemento.Pagos.FechaPago)) + parametros.Add(New ReportParameter("CPFormaDePagoP", objxml.complemento.Pagos.FormaDePagoP)) + parametros.Add(New ReportParameter("CPFormaDePagoPText", objxml.complemento.Pagos.FormaDePagoPText)) + parametros.Add(New ReportParameter("CPMonedaP", objxml.complemento.Pagos.MonedaP)) + parametros.Add(New ReportParameter("CPMonto", objxml.complemento.Pagos.Monto.ToString())) + parametros.Add(New ReportParameter("CPTipoCambioP", objxml.complemento.Pagos.TipoCambioP.ToString())) + parametros.Add(New ReportParameter("CPNumOperacion", objxml.complemento.Pagos.NumOperacion)) + parametros.Add(New ReportParameter("CPNomBancoOrdExt", objxml.complemento.Pagos.NomBancoOrdExt)) + parametros.Add(New ReportParameter("CPRfcEmisorCtaOrd", objxml.complemento.Pagos.RfcEmisorCtaOrd)) + parametros.Add(New ReportParameter("CPCtaOrdenante", objxml.complemento.Pagos.CtaOrdenante)) + parametros.Add(New ReportParameter("CPRfcEmisorCtaBen", objxml.complemento.Pagos.RfcEmisorCtaBen)) + parametros.Add(New ReportParameter("CPCtaBeneficiario", objxml.complemento.Pagos.CtaBeneficiario)) + + End If + Using MR As ReportViewer = New ReportViewer() + Dim rdsTotales As ReportDataSource = New ReportDataSource() + Dim ltotales As List(Of utilValores) = New List(Of utilValores)() + ltotales.Add(New utilValores("Subtotal", objxml.comprobante.SubTotal.ToString("N2"))) + + If objxml.comprobante.Descuento > 0 Then + ltotales.Add(New utilValores("Descuento", objxml.comprobante.Descuento.ToString("N2"))) + End If + + For Each item As CFDIImpuesto In objxml.Impuestos + + If item.Importe > 0 Then + Dim TasaOCuota As Decimal = 0 + Decimal.TryParse(item.TasaOCuota, TasaOCuota) + ltotales.Add(New utilValores($"Impuestos {item.Tipo} {item.ImpuestoTexto} {(If(item.TipoFactor = "Tasa", (TasaOCuota * 100).ToString("N4"), item.TasaOCuota))} {(If(item.TipoFactor = "Tasa", "%", ""))}", item.Importe.ToString("N2"))) + End If + Next + + ltotales.Add(New utilValores("Total", objxml.comprobante.Total.ToString("N2"))) + rdsTotales.Name = "dsTotales" + rdsTotales.Value = ltotales + MR.LocalReport.DataSources.Add(rdsTotales) + Dim rds2 As ReportDataSource = New ReportDataSource() + Dim limagenes As List(Of utilImage) = New List(Of utilImage)() + limagenes.Add(New utilImage(cQr)) + rds2.Name = "dsImagenes" + rds2.Value = limagenes + MR.LocalReport.DataSources.Add(rds2) + Dim rdsrelacionados As ReportDataSource = New ReportDataSource() + rdsrelacionados.Name = "dsRelacionados" + rdsrelacionados.Value = objxml.cFDIRelacionados + MR.LocalReport.DataSources.Add(rdsrelacionados) + Dim rds1 As ReportDataSource = New ReportDataSource() + rds1.Name = "dsConceptos" + rds1.Value = objxml.GetConceptosforpdf() + MR.LocalReport.DataSources.Add(rds1) + + If Not IsNothing(objxml.complemento.Pagos) Then + + Dim rdsp As ReportDataSource = New ReportDataSource() + rdsp.Name = "dsPagos" + rdsp.Value = objxml.complemento.Pagos.doctosRelacionados + MR.LocalReport.DataSources.Add(rdsp) + End If + + MR.LocalReport.ReportPath = rutaReporte + MR.ProcessingMode = ProcessingMode.Local + MR.LocalReport.EnableExternalImages = True + MR.LocalReport.SetParameters(parametros) + MR.LocalReport.Refresh() + Dim warnings As Warning() = Nothing + Dim streamids As String() = Nothing + Dim mimeType As String = Nothing + Dim encoding As String = Nothing + Dim extension As String = Nothing + Dim bytes As Byte() = Nothing + bytes = MR.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings) + + Using fs As FileStream = New FileStream(NombreArchivo, FileMode.Create) + fs.Write(bytes, 0, bytes.Length) + fs.Close() + End Using + End Using + Alert("PDF Generado!") + Else + Alert("no se pudo procesar el archivo xml") + End If + End Sub End Class \ No newline at end of file diff --git a/CxC/RepCxCDetalle.aspx b/CxC/RepCxCDetalle.aspx index 44d7b796b..f362fc720 100644 --- a/CxC/RepCxCDetalle.aspx +++ b/CxC/RepCxCDetalle.aspx @@ -386,12 +386,19 @@ - + - + + + + + + <%----%> diff --git a/CxC/RepCxCDetalle.aspx.vb b/CxC/RepCxCDetalle.aspx.vb index d32b14256..9795b367f 100644 --- a/CxC/RepCxCDetalle.aspx.vb +++ b/CxC/RepCxCDetalle.aspx.vb @@ -432,6 +432,15 @@ Partial Class RepCxCDetalle If e.Row.RowIndex = 0 Then e.Row.Cells(1).Width = Unit.Pixel(70) e.Row.Cells(2).Width = Unit.Pixel(75) + End If + e.Row.FCHyperLink("HlFolio").Text = e.Row.DBCampo("SerieFolio") + + If e.Row.DBCampo("CveVenta").ToEntero() > 0 Then + If e.Row.DBCampo("TipoDocto") = "IxC" Then + e.Row.FCHyperLink("HlFolio").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveVenta")) + Else + e.Row.FCHyperLink("HlFolio").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DBCampo("CveVenta")) + End If End If If e.Row.DBCampo("SubProyecto") = "" And e.Row.DBCampo("CveMoneda") = "1" Then @@ -786,8 +795,11 @@ Partial Class RepCxCDetalle For index = 0 To GvDatos.Columns.Count - 1 If GvDatos.Columns(index).Visible Then - - If TypeOf GvDatos.Columns(index) Is HyperLinkField Then + If TypeOf GvDatos.Columns(index) Is TemplateField Then + If GvDatos.Columns(index).HeaderText = "Folio" Then + dr(GvDatos.Columns(index).HeaderText) = fila.FCHyperLink("HlFolio").Text.Replace(" ", "") + End If + ElseIf TypeOf GvDatos.Columns(index) Is HyperLinkField Then dr(GvDatos.Columns(index).HeaderText) = DirectCast(fila.Cells(index).Controls(0), HyperLink).Text.Replace(" ", "") Else dr(GvDatos.Columns(index).HeaderText) = fila.Cells(index).Text.Replace(" ", "") @@ -927,22 +939,27 @@ Partial Class RepCxCDetalle UPPersonalizar.Update() UpCobranza.Update() End Sub - Private Sub BtnAsignaCobranza_Click(sender As Object, e As EventArgs) Handles BtnAsignaCobranza.Click - Dim ObjVentas As New ClsVentas + Private Sub BtnAsignaCobranza_Click(sender As Object, e As EventArgs) Handles BtnAsignaCobranza.Click Dim time As DateTime Dim TieneError = False + Dim ObjVentas As New ClsVentas ObjVentas.IniciaTransacSQL() - - For Each row As GridViewRow In GvDatos.Rows - If row.FCCheckBox("ChkCobranza").Checked Then - time = DateTime.Parse(String.Format("{0} {1}:{2} {3}", TxtFechaCobranza.Text, TimeSelector.Hour, TimeSelector.Minute, TimeSelector.AmPm)) - If Not ObjVentas.UpdateAsignaVentaCobranza(row.DataKey("CveVenta").ToEntero, DdlCobranzaEstatus.SelectedValue.ToEntero, DdlUsuarioCobranza.SelectedValue.ToEntero, DdlTurnoCobranza.SelectedValue.ToEntero, TxtObservacionCobranza.Text.Trim, time) Then - TieneError = True - End If - End If - - Next + Try + For Each row As GridViewRow In GvDatos.Rows + Dim TipoDocto As String = row.DataKey("TipoDocto") + If row.FCCheckBox("ChkCobranza").Checked AndAlso TipoDocto <> "IxC" Then + time = DateTime.Parse(String.Format("{0} {1}:{2} {3}", TxtFechaCobranza.Text, TimeSelector.Hour, TimeSelector.Minute, TimeSelector.AmPm)) + If Not ObjVentas.UpdateAsignaVentaCobranza(row.DataKey("CveVenta").ToEntero, DdlCobranzaEstatus.SelectedValue.ToEntero, DdlUsuarioCobranza.SelectedValue.ToEntero, DdlTurnoCobranza.SelectedValue.ToEntero, TxtObservacionCobranza.Text.Trim, time) Then + TieneError = True + End If + End If + + Next + Catch ex As Exception + OnError("Ocurrió un error al actualizar", ex) + TieneError = True + End Try If Not TieneError Then ObjVentas.Commit() @@ -955,11 +972,11 @@ Partial Class RepCxCDetalle ObjVentas.Dispose() CargaDatos() - End Sub + End Sub #End Region - + #Region "SELECTED INDEX CHANGE" - + Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) CargaClientes() diff --git a/Empresas/Grales/Formatos/Ajuste.rdlc b/Empresas/Grales/Formatos/Ajuste.rdlc index 8ffdfc413..79d6d2dcf 100644 --- a/Empresas/Grales/Formatos/Ajuste.rdlc +++ b/Empresas/Grales/Formatos/Ajuste.rdlc @@ -976,11 +976,13 @@ - + =Parameters!CodEnsamble.Value Textbox3 @@ -1011,11 +1013,13 @@ - + =Parameters!CodInspeccion.Value Textbox3 @@ -1046,11 +1050,13 @@ - + =Parameters!CodLinea.Value Textbox3 @@ -1431,7 +1437,11 @@ - Nombre del consumidor: + Nombre del consumidor: +