This commit is contained in:
2019-10-28 16:22:36 -07:00
parent 99cc487117
commit b79d46a4b4
3 changed files with 72 additions and 53 deletions

View File

@@ -1161,8 +1161,19 @@ Partial Class Inventarios_EntradasSalidas
If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub
Dim Valido As Boolean = True Dim Valido As Boolean = True
Dim RowPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0)
Dim CveMetodoInventario As Integer = RowPS("Inv_CveMetodoInventario").ToString().ToEntero()
If CveMetodoInventario = 5 And (String.IsNullOrEmpty(SerieLote.Trim()) OrElse SerieLote = "-1") Then
Valido = False
Alert("El producto requiere Serie-Lote", TipoMensaje.MsgAdvertencia)
End If
'salida 'salida
If DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen If Valido AndAlso DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen
Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), If(Batch = "", "-1", Batch)) Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), If(Batch = "", "-1", Batch))
LbAgregar.ToolTip = Existencia.ToString LbAgregar.ToolTip = Existencia.ToString
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUM} {If(SerieLote <> "", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUM} {If(SerieLote <> "", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then
@@ -1181,6 +1192,7 @@ Partial Class Inventarios_EntradasSalidas
End If End If
End If End If
If Valido Then If Valido Then
Dim CveClasificacion As Integer Dim CveClasificacion As Integer
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("", "PS") Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("", "PS")

View File

@@ -2882,13 +2882,15 @@ Partial Class OC
Promocion = TxtPromocion.Text.Trim Promocion = TxtPromocion.Text.Trim
Try Try
If ChkCotizacion.Checked AndAlso gvCotizaciones.Rows.Count > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then Dim NoProveedoresCot As Integer = DtDetalle.COUNT("CveProveedor", "CveProveedor > 0")
If ChkCotizacion.Checked AndAlso NoProveedoresCot > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then
Dim CveProveedor = -1 Dim CveProveedor = -1
Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0, PorIVA = 0.0, Porcentaje = 0.0 Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0, PorIVA = 0.0, Porcentaje = 0.0
Dim IdPoliza = -1 Dim IdPoliza = -1
For Each dr As DataRow In DtDetalle.FiltraParametros("", "CveProveedor").Rows For Each dr As DataRow In DtDetalle.FiltraParametros("CveProveedor > 0", "CveProveedor").Rows
'SI ES DIFERENTE PROVEEDOR AGREGA UNA OC 'SI ES DIFERENTE PROVEEDOR AGREGA UNA OC
If CveProveedor <> dr("CveProveedor").ToString.ToEntero Then If CveProveedor <> dr("CveProveedor").ToString.ToEntero Then

View File

@@ -122,36 +122,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion); sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
//var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje; if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
//sb.AppendFormat("{0} <br/>", FueCancelado);
//if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
//{
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
//}
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
{ {
sb.Append("Esta factura no es cancelable."); var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
return sb.ToString();
}
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
{
CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0)
{
var xmlAcuse = new System.Xml.XmlDocument();
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
}
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
sb.AppendFormat("{0} <br/>", FueCancelado); sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion) if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
@@ -159,20 +132,52 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta)); Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
} }
} }
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA") else
{ {
//ASIGNAMOS ESTATUS EMITIDA if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
CveEstatus = 3;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{ {
sb.Append("El estatus de la factura fue cambiado a 'Emitida'."); sb.Append("Esta factura no es cancelable.");
return sb.ToString();
} }
else
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
{ {
sb.Append("Ocurrió un error al cambiar el estatus de la factura."); CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0)
{
var xmlAcuse = new System.Xml.XmlDocument();
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
}
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
{
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
}
}
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
{
//ASIGNAMOS ESTATUS EMITIDA
CveEstatus = 3;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
}
ObjVentas.Dispose();
} }
ObjVentas.Dispose();
} }
} }
else else