コード例 #1
0
ファイル: frmListado.cs プロジェクト: hernanjhc/ERP
        private void NuevoPresupuesto()
        {
            using (var f = new frmEdicion())
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        var presupuesto = PresupuestosRepository.Insertar(f.IdCliente, f.Fecha, f.DiasValidez, f.SubTotal, f.Descuento,
                                                                          f.DescPorc, f.ImporteTotal, f.PrecioLista, f.IdUsuario, f.Estado);

                        for (int i = 0; i <= Convert.ToInt32(f.dgvDetalles.Rows.Count - 1); i++)
                        {
                            PresupuestosDetallesRepository.Insertar(presupuesto.Id, Convert.ToInt32(f.dgvDetalles.Rows[i].Cells[0].Value),
                                                                    Convert.ToInt16(f.dgvDetalles.Rows[i].Cells[3].Value), Convert.ToDecimal(f.dgvDetalles.Rows[i].Cells[4].Value),
                                                                    Convert.ToDecimal(f.dgvDetalles.Rows[i].Cells[5].Value));
                        }
                        if (Configuration.ImprimePresupuestos)
                        {
                            ImprimirPresupuesto(f, presupuesto.Id);
                        }

                        ConsultarDatos();
                        dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == presupuesto.Id);
                    }
                    catch (Exception ex)
                    {
                        ShowError("Error al intentar grabar los datos: \n" + ex.Message);
                    }
                }
            }
        }
コード例 #2
0
ファイル: frmListado.cs プロジェクト: hernanjhc/ERP
 private void cargarDetalles(int idpresupuesto)
 {
     dgvDetalles.SetDataSource(
         from d in PresupuestosDetallesRepository.ObtenerDetallesDelPresupuesto(idpresupuesto)
         select new
     {
         EArticulosRepository.ObtenerArticulosPorId(
             Convert.ToDecimal(d.IdArticulo)).Descripcion,
         d.Precio,
         d.Cantidad,
         d.Importe
     }
         );
 }
コード例 #3
0
ファイル: frmListado.cs プロジェクト: hernanjhc/ERP
        private void ImprimirPresupuesto(EPresupuestos p)
        {
            var       cliente       = ClientesRepository.ObtenerClientePorId(Convert.ToDecimal(p.IdCliente));
            string    dirección     = cliente.Direccion;
            string    razónSocial   = cliente.RazonSocial;
            string    documento     = cliente.NroDocumento.ToString();
            string    tipoDocumento = TiposDocumentoRepository.TiposDocumentoPorId(cliente.IdTipoDocumento).Descripcion;
            string    comprobante   = "Presupuesto";
            string    número        = p.Id.ToString();
            string    fecha         = String.Format("{0: dd/MM/yyyy}", p.Fecha);
            string    subTotal      = p.Importe.ToString();
            string    descuento     = p.Descuento.ToString();
            string    total         = p.ImporteTotal.ToString();
            string    validez       = p.DiasValidez.ToString();
            DataTable dt            = PresupuestosDetallesRepository.CargarDetalles(p.Id);

            MostrarReporte(dt, dirección, razónSocial, documento,
                           tipoDocumento, comprobante, número, fecha,
                           subTotal, descuento, total, validez);
        }