Пример #1
0
//---------------------------------------------------------------------------
AnsiString __fastcall TFormDLL::GetFIOForID(int _idstud)
{
  AnsiString FIOStr="??? ??? ???";
  AnsiString Strtmp="";

  MYSQL_RES *result;
  MYSQL_ROW row;

  AnsiString query="SELECT CONCAT(secondname,\' \',firstname,\' \',thirdname),dogshifrid,dogfastid,dogyearid,dognum FROM "+opts.DBStudTable+" WHERE deleted=0 AND id="+AnsiString(_idstud);
  mysql_query(mysql,query.c_str());
  if (mysql_field_count(mysql))
  {
    result=mysql_store_result(mysql);
    if (result && mysql_num_rows(result))
    {
      row = mysql_fetch_row(result);
      FIOStr=AnsiString(row[0])+" ( договор: ";
      FIOStr+=WCGetTitleForKeyNum(DOGSHIFRS,AnsiString(row[1]).ToInt())+"-";
      FIOStr+=WCGetTitleForKeyNum(DOGYEARS,AnsiString(row[3]).ToInt());
      Strtmp=WCGetTitleForKeyNum(DOGFASTS,AnsiString(row[2]).ToInt());
      if (!Strtmp.IsEmpty()) FIOStr+="-"+Strtmp;
      FIOStr+="-";
      FIOStr+=AnsiString(row[4]);
      FIOStr+=" )";

    }
    mysql_free_result(result);
  }
  return FIOStr;
}
Пример #2
0
//---------------------------------------------------------------------------
void __fastcall TFormReportUchebKartStud::GetInfoStudent(AnsiString& NumZ, AnsiString& SN, AnsiString& FN, AnsiString& TN,
        AnsiString& Adres, AnsiString& NumPricas, AnsiString& InDate, AnsiString& spec,
        AnsiString& VipQualifWork, AnsiString& OutDate, AnsiString& Qualific, AnsiString& nGak, AnsiString perevodInfo[5])
{
    NumZ = "???";
    SN = "???";
    FN = "???";
    TN = "???";
    Adres = "???";
    NumPricas = "???";
    InDate = "???";
    spec = "???";
    VipQualifWork = "???";
    OutDate = "???";
    Qualific = "???";

    MYSQL_RES *result;
    MYSQL_ROW row;

    AnsiString myquery = "select s.secondname,s.firstname,s.thirdname, s.addr," \
        "s.enternum,s.enterdate,s.specid, s.vkr_title, s.znum, s.edudatequalif, s.edunumprotgak, s.perevod_na_kurs from "+opts.DBStudTable+" as s "\
        "where s.deleted=0 and s.id=" + ToStr(AnsiString(idstudent));

    mysql_query(mysql,myquery.c_str());
    if (mysql_field_count(mysql))
    {
        result=mysql_store_result(mysql);
        if (result && mysql_num_rows(result))
        {
             while (row = mysql_fetch_row(result))
            {
                SN = AnsiString(row[0]);
                FN = AnsiString(row[1]);
                TN = AnsiString(row[2]);
                Adres = AnsiString(row[3]);
                NumPricas = AnsiString(row[4]);
                InDate = AnsiString(row[5]);
                spec = WCGetTitleForKeyNum(SPECS, AnsiString(row[6]).ToInt());
                VipQualifWork = AnsiString(row[7]);
                Qualific = WCGetTitleForKeyNum(QUALIFIC, AnsiString(row[6]).ToInt());
                NumZ = AnsiString(row[8]);

                OutDate = AnsiString(row[9]);
                nGak =  AnsiString(row[10]);
                StringToPerevodInfo(perevodInfo, AnsiString(row[11]));
            }
        }
        mysql_free_result(result);
    }
}
Пример #3
0
//---------------------------------------------------------------------------
void __fastcall TFormDisciplines::UpdateTable(TStringGrid* pTab)
{
  ClearTable(pTab);
  delete_data();

  MYSQL_RES *result;
  MYSQL_ROW row;

  AnsiString query="SELECT id,fulltitle,shorttitle,idspec,idclass,num_hours,scan_number,sem_hours FROM "+opts.DBDisciplines+" WHERE deleted=0 AND idspec="+WCGetNumForKeyTitle(SPECS,ComboBoxSpec->Text)+" ORDER BY idclass,fulltitle";
  mysql_query(mysql,query.c_str());

  if (mysql_field_count(mysql))
  {
    result=mysql_store_result(mysql);
    int numCurRow;

    if (result && mysql_num_rows(result))
    {
      numCurRow=0;
      listIDs->Clear();
      listIDs->Add("NULL");
      audhoursdiscip.push_back(NULL);

      while (row = mysql_fetch_row(result))
      {
        numCurRow++;
        pTab->RowCount=numCurRow+1;

        listIDs->Add(AnsiString(row[0]));
        pTab->Cells[0][numCurRow]=numCurRow;
        pTab->Cells[1][numCurRow]=row[1];
        pTab->Cells[2][numCurRow]=row[2];
        pTab->Cells[3][numCurRow]=AnsiString(row[5]);
        pTab->Cells[4][numCurRow]=WCGetTitleForKeyNum(DISCIPCLASSIFIC,AnsiString(row[4]).ToInt());
        pTab->Cells[5][numCurRow]=AnsiString(row[6]);

        AudHours *data = new AudHours;
        StringToAudHours(data, AnsiString(row[7]));
        audhoursdiscip.push_back(data);

        pTab->Refresh();
      }
    }
    mysql_free_result(result);
  }
  StrGridDiscipClick(StrGridDiscip);
}
Пример #4
0
//---------------------------------------------------------------------------
AnsiString __fastcall TFormDisciplines::GetSpecForStudID(int _idstud)
{
  AnsiString SpecStr="???";
  int myidspec=-1;

  MYSQL_RES *result;
  MYSQL_ROW row;

  AnsiString query="SELECT specid FROM "+opts.DBStudTable+" WHERE deleted=0 AND id="+AnsiString(_idstud);
  mysql_query(mysql,query.c_str());
  if (mysql_field_count(mysql))
  {
    result=mysql_store_result(mysql);
    if (result && mysql_num_rows(result))
    {
      row = mysql_fetch_row(result);
      myidspec=AnsiString(row[0]).ToInt();
    }
    mysql_free_result(result);
  }
  if (myidspec!=-1) SpecStr=WCGetTitleForKeyNum(SPECS,myidspec);
  return SpecStr;
}
Пример #5
0
//---------------------------------------------------------------------------
void __fastcall TFormDLL::BtnAllFactsClick(TObject *Sender)
{
  ListBoxPrevOplata->Clear();
  listIDFacts->Clear();

  AnsiString IDStudStr=AnsiString(idstud);
  AnsiString StrForListBox;

  EditSumMoney->Text="нет категории";
  EditDolg->Text="нет категории";
  ListBoxPrevOplataClick(ListBoxPrevOplata);

  ListBoxPrevOplata->Items->Add(" Дата оплаты           Сумма оплаты           Группа");
  listIDFacts->Add("");
  ListBoxPrevOplata->Items->Add("");
  listIDFacts->Add("");

  MYSQL_RES *result;
  MYSQL_ROW row;
         // id для удаления фактов
  AnsiString query="SELECT f.id,f.datepay,f.moneypay,op.idgroup FROM "+opts.DBPayFacts+" as f, "+opts.DBPayOpts+" as op WHERE f.deleted=0 AND op.deleted=0 AND f.idstud="+IDStudStr+" AND f.idopts=op.id ORDER BY f.datepay";
  mysql_query(mysql,query.c_str());
  if (mysql_field_count(mysql))
  {
    result=mysql_store_result(mysql);
    if (result && mysql_num_rows(result))
    {
      while (row = mysql_fetch_row(result))
      {
        StrForListBox=" "+ReturnParsedDateInMask(AnsiString(row[1]))+"                  "+AnsiString(row[2])+"                           "+WCGetTitleForKeyNum(GROUPS,AnsiString(row[3]).ToInt());

        listIDFacts->Add("");
        ListBoxPrevOplata->Items->Add(StrForListBox);
      }
    }
    mysql_free_result(result);
  }

  ListBoxPrevOplataClick(ListBoxPrevOplata);
}
Пример #6
0
//---------------------------------------------------------------------------
void __fastcall TFormOptsOplata::UpdateTable(TStringGrid* pTab)
{
  ClearTable(pTab);

  int i,j;
  TStringList* listIDStud = new TStringList;
  TStringList* listIDOpts = new TStringList;
  listIDOpts->Clear();
  listIDStud->Clear();

  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id FROM "+opts.DBStudTable+" WHERE deleted=0 AND grpid="+ToStr(AnsiString(IDGroup)));
  ZMySqlQuery->Active=true;
  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    listIDStud->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
  }

  AnsiString IDOptsStr;
  for (i=0; i<listIDStud->Count; i++)
  {
    ZMySqlQuery->SQL->Clear();
    ZMySqlQuery->SQL->Add("SELECT idopts FROM "+opts.DBPayFacts+" WHERE deleted=0 AND idstud="+ToStr(listIDStud->Strings[i]));
    ZMySqlQuery->Active=true;

    for (j=1; j<=ZMySqlQuery->RecordCount;j++)
    {
      ZMySqlQuery->RecNo=j;
      IDOptsStr = ZMySqlQuery->Fields->FieldByNumber(1)->AsString;
      if (listIDOpts->IndexOf(IDOptsStr)==-1)
        listIDOpts->Add(IDOptsStr);
    }
  }


  int numCurRow=0;
  listIDs->Clear();
  listIDs->Add("NULL");
  listRealIDs->Clear();
  listRealIDs->Add("NULL");

for (j=0; j<listIDOpts->Count; j++)
{
  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id,idgroup,datestart,dateend,commoncountmoney FROM "+opts.DBPayOpts+" WHERE deleted=0 AND id="+ToStr(listIDOpts->Strings[j])+" ORDER BY datestart");
  ZMySqlQuery->Active=true;

  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    numCurRow++;
    pTab->RowCount=numCurRow+1;

    listIDs->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
    pTab->Cells[0][numCurRow]=numCurRow;
    pTab->Cells[1][numCurRow]=WCGetTitleForKeyNum(GROUPS,ZMySqlQuery->Fields->FieldByNumber(2)->AsString.ToInt());
    pTab->Cells[2][numCurRow]=GetPeriodStr(ZMySqlQuery->Fields->FieldByNumber(3)->AsString,ZMySqlQuery->Fields->FieldByNumber(4)->AsString);
    pTab->Cells[3][numCurRow]=ZMySqlQuery->Fields->FieldByNumber(5)->AsString;

    pTab->Refresh();
  }
}
  delete listIDOpts;
  delete listIDStud;

  StrGridOptsClick(StrGridOpts);
}
Пример #7
0
//---------------------------------------------------------------------------
void __fastcall TFormReportStudsCandRedDiplom::CreateWordDocument(void)
{
    InitReportQuery();

    if (ZMySqlQuery->RecordCount==0)
        return;

    WordMacros macros;
    macros.BeginMacros();

    macros.InsertLine("ActiveDocument.PageSetup.TopMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.BottomMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.LeftMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.RightMargin=35");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionFont("Bold=true");
    macros.SelectionFont("Size=16");
    macros.SelectionText("Список кандидатов на получение красного диплома");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Size=12");
    macros.SelectionFont("Bold=false");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");

    int CountTables=0;
    int CountRows;
    for (int i=0; i<ZMySqlQuery->RecordCount; i++)
    {
        ZMySqlQuery->RecNo=i+1;
        int numgroup=ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt();

        // подготавливает запрос на список студенов
        //InitStudentsForGroup(numgroup);
        // получает список студентов на красный диплом
        //CountUsefullStuds=GetCountUsefullStudents(listNumUsefullStuds);
        //if (CountUsefullStuds==0)  continue;
        std::vector<red_student> redStudents = GetRedStudents(numgroup);
        if (redStudents.empty())
            continue;
        int CountUsefullStuds = redStudents.size();

        macros.SelectionTypeParagraph();
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
        macros.SelectionText("Группа ");
        macros.SelectionFont("Bold=true");
        macros.SelectionText(WCGetTitleForKeyNum(GROUPS,numgroup));
        macros.SelectionFont("Bold=false");
        macros.SelectionTypeParagraph();

        CountRows=CountUsefullStuds+1;
        macros.TablesAdd(CountRows,7);
        CountTables++;

        macros.TablesColumns(CountTables, 1, "Width = 20");
        macros.TablesColumns(CountTables, 2, "Width = 180");
        macros.TablesColumns(CountTables, 3, "Width = 60");
        macros.TablesColumns(CountTables, 4, "Width = 70");
        macros.TablesColumns(CountTables, 5, "Width = 70");
        macros.TablesColumns(CountTables, 6, "Width = 70");
        macros.TablesColumns(CountTables, 7, "Width = 50");

        macros.TablesColumns(CountTables, 1, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
        macros.TablesColumns(CountTables, 2, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
        macros.TablesColumns(CountTables, 3, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 4, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 5, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 6, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 7, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.SelectionFont("Bold=true");
        macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

        macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Rows.Item(1).Range.Font.Bold=true");
//    WordDocument->Tables->Item(CountTables)->Range->Select();

        macros.TablesCell(CountTables, 1, 1, "Range.Text = \"№\"");
        macros.TablesCell(CountTables, 1, 1, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 2, "Range.Text = \"Фамилия, имя, отчество\"");
        macros.TablesCell(CountTables, 1, 2, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 3, "Range.Text = \"№ зач. книжки\"");
        macros.TablesCell(CountTables, 1, 3, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 4, "Range.Text = \"Кол-во \"\"удовл.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 4, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 5, "Range.Text = \"Кол-во \"\"хор.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 5, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 6, "Range.Text = \"Кол-во \"\"отл.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 6, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 7, "Range.Text = \"Средний балл\"");
        macros.TablesCell(CountTables, 1, 7, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");

        // проходим по списку на красный диплом
        for (int j = 0; j < redStudents.size(); ++j)
        {
            red_student& redStudent = redStudents[j];
            // номер позиции
            macros.TablesCell(CountTables, j+2,1, "Range.Text= \"" + AnsiString(j+1) + "\"");
            // фио
            macros.TablesCell(CountTables, j+2,2, "Range.Text= \"" + redStudent.name + "\"");
            // номер зачетки
            macros.TablesCell(CountTables, j+2,3, "Range.Text= \"" + redStudent.znum + "\"");

            // вычисляет баллы для студента
            //int countUDOVL,countHOR,countOTL;
            //double percUDOVL,percHOR,percOTL;
            //AnsiString AvrgBallStr;
            //GetBallsCount(countUDOVL,percUDOVL,countHOR,percHOR,countOTL,percOTL,AvrgBallStr,ZMySqlQueryStudsOfGrp->Fields->FieldByNumber(1)->AsString);

            AnsiString percUDOVLStr = AnsiString(redStudent.perc_ud);
            AnsiString percHORStr   = AnsiString(redStudent.perc_hor);
            AnsiString percOTLStr   = AnsiString(redStudent.perc_otl);
            char str[10];
            sprintf(str,"%4.2lf",percUDOVLStr.ToDouble());
            percUDOVLStr = AnsiString(str);
            sprintf(str,"%4.2lf",percHORStr.ToDouble());
            percHORStr = AnsiString(str);
            sprintf(str,"%4.2lf",percOTLStr.ToDouble());
            percOTLStr = AnsiString(str);

            AnsiString Str=AnsiString(redStudent.count_ud)+" ("+percUDOVLStr+"%)";
            macros.TablesCell(CountTables, j+2,4, "Range.Text= \"" + Str + "\"");
            Str=AnsiString(redStudent.count_hor)+" ("+percHORStr+"%)";
            macros.TablesCell(CountTables, j+2,5, "Range.Text= \"" + Str+ "\"");
            Str=AnsiString(redStudent.count_otl)+" ("+percOTLStr+"%)";
            macros.TablesCell(CountTables, j+2,6, "Range.Text= \"" + Str+ "\"");
            macros.TablesCell(CountTables, j+2,7, "Range.Text= \"" + redStudent.avrBall + "\"");
        }

        macros.TablesCell(CountTables, CountRows+1, 1, "Range.Select");
        macros.InsertLine("Selection.MoveDown Unit := wdLine");
    }
    //delete listNumUsefullStuds;

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
    macros.SelectionFont("Size=8");
    macros.SelectionText("(*)В таблицах не учитываются оценки \"\"зачтено\\"", \"\"незачтено\"\" и \"\"неудовлетворительно\"\".");
    macros.SelectionTypeParagraph();
    macros.SelectionText("(*)Таблицы содержат студентов, имеющих не более одной \"\"удовл\"\" и не менее 75% \"\"отл\"\".");

    macros.EndMacros();
    macros.RunMacros();
}
Пример #8
0
//---------------------------------------------------------------------------
void __fastcall TFormReportDocZachislenie::CreateWordDocument(void)
{
    int numspec,numform;

    InitReportQuery();

    WordMacros macros;
    macros.BeginMacros();

    macros.InsertLine("Selection.SetRange Start:=0, End:=0");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphJustify");
    macros.SelectionFont("Bold = true");
    macros.SelectionText("Слушали: ");
    macros.SelectionFont("Bold = false");
    macros.SelectionText("о зачислении студентами и слушателями ННГАСУ на места с оплатой стоимости обучения на договорной основе.");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = true");
    macros.SelectionText("Постановили: ");
    macros.SelectionFont("Bold = false");
    macros.SelectionText("зачислить студентами и слушателями ННГАСУ на места с оплатой стоимости обучения на договорной основе.");
    macros.SelectionTypeParagraph();
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = false");
    macros.SelectionText("Зачислить студентами 1-го курса с 01 сентября 20__ года на места с оплатой стоимости обучения на договорной основе следующих абитуриентов:");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = true");
    macros.SelectionText(" в институт экономики, управления и права");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = false");

    if (ZMySqlQuery->RecordCount==0)
        return;

    numspec=-1;
    numform=-1;
    int CountTables=0;
    int CountRows;
    int CountPrevRows=0;
    int CountPrevPrevRows=0;
    AnsiString Str,Strtmp;
    for (int i = 0; i < ZMySqlQuery->RecordCount; i++)
    {
        ZMySqlQuery->RecNo = i+1;
        if ( numspec!=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt() ||
                numform!=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt() )
        {
            numspec=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt();
            numform=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt();
            macros.SelectionTypeParagraph();
            macros.SelectionTypeParagraph();
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
            macros.SelectionText("на 1 курс по специальности \"");
            macros.SelectionFont("Bold = true");
            macros.SelectionText(WCGetTitleForKeyNum(SPECS,numspec));
            macros.SelectionText("\"");
            macros.SelectionFont("Bold = false");
            macros.SelectionText(", с формой обучения - ");
            macros.SelectionText(WCGetTitleForKeyNum(EDUFORMS,numform));
            macros.SelectionTypeParagraph();
            macros.SelectionTypeParagraph();
            CountRows=0;
            for (int j=i;j<ZMySqlQuery->RecordCount;j++)
            {
                ZMySqlQuery->RecNo=j+1;
                if (numspec!=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt() ||
                    numform!=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt()) break;
                CountRows++;
            }
            ZMySqlQuery->RecNo=i+1;
            macros.TablesAdd(CountRows, 6);
            macros.TableStyle(WordMacros::StyleNone);
            CountTables++;

            macros.TablesColumns(CountTables, 1, "Width = 30");
            macros.TablesColumns(CountTables, 2, "Width = 90");
            macros.TablesColumns(CountTables, 3, "Width = 80");
            macros.TablesColumns(CountTables, 4, "Width = 90");
            macros.TablesColumns(CountTables, 5, "Width = 100");
            macros.TablesColumns(CountTables, 6, "Width = 50");

            macros.TablesColumns(CountTables, 1, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
            macros.TablesColumns(CountTables, 2, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 3, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 4, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 5, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
            macros.TablesColumns(CountTables, 6, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

            CountPrevPrevRows=CountPrevRows;
            CountPrevRows+=CountRows;
        }
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 1, "Range.Text = \"" + AnsiString(i+1-CountPrevPrevRows) + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 2, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(1)->AsString + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 3, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(2)->AsString + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 4, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(3)->AsString + "\"");

        Str=WCGetTitleForKeyNum(DOGSHIFRS,ZMySqlQuery->Fields->FieldByNumber(6)->AsString.ToInt())+"-";
        Str+=WCGetTitleForKeyNum(DOGYEARS,ZMySqlQuery->Fields->FieldByNumber(8)->AsString.ToInt());
        Strtmp=WCGetTitleForKeyNum(DOGFASTS,ZMySqlQuery->Fields->FieldByNumber(9)->AsString.ToInt());
        if (!Strtmp.IsEmpty())
            Str+="-"+Strtmp;
        Str+=" -";
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 5, "Range.Text = \"" + Str + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 6, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(7)->AsString + "\"");
        if (i+1 == CountPrevRows)
        {
           macros.TablesCell(CountTables, CountRows, 1, "Range.Select");
           macros.InsertLine("Selection.MoveDown Unit := wdLine, Count := 2");
        }
    }
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionText("Председатель приемной комиссии");
    macros.SelectionTypeParagraph();
    macros.SelectionText("ректор, академик                                                                       Е.В. Копосов");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionText("Ответственный секретарь");
    macros.SelectionTypeParagraph();
    macros.SelectionText("приемной комиссии, доцент                                                   Н.Д. Жилина");
    macros.InsertLine("ActiveWindow.ActivePane.VerticalPercentScrolled = 0");
    
    macros.EndMacros();
    macros.RunMacros();

}