
int ind1  = 0,
    ind2  = 1,
    ind3  = 2,
    ind4  = 3,
    ind5  = 4,
    ind6  = 5,
    ind7  = 6,
    ind8  = 7,
    ind9  = 8,
    ind10 = 9,
    ind11 = 10,
    ind12 = 11,   
    CountInd=12;
double MySvodFld[CountInd];

int in1  = 0,
    in2  = 1,
    in3  = 2,
    in4  = 3,
    in5  = 4,
    in6  = 5,
    in7  = 6,
    in8  = 7,
    in9  = 8,
    in10 = 9,
    CountIn=10;
double Fld2[CountIn];

char Buf3[512], Buf4[512];

double s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12;
double s13, s14;

Tbl5()
{

  double Sum[90];   //массив сумм по категориям
  double  RV[90];   //массив РВ по категориям

  char Buf[512], Buf1[512], Buf2[512];   

  char NameP[256];

  var CTabl = CreateObject("CurPrnTbl");
  if ( !FillIdxFldMySvod(CTabl) )  return;

  int cr=CTabl.Count_Rcr(); // число рабочих записей в таблице
 
  int cntRcrKat  =0;
  int cntRcrVid  =0;
  string OldKat  ="";
  string OldVid  ="";
  double SumKat  =0,
         SumVid  =0,
         ItSum   =0;


  s01 = atof(CTabl.TextS("S_Col_36",0));
  s02 = atof(CTabl.TextS("S_Col_37",0));
  s03 = atof(CTabl.TextS("S_Col_38",0));
  s04 = atof(CTabl.TextS("S_Col_39",0));
  s05 = atof(CTabl.TextS("S_Col_40",0));
  s06 = atof(CTabl.TextS("S_Col_41",0));
  s07 = atof(CTabl.TextS("S_Col_42",0));
  s08 = atof(CTabl.TextS("S_Col_43",0));
  s09 = atof(CTabl.TextS("S_Col_44",0));
  s10 = atof(CTabl.TextS("S_Col_45",0));
  s11 = atof(CTabl.TextS("S_Col_46",0));
  s12 = atof(CTabl.TextS("S_Col_47",0));
  s13 = atof(CTabl.TextS("S_Col_49",0));
  s14 = atof(CTabl.TextS("S_Col_50",0));

  PrnTbl();

}

FillIdxFldMySvod(&CTabl)
{
   MySvodFld[ind1] = CTabl.Find_Name_Fld("S_Col_36");
   MySvodFld[ind2] = CTabl.Find_Name_Fld("S_Col_37");
   MySvodFld[ind3] = CTabl.Find_Name_Fld("S_Col_38");
   MySvodFld[ind4] = CTabl.Find_Name_Fld("S_Col_39");
   MySvodFld[ind5] = CTabl.Find_Name_Fld("S_Col_40");
   MySvodFld[ind6] = CTabl.Find_Name_Fld("S_Col_41");
   MySvodFld[ind7] = CTabl.Find_Name_Fld("S_Col_42");
   MySvodFld[ind8] = CTabl.Find_Name_Fld("S_Col_43");
   MySvodFld[ind9] = CTabl.Find_Name_Fld("S_Col_44");
   MySvodFld[ind10] = CTabl.Find_Name_Fld("S_Col_45");
   MySvodFld[ind11] = CTabl.Find_Name_Fld("S_Col_46");
   MySvodFld[ind12] = CTabl.Find_Name_Fld("S_Col_47");
   return 1;
}




PrnTbl()
 {
   double SumIt=s01+s02+s03+s04+s05+s06+s07+s08+s09+s10+s11+s12+s13+s14;
   char s[250];
   sprintf(s,"-------------------------------------------------------------------");

   sprintf(Buf3,"                  ИСПОЛЬЗОВАНИЕ ФОНДА ЗАРАБОТНОЙ ПЛАТЫ");  print(Buf3);
   sprintf(Buf3,"                           за _________  20__г.");  print(Buf3);
   print(s);
   sprintf(Buf3,"                     Коды                              |  Сумма");  print(Buf3);

   print(s);
   sprintf(Buf3,"002, 003, 004, 032, 049, 053, 055, 061, 065, 066, 170  |%11.2f",s01);  print(Buf3);
   print(s);
   sprintf(Buf3,"005, 019, 020, 031, 040, 068, 071, 072, 078, 084, 085  |%11.2f",s02);  print(Buf3);
   print(s);
   sprintf(Buf3,"042, 064, 067, 070, 080, 081                           |%11.2f",s03);  print(Buf3);
   print(s);
   sprintf(Buf3,"056                                                    |%11.2f",s04);  print(Buf3);
   print(s);
   sprintf(Buf3,"038                                                    |%11.2f",s05);  print(Buf3);
   print(s);
   sprintf(Buf3,"043, 045, 046, 048                                     |%11.2f",s06);  print(Buf3);
   print(s);
   sprintf(Buf3,"028, 027, 035, 044, 050, 060                           |%11.2f",s07);  print(Buf3);
   print(s);
   sprintf(Buf3,"069                                                    |%11.2f",s08);  print(Buf3);
   print(s);
   sprintf(Buf3,"076                                                    |%11.2f",s09);  print(Buf3);
   print(s);
   sprintf(Buf3,"006, 022, 023, 025, 030, 086                           |%11.2f",s10);  print(Buf3);
   print(s);
   sprintf(Buf3,"039                                                    |%11.2f",s11);  print(Buf3);
   print(s);
   sprintf(Buf3,"040                                                    |%11.2f",s12);  print(Buf3);
   print(s);
   sprintf(Buf3,"041, 122 - 132                                         |%11.2f",s13);  print(Buf3);
   print(s);
   sprintf(Buf3,"074, 087, 088                                          |%11.2f",s14);  print(Buf3);
   print(s);


   sprintf(Buf3,"Всего                                                  |%11.2f",SumIt);  print(Buf3);

 }

