Subversion Repositories svn1-original

Rev

Rev 50 | Rev 52 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 50 Rev 51
Line 64... Line 64...
64
void pri_name_index(void);
64
void pri_name_index(void);
65
void pri_name_index_body( void );
65
void pri_name_index_body( void );
66
void pri_all_reports (void );
66
void pri_all_reports (void );
67
void pri_leg_body(int leg);
67
void pri_leg_body(int leg);
68
void pri_eleg_body(int leg);
68
void pri_eleg_body(int leg);
-
 
69
void pri_csv_data ( void );
69
 
70
 
70
 
71
 
71
menu_table  rpt_menu[] = {
72
menu_table  rpt_menu[] = {
72
    { '1', "Print team order", pri_team },
73
    { '1', "Print team order", pri_team },
73
    { '2', "Print end leg times", pri_leg },
74
    { '2', "Print end leg times", pri_leg },
Line 79... Line 80...
79
    { '8', "Display summary information", display_summary },
80
    { '8', "Display summary information", display_summary },
80
    { '9', "Print summary information", pri_summary },
81
    { '9', "Print summary information", pri_summary },
81
    { 'a', "Print Awards only", pri_awards },
82
    { 'a', "Print Awards only", pri_awards },
82
    { 'b', "Print Master Index only", pri_master_index },
83
    { 'b', "Print Master Index only", pri_master_index },
83
    { 'c', "Print Name Index only", pri_name_index },
84
    { 'c', "Print Name Index only", pri_name_index },
-
 
85
    { 'e', "Export CSV Report Data", pri_csv_data },
84
    { 'z', "Print all reports", pri_all_reports },
86
    { 'z', "Print all reports", pri_all_reports },
85
    
87
    
86
#if defined(HI_TECH_C) || defined(__TURBOC__)
88
#if defined(HI_TECH_C) || defined(__TURBOC__)
87
    { 'S', "MS-DOS system", ms_system },
89
    { 'S', "MS-DOS system", ms_system },
88
#endif
90
#endif
Line 1716... Line 1718...
1716
    print_legend(last_class, 1);
1718
    print_legend(last_class, 1);
1717
    close_printer();
1719
    close_printer();
1718
 
1720
 
1719
}
1721
}
1720
 
1722
 
-
 
1723
/*----------------------------------------------------------------------------
-
 
1724
** FUNCTION           : pri_csv_data
-
 
1725
**
-
 
1726
** DESCRIPTION        : Generate a CSV file of all the report data
-
 
1727
**                      It can then be used to play with the data externally
-
 
1728
**
-
 
1729
**
-
 
1730
** INPUTS             : None
-
 
1731
**
-
 
1732
** RETURNS            : Yes it does
-
 
1733
**
-
 
1734
----------------------------------------------------------------------------*/
-
 
1735
 
-
 
1736
 
-
 
1737
void pri_csv_data ( void )
-
 
1738
{
-
 
1739
    int i;
-
 
1740
    int j;
-
 
1741
    int age_sum;
-
 
1742
 
-
 
1743
    /*
-
 
1744
    **  Sort on every thing
-
 
1745
    **  Then generate all the stats too
-
 
1746
    */
-
 
1747
    printf( "\nSorting the data\n" );
-
 
1748
    do_big_sort();
-
 
1749
    gen_stats();
-
 
1750
 
-
 
1751
    /*
-
 
1752
     * Now print the data on the printer 
-
 
1753
     */
-
 
1754
 
-
 
1755
    if( !open_printer( "", "csv", 2000, FALSE, NULL ) )
-
 
1756
        return;
-
 
1757
 
-
 
1758
    printf( "\nGenerating the printed output\n" );
-
 
1759
 
-
 
1760
    for( i = config.min_team; i <= config.max_team; i++ )
-
 
1761
    {
-
 
1762
        if( valid_field( i ) && g_record( i, &team_buf ) )
-
 
1763
        {
-
 
1764
            /*
-
 
1765
            **  Basic information
-
 
1766
            **      - Team number - with Xref back to full result
-
 
1767
            **      - Full team name
-
 
1768
            **      - Full categoray name - with Xref to category results
-
 
1769
            **      - Country name
-
 
1770
            */
-
 
1771
            csv_print( "%d",   team_buf.numb );
-
 
1772
            csv_print( "%s",   team_buf.name );
-
 
1773
 
-
 
1774
            csv_print( "%s",    team_buf.class == 0 ? "" : config.team_class[team_buf.class - 1].full_name );
-
 
1775
            csv_print( "%s",    team_buf.class == 0 ? "" : config.team_class[team_buf.class - 1].abr );
-
 
1776
            csv_print( "%s",    time_a (team_buf.class == 0 ? 0 : config.team_class[team_buf.class - 1].start ));
-
 
1777
            csv_print( "%d",    team_buf.class == 0 ? 0 : config.team_class[team_buf.class - 1].start );
-
 
1778
 
-
 
1779
            csv_print( "%s",    config.num_countries == 0
-
 
1780
                                || team_buf.country ==
-
 
1781
                                0 ? "" : config.country_name[team_buf.country - 1].full_name );
-
 
1782
 
-
 
1783
            age_sum = 0;
-
 
1784
            for( j = 1; j <= config.num_legs; j++ )
-
 
1785
            {
-
 
1786
                csv_print( "%d", j );
-
 
1787
                csv_print( "%s", config.leg_name[j - 1] );
-
 
1788
                csv_print( "%s", team_buf.members[j-1].name );
-
 
1789
                csv_print( "%s", ( team_buf.members[j-1].sex == male ) ? "Male" : "Female" );
-
 
1790
                csv_print( "%d", team_buf.members[j-1].age );
-
 
1791
                if ( age_sum >= 0 )
-
 
1792
                {
-
 
1793
                    ushort age = team_buf.members[j-1].age;
-
 
1794
                    if ( age > 0 && age < 255 )
-
 
1795
                    {
-
 
1796
                        age_sum += age;
-
 
1797
                    }
-
 
1798
                    else
-
 
1799
                    {
-
 
1800
                        age_sum = -1;
-
 
1801
                    }
-
 
1802
                }
-
 
1803
 
-
 
1804
 
-
 
1805
                csv_print( "%s", time_a(team_buf.leg[j].start ));
-
 
1806
                csv_print( "%d", team_buf.leg[j].start );
-
 
1807
                csv_print( "%s", time_a(team_buf.leg[j].end ));
-
 
1808
                csv_print( "%d", team_buf.leg[j].end );
-
 
1809
                csv_print( "%s", time_a(team_buf.leg[j].elapsed ));
-
 
1810
                csv_print( "%d", team_buf.leg[j].elapsed );
-
 
1811
                csv_print( "%d", team_buf.leg[j].l_place );
-
 
1812
                csv_print( "%d", team_buf.leg[j].le_place );
-
 
1813
                csv_print( "%d", team_buf.leg[j].lc_place );
-
 
1814
                csv_print( "%d", team_buf.leg[j].lec_place );
-
 
1815
                csv_print( "%d", team_buf.leg[j].manual );
-
 
1816
            }
-
 
1817
 
-
 
1818
            j = 0;
-
 
1819
            csv_print( "%s", time_a(team_buf.leg[j].start ));
-
 
1820
            csv_print( "%d", team_buf.leg[j].start );
-
 
1821
            csv_print( "%s", time_a(team_buf.leg[j].end ));
-
 
1822
            csv_print( "%d", team_buf.leg[j].end );
-
 
1823
            csv_print( "%s", time_a(team_buf.leg[j].elapsed ));
-
 
1824
            csv_print( "%d", team_buf.leg[j].elapsed );
-
 
1825
            csv_print( "%d", team_buf.leg[j].l_place );
-
 
1826
            csv_print( "%d", team_buf.leg[j].le_place );
-
 
1827
            csv_print( "%d", team_buf.leg[j].lc_place );
-
 
1828
            csv_print( "%d", team_buf.leg[j].lec_place );
-
 
1829
            csv_print( "%d", team_buf.leg[j].manual );
-
 
1830
            
-
 
1831
            csv_print( "%d", age_sum );
-
 
1832
            csv_print( "%d", team_buf.flags.valid );
-
 
1833
            csv_print( "%d", team_buf.flags.bad_times );
-
 
1834
            csv_print( "%d", team_buf.flags.disqualified );
-
 
1835
            csv_print( "%d", team_buf.flags.non_equestrian );
-
 
1836
 
-
 
1837
How about class placings
-
 
1838
 
-
 
1839
 
-
 
1840
            csv_print( "\n" );
-
 
1841
        }
-
 
1842
    }
-
 
1843
 
-
 
1844
    close_printer();
-
 
1845
}
-
 
1846
 
-
 
1847
 
1721
/*========================================================================
1848
/*========================================================================
1722
 *
1849
 *
1723
 *  Print all reports at once
1850
 *  Print all reports at once
1724
 ^  Its all so fast, these days ...
1851
 *  Its all so fast, these days ...
1725
 *
1852
 *
1726
 *  Purpose:
1853
 *  Purpose:
1727
 *      This function is called to print all reports at once
1854
 *      This function is called to print all reports at once
1728
 *
1855
 *
1729
 *  Parameters:
1856
 *  Parameters: