Ejemplo n.º 1
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            if (encabezado1.txtConsecutivo.Text.Length < 1)
            {
                MessageBox.Show("Digite un consecutivo");
                return;
            }
            if (encabezado1.cmbSocio.SelectedItem == null)
            {
                MessageBox.Show("Escoja un proveedor");
                return;
            }
            if (encabezado1.fecha2.SelectedDate == null)
            {
                MessageBox.Show("Escoja una fecha de entrega");
                return;
            }
            if (detalle1.Productos.Count() < 1)
            {
                MessageBox.Show("No hay articulos o servicios");
                return;
            }
            var documento = new AccesoServicio.FinanzasService.Documento();
            documento.Consecutivo = encabezado1.txtConsecutivo.Text;
            documento.CreadoDesdeAnterior = DesdeDocumentoPasado;
            documento.TipoDocumento = "Factura de Proveedores";
            documento.Fecha1 = encabezado1.fecha1.SelectedDate.Value;
            documento.Fecha2 = encabezado1.fecha2.SelectedDate.Value;
            //documento.Fecha1 = encabezado1.fecha1.SelectedDate.Value.Month + "/" + encabezado1.fecha1.SelectedDate.Value.Day + "/" + encabezado1.fecha1.SelectedDate.Value.Year;
            //documento.Fecha2 = encabezado1.fecha2.SelectedDate.Value.Month + "/" + encabezado1.fecha2.SelectedDate.Value.Day + "/" + encabezado1.fecha2.SelectedDate.Value.Year;

            documento.Subtotal = double.Parse(detalle1.lblSubtotal.Content.ToString());
            documento.Total = double.Parse(detalle1.lblTotal.Content.ToString());
            documento.EsServicio = false;
            documento.DescripcionServicio = "-";
            documento.CodigoCuentaServicio = "-";
            documento.LineasVenta = detalle1.Productos.ToArray();
            documento.SocioNegocio = (SocNegocio)encabezado1.cmbSocio.SelectedItem;
            if (ServicioFinanzas.Instancia.GuardarDocumento(documento))
            {
                MessageBox.Show("Factura de proveedores guardada");
                encabezado1.txtConsecutivo.Text = string.Empty;
                encabezado1.cmbSocio.SelectedIndex = -1;
            }
            else
            {
                MessageBox.Show("Se produjo un error");
            }
        }
Ejemplo n.º 2
0
 private void cmdGuardar_Click(object sender, RoutedEventArgs e)
 {
     double precio, iv;
     if (!double.TryParse(txtTotal.Text, out precio))
     {
         MessageBox.Show("Digite un precio válido");
         return;
     }
     if (!double.TryParse(textBox1.Text, out iv))
     {
         MessageBox.Show("Digite un IV válido");
         return;
     }
     var documento = new AccesoServicio.FinanzasService.Documento();
     documento.Consecutivo = encabezado1.txtConsecutivo.Text;
     documento.CreadoDesdeAnterior = false;
     documento.TipoDocumento = "Factura de Clientes";
     documento.Fecha1 = encabezado1.fecha1.SelectedDate.Value;
     documento.Fecha2 = encabezado1.fecha2.SelectedDate.Value;
     documento.Subtotal = precio;
     documento.Total = precio+(precio*(iv/100));
     documento.EsServicio = true;
     documento.DescripcionServicio = txtDetalle.Text;
     documento.CodigoCuentaServicio = txtCuentaAsociada.Text;
     documento.LineasVenta = null;
     documento.SocioNegocio = (SocNegocio)encabezado1.cmbSocio.SelectedItem;
     if (ServicioFinanzas.Instancia.GuardarDocumento(documento))
     {
         MessageBox.Show("Factura de clientes guardada");
         encabezado1.txtConsecutivo.Text = string.Empty;
         txtDetalle.Text = string.Empty;
         txtCuentaAsociada.Text=string.Empty;
         encabezado1.cmbSocio.SelectedIndex = -1;
     }
     else
     {
         MessageBox.Show("Se produjo un error");
     }
 }
Ejemplo n.º 3
0
        private void buttonConsultarDocumentos_Click(object sender, RoutedEventArgs e)
        {
            _Documentos = new ObservableCollection<Documento>();
            string SN = comboBoxConsultaDocSN.SelectedItem.ToString();
            char[] SN_Letras = SN.ToCharArray();
            string CodigoSN = "";
            for (int i = 0; i < SN.Length; i++)
            {
                if (SN_Letras[i] != ' ')
                {
                    CodigoSN = CodigoSN + SN_Letras[i];
                }
                else
                {
                    break;
                }
            }
            var documentos = ServicioFinanzas.Instancia.ObtenerFacturasXEstadoXSocioNegocio(CodigoSN, "Pendiente");
            foreach (var doc in documentos)
            {
                var documento = new Documento();
                documento.IdDocumento = doc.IdDocumento;
                documento.Consecutivo = doc.Consecutivo;
                documento.Fecha1 = doc.Fecha1;
                documento.Subtotal = doc.Subtotal;
                documento.Total = doc.Total;
                _Documentos.Add(documento);
            }

            dataGridDocumentos.ItemsSource = _Documentos;
            dataGridDocumentos.Items.Refresh();
        }
Ejemplo n.º 4
0
 public bool GuardarDocumento(Documento pDocumento)
 {
     return _CSC.GuardarDocumento(pDocumento);
 }